| Index: third_party/WebKit/LayoutTests/http/tests/security/cross-origin-access-over-property-descriptor.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-access-over-property-descriptor.html b/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-access-over-property-descriptor.html
|
| index 1b468dcb61708bf28fcd7f7ef18377f18726792f..52f2e94608b32cbb7b6663bbb1aa20678067e4f5 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-access-over-property-descriptor.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-access-over-property-descriptor.html
|
| @@ -4,33 +4,36 @@
|
| <script src="/js-test-resources/js-test.js"></script>
|
| </head>
|
| <body>
|
| +<iframe id="cross-origin-frame" src="http://localhost:8000/resources/dummy.html"></iframe>
|
| <script>
|
| -description("Cross-origin access to 'window.location.pathname' over 'get' and 'set' in property descriptor should throw a SecurityError.");
|
| +description("Cross-origin access through 'get' and 'set' in a property descriptor should throw a SecurityError.");
|
|
|
| window.jsTestIsAsync = true;
|
| -window.testRunner.setCanOpenWindows(true);
|
|
|
| -var targetWindow = window.open("http://localhost:8080/");
|
| +var targetFrame = window['cross-origin-frame'];
|
| +shouldBeNonNull(targetFrame);
|
| +var targetWindow = targetFrame.contentWindow;
|
| +shouldBeNonNull(targetWindow);
|
|
|
| -var pathnameDescriptor = Object.getOwnPropertyDescriptor(Location.prototype, "pathname");
|
| +var pathnameDescriptor = Object.getOwnPropertyDescriptor(location, "pathname");
|
| shouldBeNonNull("pathnameDescriptor");
|
| shouldBe("typeof pathnameDescriptor.get", '"function"');
|
| shouldBe("typeof pathnameDescriptor.set", '"function"');
|
|
|
| -var count = 0;
|
| -var timerId = window.setInterval(function() {
|
| - if (++count > 10) {
|
| - window.clearInterval(timerId);
|
| - finishJSTest();
|
| - return;
|
| - }
|
| - if (targetWindow) {
|
| - shouldThrow("pathnameDescriptor.get.call(targetWindow.location)", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
|
| - shouldThrow("pathnameDescriptor.set.call(targetWindow.location, 1)", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
|
| - window.clearInterval(timerId);
|
| - finishJSTest();
|
| - }
|
| -}, 1000);
|
| +var devicePixelRatioDescriptor = Object.getOwnPropertyDescriptor(window, "devicePixelRatio");
|
| +shouldBeNonNull("devicePixelRatio");
|
| +shouldBe("typeof devicePixelRatioDescriptor.get", '"function"');
|
| +shouldBe("typeof devicePixelRatioDescriptor.set", '"function"');
|
| +
|
| +targetFrame.onload = function() {
|
| + shouldThrow("pathnameDescriptor.get.call(targetWindow.location)", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
|
| + shouldThrow("pathnameDescriptor.set.call(targetWindow.location, 1)", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
|
| +
|
| + shouldThrow("devicePixelRatioDescriptor.get.call(targetWindow)", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
|
| + shouldThrow("devicePixelRatioDescriptor.set.call(targetWindow, 1)", '"SecurityError: Blocked a frame with origin \\"http://127.0.0.1:8000\\" from accessing a cross-origin frame."');
|
| +
|
| + finishJSTest();
|
| +};
|
| </script>
|
| </body>
|
| </html>
|
|
|