1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/workers/test/test_extensionBootstrap.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,74 @@ 1.4 +<?xml version="1.0"?> 1.5 +<!-- 1.6 + Any copyright is dedicated to the Public Domain. 1.7 + http://creativecommons.org/publicdomain/zero/1.0/ 1.8 +--> 1.9 +<window title="DOM Worker Threads Test" 1.10 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.11 + onload="test();"> 1.12 + 1.13 + <script type="application/javascript" 1.14 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 1.15 + <script type="application/javascript" 1.16 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> 1.17 + <script type="application/javascript" src="dom_worker_helper.js"/> 1.18 + 1.19 + <script type="application/javascript"> 1.20 + <![CDATA[ 1.21 + 1.22 + const Cc = Components.classes; 1.23 + const Ci = Components.interfaces; 1.24 + const Cu = Components.utils; 1.25 + 1.26 + Cu.import("resource://gre/modules/AddonManager.jsm"); 1.27 + Cu.import("resource://gre/modules/Services.jsm"); 1.28 + Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 1.29 + 1.30 + function test() { 1.31 + const message = "woohoo"; 1.32 + 1.33 + var observer = { 1.34 + observe: function(subject, topic, data) { 1.35 + is(topic, "message", "Correct type of event"); 1.36 + is(data, message, "Correct message"); 1.37 + 1.38 + AddonManager.getAddonByID("workerbootstrap-test@mozilla.org", 1.39 + function(addon) { 1.40 + addon.uninstall(); 1.41 + 1.42 + const stages = [ "install", "startup", "shutdown", "uninstall" ]; 1.43 + const symbols = [ "Worker", "ChromeWorker" ]; 1.44 + 1.45 + for each (var stage in stages) { 1.46 + for each (var symbol in symbols) { 1.47 + is(Services.prefs.getBoolPref("workertest.bootstrap." + stage + 1.48 + "." + symbol), 1.49 + true, 1.50 + "Symbol '" + symbol + "' present during '" + stage + "'"); 1.51 + } 1.52 + } 1.53 + 1.54 + SimpleTest.finish(); 1.55 + }); 1.56 + }, 1.57 + QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]) 1.58 + }; 1.59 + 1.60 + var workertestbootstrap = Cc["@mozilla.org/test/workertestbootstrap;1"]. 1.61 + createInstance(Ci.nsIObserver); 1.62 + 1.63 + workertestbootstrap.observe(observer, "postMessage", message); 1.64 + 1.65 + SimpleTest.waitForExplicitFinish(); 1.66 + } 1.67 + 1.68 + ]]> 1.69 + </script> 1.70 + 1.71 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.72 + <p id="display"></p> 1.73 + <div id="content" style="display:none;"></div> 1.74 + <pre id="test"></pre> 1.75 + </body> 1.76 + <label id="test-result"/> 1.77 +</window>