Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / chrome / test_xrayic.xhtml
blobfd9ab8f7b3513230ce10b3d08d51da7af594a5ef
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=1355109
6 -->
7 <window title="Mozilla Bug 1355109"
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=758415"
14 target="_blank">Mozilla Bug 758415</a>
15 </body>
17 <!-- test code goes here -->
18 <script type="application/javascript">
19 <![CDATA[
21 SimpleTest.waitForExplicitFinish();
23 // Import our test JSM. We first strip the filename off
24 // the chrome url, then append the jsm filename.
25 var base = /.*\//.exec(window.location.href)[0];
26 ChromeUtils.import(base + "file_expandosharing.jsm");
28 // Wait for all child frames to load.
29 var gLoadCount = 0;
30 function frameLoaded() {
31 if (++gLoadCount == window.frames.length)
32 go();
35 function go() {
36 testSandbox(1);
37 testSandbox(100);
38 testSandbox(1000);
39 SimpleTest.finish();
42 function testSandbox(iterations) {
43 // Create an expanded principal sandbox to get xrays with exclusive
44 // expandos.
45 var sandbox = new Cu.Sandbox(["https://test1.example.org",
46 "https://test2.example.org"]);
47 sandbox.iframeWindows = new sandbox.Array();
48 for (let iframe of document.getElementsByTagName('iframe')) {
49 sandbox.iframeWindows.push(iframe.contentWindow);
51 Cu.evalInSandbox(testClassName.toSource(), sandbox);
52 Cu.evalInSandbox(testIC.toSource(), sandbox);
53 is(Cu.evalInSandbox("testIC(" + iterations + ");", sandbox), true, "sandbox test");
56 // This is in a separate function to provide a common source location for ICs.
57 function testClassName(obj, expected) {
58 var className = obj.className;
59 if (className != expected)
60 throw new Error("Got " + className + ", expected " + expected);
63 function testIC(iterations) {
64 for (var i = 0; i < this.iframeWindows.length; i++) {
65 var win = this.iframeWindows[i];
66 var spans = win.document.getElementsByTagName('span');
67 for (var j = 0; j < spans.length; j++) {
68 var span = spans[j];
69 for (var k = 0; k < iterations; k++)
70 testClassName(span, "iamaspan");
71 Object.defineProperty(span, "className", { value: "what" });
72 testClassName(span, "what");
75 return true;
77 ]]>
78 </script>
79 <iframe id="inlineFrame1" onload="frameLoaded();" type="content" src="https://test1.example.org/tests/js/xpconnect/tests/mochitest/file_xrayic.html" />
80 <iframe id="inlineFrame2" onload="frameLoaded();" type="content" src="https://test1.example.org/tests/js/xpconnect/tests/mochitest/file_xrayic.html" />
81 </window>