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

Unified Diff: client/tests/client/dom/InnerFrameTest.dart

Issue 9539003: Safely wrap window.top in frog dom. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and merge Created 8 years, 10 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
« no previous file with comments | « client/dom/templates/dom/frog/impl_HTMLIFrameElement.darttemplate ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/tests/client/dom/InnerFrameTest.dart
diff --git a/client/tests/client/dom/InnerFrameTest.dart b/client/tests/client/dom/InnerFrameTest.dart
index 6e2d9cf1ec477af128574d36cf2750cbbaf46271..be0cd2e6971adbb3591b6411f49d63a10d4a26db 100644
--- a/client/tests/client/dom/InnerFrameTest.dart
+++ b/client/tests/client/dom/InnerFrameTest.dart
@@ -8,15 +8,30 @@ main() {
// The child's frame should not be able to access its parent's
// document.
+
+ // Check window.frameElement.
try {
var parentDocument = window.frameElement.ownerDocument;
var div = parentDocument.createElement("div");
- div.id = "illegal";
+ div.id = "illegalFrameElement";
parentDocument.body.appendChild(div);
Expect.fail('Should not reach here.');
} catch (NoSuchMethodException e) {
// Expected.
}
+
+ // Check window.top.
+ try {
+ final top = window.top;
+ var parentDocument = top.document;
+ var div = parentDocument.createElement("div");
+ div.id = "illegalTop";
+ parentDocument.body.appendChild(div);
+ Expect.fail('Should not reach here.');
+ } catch (var e) {
+ // Expected.
+ // TODO(vsm): Enforce this is a NoSuchMethodException.
+ }
return;
}
@@ -32,7 +47,14 @@ main() {
});
test('frameElement', () {
- var div = document.getElementById('illegal');
+ var div = document.getElementById('illegalFrameElement');
+
+ // Ensure that this parent frame was not modified by its child.
+ Expect.isNull(div);
+ });
+
+ test('top', () {
+ var div = document.getElementById('illegalTop');
// Ensure that this parent frame was not modified by its child.
Expect.isNull(div);
« no previous file with comments | « client/dom/templates/dom/frog/impl_HTMLIFrameElement.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698