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=503926
7 <window title=
"Mozilla Bug 503926"
8 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
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=503926"
14 target=
"_blank">Mozilla Bug
503926</a>
16 <iframe id=
"ifr" type=
"content" onload=
"loaded()" src=
"bug503926.xhtml#iframe"/>
17 <iframe id=
"ifrContent" type=
"content" onload=
"loaded()" src=
"http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"/>
20 <!-- test code goes here -->
21 <script type=
"application/javascript">
24 SimpleTest.expectAssertions(
0,
1);
28 if (++gLoadCount ==
2)
32 /** Test for Bug
503926 **/
34 var gWindowUtils = window.windowUtils;
36 // Try with a chrome object.
38 // eslint-disable-next-line mozilla/use-chromeutils-generateqi
39 var obj = { QueryInterface() { passed = true; } };
40 gWindowUtils.xpconnectArgument(obj);
41 ok(passed,
"trusted QIs should be called");
43 // Try with a content object.
44 var contentWin = $('ifrContent').contentWindow.wrappedJSObject;
45 contentWin.passed = false;
46 var contentObj = contentWin.eval('({ QueryInterface: function() { passed = true; } })');
47 gWindowUtils.xpconnectArgument(contentObj);
48 ok(!contentWin.passed,
"untrusted QI should not be called");
51 window.browsingContext.topChromeWindow.openDialog(
"bug503926.xhtml",
"chromeDialog",
"modal", window);
55 SimpleTest.waitForExplicitFinish();