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

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

Issue 9453004: Cross frame access tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Frog DOM support for safe cross-frame window access. 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
Index: client/tests/client/dom/InnerFrameTest.dart
diff --git a/client/tests/client/dom/InnerFrameTest.dart b/client/tests/client/dom/InnerFrameTest.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6e0fbf2bf194346e801d001c36a868be2d3910fe
--- /dev/null
+++ b/client/tests/client/dom/InnerFrameTest.dart
@@ -0,0 +1,35 @@
+#library('InnerFrameTest');
+#import('../../../testing/unittest/unittest.dart');
+#import('dart:dom');
+
+main() {
+ if (window != window.top) {
antonm 2012/02/24 09:28:54 nit: I think it should be !==
+ // Child frame.
+
+ // The child's frame should not be able to access its parent's
+ // document.
+ var parentDocument = window.frameElement.ownerDocument;
+ var div = parentDocument.createElement("div");
+ div.id = "illegal";
+ parentDocument.body.appendChild(div);
+ return;
+ }
+
+ // Parent / test frame
+ forLayoutTests();
+
+ final iframe = document.createElement('iframe');
+ iframe.src = window.location.href;
+
+ asyncTest('prepare', 1, () {
+ iframe.addEventListener('load', (e) => callbackDone(), false);
sra1 2012/02/24 03:38:30 Will the script have completed by this time, or do
+ document.body.appendChild(iframe);
+ });
+
+ test('frameElement', () {
+ var div = document.getElementById('illegal');
+
+ // Ensure that this parent frame was not modified by its child.
+ Expect.isNull(div);
+ });
+}
« client/tests/client/dom/CrossFrameTest.dart ('K') | « client/tests/client/dom/CrossFrameTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698