2 <?xml-stylesheet type=
"text/css" href=
"chrome://global/skin"?>
3 <?xml-stylesheet type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css"?>
5 https://bugzilla.mozilla.org/show_bug.cgi?id=658909
7 <window title=
"Mozilla Bug 658909"
8 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <!-- test results are displayed in the html:body -->
12 <body xmlns=
"http://www.w3.org/1999/xhtml">
13 <a href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=658909"
14 target=
"_blank">Mozilla Bug
658909</a>
17 <!-- test code goes here -->
18 <script type=
"application/javascript">
20 /** Test for call/apply-ing Xray methods.**/
21 SimpleTest.waitForExplicitFinish();
24 function frameLoaded() {
25 if (++gLoadCount == frames.length)
29 function msg(a, b, testName) {
30 return
"(" + a.name +
", " + b.name +
"): " + testName;
34 testDocumentElement(a, b, name) {
35 var getter = Object.prototype.__lookupGetter__.call(a.document, 'documentElement');
36 is(getter.call(b.document), b.document.documentElement, msg(a, b, name));
39 testInvalidCall(a, b, name) {
40 var getter = Object.prototype.__lookupGetter__.call(a.document, 'documentElement');
42 try { getter.call(b.document.body); } catch (e) { threw = true; };
43 ok(threw, msg(a, b, name));
46 testStatus(a, b, name) {
47 var setter = Object.prototype.__lookupSetter__.call(a, 'status');
48 is(b.status,
"",
"Empty status");
49 setter.call(b,
"foopy");
50 is(b.status,
"foopy", msg(a, b, name));
54 testCreateElement(a, b, name) {
55 is(a.document.createElement.call(b.document, 'div').ownerDocument, b.document, msg(a, b, name));
58 testWindowName(a, b, name) {
59 var getter = Object.prototype.__lookupGetter__.call(a, 'name');
60 is(getter.call(b), b.name, msg(a, b, name));
63 testCanvas(a, b, name) {
64 var canvasA = a.document.createElement('canvas');
65 var canvasB = b.document.createElement('canvas');
66 var contextA = canvasA.getContext('
2d');
67 var contextB = canvasB.getContext('
2d');
68 var getter = Object.prototype.__lookupGetter__.call(contextA, 'canvas');
69 is(getter.call(contextB), canvasB, msg(a, b, name));
74 for (let i =
0; i < frames.length; ++i)
75 frames[i].name = 'frame' + i;
76 for (let i =
0; i < frames.length; ++i) {
77 for (let j =
0; j < frames.length; ++j) {
78 for (let k in testFunctions)
79 testFunctions[k](frames[i], frames[j], k);
89 <iframe id=
"frame1" onload=
"frameLoaded();" type=
"content" src=
"http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" />
90 <iframe id=
"frame2" onload=
"frameLoaded();" type=
"content" src=
"http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" />
91 <iframe id=
"frame3" onload=
"frameLoaded();" type=
"content" src=
"http://example.com/tests/js/xpconnect/tests/mochitest/file_empty.html" />