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=860494
7 <window title=
"Mozilla Bug 860494"
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=860494"
14 target=
"_blank">Mozilla Bug
860494</a>
17 <!-- test code goes here -->
18 <script type=
"application/javascript">
20 /** Test for Bug
860494 **/
22 SimpleTest.waitForExplicitFinish();
25 var iwin = $('ifr').contentWindow;
26 // NB: mochitest-chrome actually runs the test as a content docshell.
27 is(iwin.top, window.top,
"iframe names shouldn't shadow |top| via Xray");
28 is(iwin.parent, window,
"iframe names shouldn't shadow |parent| via Xray");
29 ok(!!/http/.exec(iwin.location),
"iframe names shouldn't shadow |location| via Xray");
30 is(iwin.length,
7,
"iframe names shouldn't shadow |length| via Xray");
31 is(iwin.window, iwin,
"iframe names shouldn't shadow |window| via Xray");
32 is(iwin.navigator, Cu.unwaiveXrays(iwin.wrappedJSObject.navigator),
33 "iframe names shouldn't shadow |navigator| via Xray");
34 ok(iwin.alert instanceof Function,
35 "iframe names shouldn't shadow |alert| via Xray");
38 var sb = new Cu.Sandbox(
"https://www.example.com");
41 sb.parentWin = window;
44 Cu.evalInSandbox('ok(win.top === topWin,
"iframe names shouldnt shadow |top| via cross-origin Xray");', sb);
45 Cu.evalInSandbox('ok(win.parent === parentWin,
"iframe names shouldnt shadow |parent| via cross-origin Xray");', sb);
46 Cu.evalInSandbox('is(win.length,
7,
"iframe names shouldnt shadow |length| via cross-origin Xray");', sb);
47 Cu.evalInSandbox('ok(win.window === win,
"iframe names shouldnt shadow |window| via cross-origin Xray");', sb);
48 Cu.evalInSandbox('ok(win.navigator === win[
5],
"iframe names that correspond to non-cross-origin-visible properties should expose the subframe: navigator");', sb);
49 Cu.evalInSandbox('ok(win.alert === win[
6],
"iframe names that correspond to non-cross-origin-visible properties should expose the subframe: alert");', sb);
56 <iframe id=
"ifr" type=
"content" onload=
"go();" src=
"https://example.org/tests/js/xpconnect/tests/mochitest/file_bug860494.html" />