Changeset 229369 in webkit
- Timestamp:
- Mar 7, 2018 10:38:51 AM (6 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r229363 r229369 1 2018-03-07 Chris Dumez <cdumez@apple.com> 2 3 http/tests/dom/window-open-about-webkit-org-and-access-document.html is failing with async policy delegates 4 https://bugs.webkit.org/show_bug.cgi?id=183394 5 6 Reviewed by Alex Christensen. 7 8 http/tests/dom/window-open-about-webkit-org-and-access-document.html is failing with async policy delegates. 9 The issue is that the test calls window.open() with a cross-origin URL and then right away tries to access 10 newWindow.document, expecting it to throw. However, there is no guarantee that the cross origin URL has 11 started loading at this point. In particular, when the navigation policy decision is made asynchronously, 12 the URL is initially "about:blank" and it is OK to access the newWindow's document at this point. 13 14 We would normally rely on the window's load event before doing the check. However, this would not work 15 here since the window is cross origin. As a result, I am using a setInterval() in order to wait for the 16 cross-origin URL to load and for newWindow.document to start throwing. 17 18 * http/tests/dom/window-open-about-webkit-org-and-access-document-async-delegates-expected.txt: Added. 19 * http/tests/dom/window-open-about-webkit-org-and-access-document-async-delegates.html: Added. 20 * http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt: 21 * http/tests/dom/window-open-about-webkit-org-and-access-document.html: 22 1 23 2018-03-07 Yusuke Suzuki <utatane.tea@gmail.com> 2 24 -
trunk/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document-expected.txt
r219663 r229369 1 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. 1 Tests opening a new about://webkit.org window and accessing its document 2 2 3 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. 4 . 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 5 4 5 6 PASS e.name is "SecurityError" 7 PASS successfullyParsed is true 8 9 TEST COMPLETE 10 -
trunk/LayoutTests/http/tests/dom/window-open-about-webkit-org-and-access-document.html
r205136 r229369 1 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <title>Tests opening a new about://webkit.org window and accessing its document</title> 5 <script src="../resources/js-test-pre.js"></script> 2 <html> 3 <body> 4 <script src="/js-test-resources/js-test.js"></script> 6 5 <script> 6 description("Tests opening a new about://webkit.org window and accessing its document"); 7 jsTestIsAsync = true; 8 7 9 var newWindow; 8 10 9 11 if (window.testRunner) { 10 12 testRunner.setCanOpenWindows(); 11 testRunner.waitUntilDone();12 13 testRunner.setPopupBlockingEnabled(false); 13 14 } 14 15 15 function checkNewWindowDocumentIsUndefined () {16 shouldThrowErrorName("newWindow.document", "SecurityError");17 if (window.testRunner)18 testRunner.notifyDone();16 function finish() 17 { 18 clearInterval(handle); 19 finishJSTest(); 19 20 } 20 21 21 function run() {22 newWindow = window.open("about://webkit.org");22 function checkCannotAccessDocument() 23 { 23 24 try { 24 newWindow.document.write("<scri" + "pt>console.log('Injected script running.')</sc" + "ript>"); 25 testFailed("Was able to write to the new window's document."); 26 if (window.testRunner) 27 testRunner.notifyDone(); 28 } catch (e) { 29 console.log(e); 30 setTimeout(checkNewWindowDocumentIsUndefined, 500); 25 newWindow.document; 26 if (newWindow.document.URL != "about:blank") { 27 testFailed("Managed to access the document at URL " + newWindow.document.URL); 28 finish(); 29 } 30 } catch (_e) { 31 e = _e; 32 shouldBeEqualToString("e.name", "SecurityError"); 33 finish(); 31 34 } 32 35 } 36 37 onload = function () { 38 newWindow = window.open("about://webkit.org"); 39 handle = setInterval(checkCannotAccessDocument, 5); 40 41 } 33 42 </script> 34 </head>35 <body onload="run()">36 <div id="console"></div>37 43 </body> 38 44 </html>
Note: See TracChangeset
for help on using the changeset viewer.