Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / security / cross-frame-access-location-put.html
blobd4b489aec3482574461b8c59911a6bd06f5d8f03
1 <html>
2 <head>
3 <script src="resources/cross-frame-access.js"></script>
4 <script>
5 if (window.testRunner) {
6 testRunner.dumpAsText();
7 testRunner.dumpChildFramesAsText();
8 testRunner.waitUntilDone();
11 onload = function()
13 // Add manual run buttons if the browser does not support window.postMessage
14 if (!window.postMessage) {
15 log("YOUR BROWSER DOES NOT SUPPORT window.postMessage");
16 log("To run this test manually, first click the button titled 'Step 1 - Set Test' in this frame.");
17 log("Then click the button in the sub frame titled 'Step 2 - Set Check' to finish the test.\n");
19 var button = document.createElement("button");
20 button.appendChild(document.createTextNode("Step 1 - Set Test"));
21 button.onclick = setTest;
22 document.body.appendChild(button);
26 receiver = function(e)
28 if (e.data == "storedOldValuesComplete")
29 setTest();
31 addEventListener('message', receiver, false);
33 setTest = function()
35 window.targetWindow = frames[0];
37 // Put testing for the many og standard attibutes of the location object is handeled in stand alone test
38 // cases because they may produce side effects.
39 try { targetWindow.location.assign = "FAIL!! CUSTOM assign"; } catch(e) { log(e); }
40 try { targetWindow.location.replace = "FAIL!! CUSTOM replace"; } catch(e) { log(e); }
41 try { targetWindow.location.reload = "FAIL!! CUSTOM reload"; } catch(e) { log(e); }
42 try { targetWindow.location.toString = "FAIL!! CUSTOM toString"; } catch(e) { log(e); }
44 try { targetWindow.location.customAttribute = "FAIL!! CUSTOM customAttribute"; } catch(e) { log(e); }
46 if (window.postMessage)
47 targetWindow.postMessage("settingValuesComplete", "*");
48 else
49 log("\nSet Test complete! Click button entitled 'Step 2 - Set Check' to finish the test.");
51 </script>
52 </head>
53 <body>
54 <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-location-put-test.html"></iframe>
55 <pre id="console"></pre>
56 </body>
57 </html>