WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-183394-20180306193109.patch (text/plain), 8.27 KB, created by
Chris Dumez
on 2018-03-06 19:31:10 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2018-03-06 19:31:10 PST
Size:
8.27 KB
patch
obsolete
>Subversion Revision: 229341 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 9856146e81cadc9d4217ef11fd75dabddae1ade8..f91e02e54635750e3f8f4d9da34745e59b3f44ac 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,25 @@ >+2018-03-06 Chris Dumez <cdumez@apple.com> >+ >+ http/tests/dom/window-open-about-webkit-org-and-access-document.html is failing with async policy delegates >+ https://bugs.webkit.org/show_bug.cgi?id=183394 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ http/tests/dom/window-open-about-webkit-org-and-access-document.html is failing with async policy delegates. >+ The issue is that the test calls window.open() with a cross-origin URL and then right away tries to access >+ newWindow.document, expecting it to throw. However, there is no guarantee that the cross origin URL has >+ started loading at this point. In particular, when the navigation policy decision is made asynchronously, >+ the URL is initially "about:blank" and it is OK to access the newWindow's document at this point. >+ >+ We would normally rely on the window's load event before doing the check. However, this would not work >+ here since the window is cross origin. As a result, I am using a setInterval() in order to wait for the >+ cross-origin URL to load and for newWindow.document to start throwing. >+ >+ * http/tests/dom/window-open-about-webkit-org-and-access-document-async-delegates-expected.txt: Added. >+ * http/tests/dom/window-open-about-webkit-org-and-access-document-async-delegates.html: Added. >+ * http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt: >+ * http/tests/dom/window-open-about-webkit-org-and-access-document.html: >+ > 2018-03-06 Chris Dumez <cdumez@apple.com> > > fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed.html fails with async policy delegates >diff --git a/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-async-delegates-expected.txt b/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-async-delegates-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..cf52d7319135b5a8bfa57930e2a12710468dae7e >--- /dev/null >+++ b/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-async-delegates-expected.txt >@@ -0,0 +1,10 @@ >+Tests opening a new about://webkit.org window and accessing its document >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS e.name is "SecurityError" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-async-delegates.html b/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-async-delegates.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ee3cfb239e1d7aabc1cd3bf07f96f0adf732e346 >--- /dev/null >+++ b/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-async-delegates.html >@@ -0,0 +1,46 @@ >+<!DOCTYPE html> >+<html> >+<body> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script> >+ description("Tests opening a new about://webkit.org window and accessing its document"); >+ jsTestIsAsync = true; >+ >+ var newWindow; >+ >+ if (window.testRunner) { >+ testRunner.setCanOpenWindows(); >+ testRunner.setPopupBlockingEnabled(false); >+ if (testRunner.setShouldDecideNavigationPolicyAfterDelay) >+ testRunner.setShouldDecideNavigationPolicyAfterDelay(true); >+ } >+ >+ function finish() >+ { >+ clearInterval(handle); >+ finishJSTest(); >+ } >+ >+ function checkCannotAccessDocument() >+ { >+ try { >+ newWindow.document; >+ if (newWindow.document.URL != "about:blank") { >+ testFailed("Managed to access the document at URL " + newWindow.document.URL); >+ finish(); >+ } >+ } catch (_e) { >+ e = _e; >+ shouldBeEqualToString("e.name", "SecurityError"); >+ finish(); >+ } >+ } >+ >+ onload = function () { >+ newWindow = window.open("about://webkit.org"); >+ handle = setInterval(checkCannotAccessDocument, 5); >+ >+ } >+ </script> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt b/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt >index 3f54e8316c84ed59fd3ca2f966181d9829a9e2ae..cf52d7319135b5a8bfa57930e2a12710468dae7e 100644 >--- a/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt >+++ b/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt >@@ -1,5 +1,10 @@ >-CONSOLE MESSAGE: line 29: SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "null". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "about". Protocols must match. >+Tests opening a new about://webkit.org window and accessing its document > >-PASS newWindow.document threw exception SecurityError: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "null". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "about". Protocols must match. >-. >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS e.name is "SecurityError" >+PASS successfullyParsed is true >+ >+TEST COMPLETE > >diff --git a/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document.html b/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document.html >index fe4d661c81325b88f46716856be523c5f9e83bf9..b984c69d47f66f91ebee95b9e8e2ca8d6336f8a9 100644 >--- a/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document.html >+++ b/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document.html >@@ -1,38 +1,44 @@ > <!DOCTYPE html> >-<html lang="en"> >-<head> >- <title>Tests opening a new about://webkit.org window and accessing its document</title> >- <script src="../resources/js-test-pre.js"></script> >+<html> >+<body> >+ <script src="/js-test-resources/js-test.js"></script> > <script> >+ description("Tests opening a new about://webkit.org window and accessing its document"); >+ jsTestIsAsync = true; >+ > var newWindow; > > if (window.testRunner) { > testRunner.setCanOpenWindows(); >- testRunner.waitUntilDone(); > testRunner.setPopupBlockingEnabled(false); > } > >- function checkNewWindowDocumentIsUndefined () { >- shouldThrowErrorName("newWindow.document", "SecurityError"); >- if (window.testRunner) >- testRunner.notifyDone(); >+ function finish() >+ { >+ clearInterval(handle); >+ finishJSTest(); > } > >- function run() { >- newWindow = window.open("about://webkit.org"); >+ function checkCannotAccessDocument() >+ { > try { >- newWindow.document.write("<scri" + "pt>console.log('Injected script running.')</sc" + "ript>"); >- testFailed("Was able to write to the new window's document."); >- if (window.testRunner) >- testRunner.notifyDone(); >- } catch (e) { >- console.log(e); >- setTimeout(checkNewWindowDocumentIsUndefined, 500); >+ newWindow.document; >+ if (newWindow.document.URL != "about:blank") { >+ testFailed("Managed to access the document at URL " + newWindow.document.URL); >+ finish(); >+ } >+ } catch (_e) { >+ e = _e; >+ shouldBeEqualToString("e.name", "SecurityError"); >+ finish(); > } > } >+ >+ onload = function () { >+ newWindow = window.open("about://webkit.org"); >+ handle = setInterval(checkCannotAccessDocument, 5); >+ >+ } > </script> >-</head> >-<body onload="run()"> >-<div id="console"></div> > </body> > </html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
commit-queue
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 183394
: 335169