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); |
+ }); |
+} |