Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/cross-origin-access-over-property-descriptor.html

Issue 1380503002: binding: Makes Window/Location's attributes accessor-type properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated a test result. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698