|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=936056 |
|
5 --> |
|
6 <head> |
|
7 <meta charset="utf-8"> |
|
8 <title>Test for Bug 936056</title> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 <script type="application/javascript"> |
|
12 |
|
13 /** Test for Bug 936056 **/ |
|
14 SimpleTest.waitForExplicitFinish(); |
|
15 window.onload = function() { |
|
16 var desc = Object.getOwnPropertyDescriptor(frames[0], "document"); |
|
17 if (!desc || !desc.get) { |
|
18 todo(false, "This test does nothing so far, but will once Window is on WebIDL bindings"); |
|
19 SimpleTest.finish(); |
|
20 return; |
|
21 } |
|
22 get = desc.get; |
|
23 ok(get, "Couldn't find document getter"); |
|
24 Object.defineProperty(frames[0], "foo", { get: get }); |
|
25 |
|
26 var barewordFunc = frames[0].eval("(function (count) { var doc; for (var i = 0; i < count; ++i) doc = foo; return doc.documentElement; })"); |
|
27 var qualifiedFunc = frames[0].eval("(function (count) { var doc; for (var i = 0; i < count; ++i) doc = window.document; return doc.documentElement; })"); |
|
28 document.querySelector("iframe").onload = function () { |
|
29 // interp |
|
30 is(barewordFunc(1).textContent, "OLD", "Bareword should see own inner 1"); |
|
31 is(qualifiedFunc(1).textContent, "NEW", |
|
32 "Qualified should see current inner 1"); |
|
33 // baseline |
|
34 is(barewordFunc(100).textContent, "OLD", "Bareword should see own inner 2"); |
|
35 is(qualifiedFunc(100).textContent, "NEW", |
|
36 "Qualified should see current inner 2"); |
|
37 // ion |
|
38 is(barewordFunc(10000).textContent, "OLD", "Bareword should see own inner 3"); |
|
39 is(qualifiedFunc(10000).textContent, "NEW", |
|
40 "Qualified should see current inner 2"); |
|
41 SimpleTest.finish(); |
|
42 } |
|
43 frames[0].location = "data:text/plain,NEW"; |
|
44 } |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 </script> |
|
50 </head> |
|
51 <body> |
|
52 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936056">Mozilla Bug 936056</a> |
|
53 <p id="display"></p> |
|
54 <div id="content" style="display: none"> |
|
55 <iframe src="data:text/plain,OLD"></iframe> |
|
56 </div> |
|
57 <pre id="test"> |
|
58 </pre> |
|
59 </body> |
|
60 </html> |