| <html> |
| <head> |
| <script src="resources/cross-frame-access.js"></script> |
| </head> |
| <body> |
| <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-get-test.html" style=""></iframe> |
| <pre id="console"></pre> |
| <script> |
| |
| window.targetWindow = frames[0]; |
| |
| window.onload = function() |
| { |
| if (window.testRunner) { |
| testRunner.setCanOpenWindows(true); |
| testRunner.dumpAsText(); |
| } |
| |
| log("\n----- tests for calling methods of another frame using Function.call -----\n"); |
| |
| // Allowed |
| // void focus(); |
| // void blur(); |
| // void close(); |
| // void postMessage(in DOMString message); |
| |
| // - Tests for the Window object - |
| // undefined value indicates failure |
| shouldBe("window.setTimeout.call(targetWindow, 'void(0);', 0)", "undefined"); |
| shouldBe("window.setInterval.call(targetWindow, 'void(0);', 0)", "undefined"); |
| shouldBe("window.getSelection.call(targetWindow)", "undefined"); |
| shouldBe("window.find.call(targetWindow, 'string', false, false, false, false, false, false)", "undefined"); |
| shouldBe("window.confirm.call(targetWindow, 'message')", "undefined"); |
| shouldBe("window.prompt.call(targetWindow, 'message', 'defaultValue')", "undefined"); |
| shouldBe("window.getComputedStyle.call(targetWindow, document.body, '')", "undefined"); |
| shouldBe("window.getMatchedCSSRules.call(targetWindow, document.body, '')", "undefined"); |
| shouldBe("window.openDatabase.call(targetWindow, 'name', '1.0', 'description', 0)", "undefined"); |
| shouldBe("window.atob.call(targetWindow, 'string')", "undefined"); |
| shouldBe("window.btoa.call(targetWindow, 'string')", "undefined"); |
| shouldBe("window.open.call(targetWindow, '')", "undefined"); |
| |
| // These always return undefined so we use the error console to detect failure |
| shouldBe("window.addEventListener.call(targetWindow, 'load', null, false);", "undefined"); |
| shouldBe("window.removeEventListener.call(targetWindow, 'load', null, false);", "undefined"); |
| shouldBe("window.clearTimeout.call(targetWindow, 0);", "undefined"); |
| shouldBe("window.clearInterval.call(targetWindow, 0);", "undefined"); |
| shouldBe("window.print.call(targetWindow);", "undefined"); |
| shouldBe("window.stop.call(targetWindow);", "undefined"); |
| shouldBe("window.alert.call(targetWindow, 'message');", "undefined"); |
| shouldBe("window.scrollBy.call(targetWindow, 0, 0);", "undefined"); |
| shouldBe("window.scrollTo.call(targetWindow, 0, 0);", "undefined"); |
| shouldBe("window.scroll.call(targetWindow, 0, 0);", "undefined"); |
| shouldBe("window.moveBy.call(targetWindow, 0, 0);", "undefined"); |
| shouldBe("window.moveTo.call(targetWindow, 0, 0);", "undefined"); |
| shouldBe("window.resizeBy.call(targetWindow, 0, 0);", "undefined"); |
| shouldBe("window.resizeTo.call(targetWindow, 0, 0);", "undefined"); |
| shouldBe("window.showModalDialog.call(targetWindow);", "undefined"); |
| |
| // Throws an EvalError and logs to the error console |
| shouldBe("window.eval.call(targetWindow, '1+2');", '3'); |
| |
| // - Tests for the Location object - |
| // undefined value indicates failure |
| shouldBe("window.location.toString.call(targetWindow.location)", "undefined"); |
| |
| // Work around DRT bug that causes subsequent tests to fail. |
| window.stop(); |
| } |
| </script> |
| </body> |
| </html> |