Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / chrome / test_bug503926.xhtml
blobcfe6315fd8b8afdded29165509b918ea39a96e2a
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=503926
6 -->
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"/>
18 </body>
20 <!-- test code goes here -->
21 <script type="application/javascript">
22 <![CDATA[
24 SimpleTest.expectAssertions(0, 1);
26 var gLoadCount = 0;
27 function loaded() {
28 if (++gLoadCount == 2)
29 go();
32 /** Test for Bug 503926 **/
33 function go() {
34 var gWindowUtils = window.windowUtils;
36 // Try with a chrome object.
37 var passed = false;
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");
50 // Try with a dialog.
51 window.browsingContext.topChromeWindow.openDialog("bug503926.xhtml", "chromeDialog", "modal", window);
52 SimpleTest.finish();
55 SimpleTest.waitForExplicitFinish();
56 ]]>
57 </script>
58 </window>