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

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: Final pass of comments, update of status 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/tests/client/dom/CrossFrameTest.dart ('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
new file mode 100644
index 0000000000000000000000000000000000000000..6e2d9cf1ec477af128574d36cf2750cbbaf46271
--- /dev/null
+++ b/client/tests/client/dom/InnerFrameTest.dart
@@ -0,0 +1,40 @@
+#library('InnerFrameTest');
+#import('../../../testing/unittest/unittest.dart');
+#import('dart:dom');
+
+main() {
+ if (window != window.top) {
+ // Child frame.
+
+ // The child's frame should not be able to access its parent's
+ // document.
+ try {
+ var parentDocument = window.frameElement.ownerDocument;
+ var div = parentDocument.createElement("div");
+ div.id = "illegal";
+ parentDocument.body.appendChild(div);
+ Expect.fail('Should not reach here.');
+ } catch (NoSuchMethodException e) {
+ // Expected.
+ }
+ return;
+ }
+
+ // Parent / test frame
+ forLayoutTests();
+
+ final iframe = document.createElement('iframe');
+ iframe.src = window.location.href;
+
+ asyncTest('prepare', 1, () {
+ iframe.addEventListener('load', (e) => callbackDone(), false);
+ 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);
+ });
+}
« no previous file with comments | « client/tests/client/dom/CrossFrameTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698