file_bug1139964.xhtml (2362B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 4 type="text/css"?> 5 <!-- 6 https://bugzilla.mozilla.org/show_bug.cgi?id=1139964 7 --> 8 <window title="Mozilla Bug 1139964" 9 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 10 onload="run()"> 11 <label value="Mozilla Bug 1139964"/> 12 <!-- test code goes here --> 13 <script type="application/javascript"><![CDATA[ 14 /* global messageManager, sendAsyncMessage */ 15 var ppm = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(); 16 17 function ok(cond, msg) { 18 window.arguments[0].ok(cond, msg); 19 } 20 21 var msgName = "TEST:Global_has_Promise"; 22 23 function mmScriptForPromiseTest() { 24 /* eslint-env mozilla/process-script */ 25 sendAsyncMessage("TEST:Global_has_Promise", 26 { 27 hasPromise: ("Promise" in this), 28 hasTextEncoder: ("TextEncoder" in this), 29 hasWindow: ("Window" in this), 30 }); 31 } 32 33 function processListener(m) { 34 ppm.removeMessageListener(msgName, processListener); 35 ok(m.data.hasPromise, "ProcessGlobal should have Promise object in the global scope!"); 36 ok(m.data.hasTextEncoder, "ProcessGlobal should have TextEncoder object in the global scope!"); 37 ok(m.data.hasWindow, "ProcessGlobal should have Window object in the global scope!"); 38 39 messageManager.addMessageListener(msgName, tabListener) 40 messageManager.loadFrameScript("data:,(" + mmScriptForPromiseTest.toString() + ")()", true); 41 } 42 43 function tabListener(m) { 44 messageManager.removeMessageListener(msgName, tabListener); 45 ok(m.data.hasPromise, "BrowserChildGlobal should have Promise object in the global scope!"); 46 ok(m.data.hasTextEncoder, "BrowserChildGlobal should have TextEncoder object in the global scope!"); 47 ok(m.data.hasWindow, "BrowserChildGlobal should have Window object in the global scope!"); 48 49 window.arguments[0].setTimeout(function() { this.done(); }, 0); 50 window.close(); 51 } 52 53 function run() { 54 ppm.addMessageListener(msgName, processListener) 55 ppm.loadProcessScript("data:,(" + mmScriptForPromiseTest.toString() + ")()", true); 56 } 57 58 ]]></script> 59 <browser type="content" src="about:blank" id="ifr"/> 60 </window>