Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / security / javascriptURL / xss-ALLOWED-to-javascript-url-window-open.html
index a613964..6018c7d 100644 (file)
                 testRunner.setCanOpenWindows();
             }
 
-            var url = "javascript:\"<html><head><scr" + "ipt>window.onload = function() { if (window.testRunner) testRunner.globalFlag = true; }</scr" + "ipt></head><body><p>Opened Frame</p><p id='accessMe'>FAIL</p></body></html>\"";
+            var url = "javascript:\"<html><head><scr" + "ipt>window.onload = function() { window.opener.postMessage('run test', '*'); }</scr" + "ipt></head><body><p>Opened Frame</p><p id='accessMe'>FAIL</p></body></html>\"";
             openedWindow = window.open(url);
 
-            if (window.testRunner) {
-                setTimeout(pollForTest, 1);
-            } else {
-                log("To run the test, click the button below when the opened window finishes loading.");
-                var button = document.createElement("button");
-                button.appendChild(document.createTextNode("Run Test"));
-                button.onclick = runTest;
-                document.body.appendChild(button);
-            }
-
-        }
-
-        pollForTest = function()
-        {
-            if (!testRunner.globalFlag) {
-                setTimeout(pollForTest, 1);
-                return;
-            }
-            runTest();
-            closeWindowAndNotifyDone(openedWindow);
+            window.addEventListener('message', function ()
+            {
+                runTest();
+                closeWindowAndNotifyDone(openedWindow);
+            });
         }
 
         runTest = function()