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

Unified Diff: LayoutTests/http/tests/plugins/resources/cross-frame-object-access.html

Issue 19095003: Throw 'SecurityError' upon cross-origin Location access. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaseline. Created 7 years, 5 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: LayoutTests/http/tests/plugins/resources/cross-frame-object-access.html
diff --git a/LayoutTests/http/tests/plugins/resources/cross-frame-object-access.html b/LayoutTests/http/tests/plugins/resources/cross-frame-object-access.html
index f03f2eb11f90eaec03e14fa499f35a72b6cdb240..efe7d0a023b740732e452be5abe8d9ccc33c4d18 100644
--- a/LayoutTests/http/tests/plugins/resources/cross-frame-object-access.html
+++ b/LayoutTests/http/tests/plugins/resources/cross-frame-object-access.html
@@ -14,11 +14,14 @@ function checkLocationObject(l)
return false;
}
- if (l.href) {
- debug('could access top.location.href');
- return false;
+ try {
+ if (l.href) {
+ debug('could access top.location.href');
+ return false;
+ }
+ } catch (e) {
+ return true;
}
-
return true;
}
@@ -31,41 +34,45 @@ function runTest() {
numErrors++;
// Try getting childFrame.location.href using NPN_Evaluate
- var href = document.plugin.testEvaluate('top.location.href');
+ try {
+ var href = document.plugin.testEvaluate('top.location.href');
+ } catch (e) {}
if (href) {
debug("could access top.location.href")
numErrors++;
}
-
+
// Try accessing childFrame.location using NPN_GetProperty
var l = document.plugin.testGetProperty('top', 'location');
if (!checkLocationObject(l))
numErrors++;
-
- var href = document.plugin.testGetProperty('top', 'location', 'href');
+
+ try {
+ var href = document.plugin.testGetProperty('top', 'location', 'href');
+ } catch (e) {}
if (href) {
debug("could access top.location.href")
numErrors++;
}
-
+
// Try accessing top.document using NPN_EVALUATE
var l = document.plugin.testEvaluate('top.document')
if (l) {
debug('could access top.document');
numErrors++;
}
-
+
// Try accessing top.document using NPN_GetProperty
var l = document.plugin.testGetProperty('top', 'document')
if (l) {
debug('could access top.document');
numErrors++;
}
-
+
if (numErrors == 0)
document.getElementById('result').innerHTML = 'SUCCESS';
}
-
+
</script>
</head>
<body onload="runTest()">

Powered by Google App Engine
This is Rietveld 408576698