Bug 1313440: Fix NS_ENSURE_TRUE(isSandbox) warnings in test code. r=erahm
authorKris Maglione <maglione.k@gmail.com>
Thu, 27 Oct 2016 13:28:01 -0700
changeset 320034 fb2d15e4f33d8a643197563608d1c216691abb18
parent 320033 c136ac92dcdc37dfd09f4868887f1ccf86522989
child 320035 94d5d14da6bac6f013d6cc1187ac218092cea05e
push id20749
push userryanvm@gmail.com
push dateSat, 29 Oct 2016 13:21:21 +0000
treeherderfx-team@1b170b39ed6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1313440
milestone52.0a1
Bug 1313440: Fix NS_ENSURE_TRUE(isSandbox) warnings in test code. r=erahm MozReview-Commit-ID: GkDaUL6sDfy
addon-sdk/source/app-extension/bootstrap.js
addon-sdk/source/test/addons/l10n-properties/app-extension/bootstrap.js
addon-sdk/source/test/addons/simple-prefs-regression/app-extension/bootstrap.js
--- a/addon-sdk/source/app-extension/bootstrap.js
+++ b/addon-sdk/source/app-extension/bootstrap.js
@@ -293,21 +293,18 @@ function loadSandbox(uri) {
       CC: bind(CC, Components), components: Components,
       ChromeWorker: ChromeWorker });
   };
   scriptLoader.loadSubScript(uri, sandbox, 'UTF-8');
   return sandbox;
 }
 
 function unloadSandbox(sandbox) {
-  if ("nukeSandbox" in Cu) {
-    try {
-      Cu.nukeSandbox(sandbox);
-    } catch (e) {}
-  }
+  if (Cu.getClassName(sandbox, true) == "Sandbox")
+    Cu.nukeSandbox(sandbox);
 }
 
 function setTimeout(callback, delay) {
   let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   timer.initWithCallback({ notify: callback }, delay,
                          Ci.nsITimer.TYPE_ONE_SHOT);
   return timer;
 }
--- a/addon-sdk/source/test/addons/l10n-properties/app-extension/bootstrap.js
+++ b/addon-sdk/source/test/addons/l10n-properties/app-extension/bootstrap.js
@@ -275,17 +275,17 @@ function loadSandbox(uri) {
       CC: bind(CC, Components), components: Components,
       ChromeWorker: ChromeWorker });
   };
   scriptLoader.loadSubScript(uri, sandbox, 'UTF-8');
   return sandbox;
 }
 
 function unloadSandbox(sandbox) {
-  if ("nukeSandbox" in Cu)
+  if (Cu.getClassName(sandbox, true) == "Sandbox")
     Cu.nukeSandbox(sandbox);
 }
 
 function setTimeout(callback, delay) {
   let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   timer.initWithCallback({ notify: callback }, delay,
                          Ci.nsITimer.TYPE_ONE_SHOT);
   return timer;
--- a/addon-sdk/source/test/addons/simple-prefs-regression/app-extension/bootstrap.js
+++ b/addon-sdk/source/test/addons/simple-prefs-regression/app-extension/bootstrap.js
@@ -275,17 +275,17 @@ function loadSandbox(uri) {
       CC: bind(CC, Components), components: Components,
       ChromeWorker: ChromeWorker });
   };
   scriptLoader.loadSubScript(uri, sandbox, 'UTF-8');
   return sandbox;
 }
 
 function unloadSandbox(sandbox) {
-  if ("nukeSandbox" in Cu)
+  if (Cu.getClassName(sandbox, true) == "Sandbox")
     Cu.nukeSandbox(sandbox);
 }
 
 function setTimeout(callback, delay) {
   let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   timer.initWithCallback({ notify: callback }, delay,
                          Ci.nsITimer.TYPE_ONE_SHOT);
   return timer;