Bug 1458235 - Drop cases of Components.stack.caller passed as the msg to Assert.* as it isn't necessary as we already work out the stack correctly for these cases. r?Gijs draft
authorMark Banner <standard8@mozilla.com>
Fri, 04 May 2018 11:26:59 +0100
changeset 792485 2d16113a804be3f1bc08ed981206cbf3b63a7fa6
parent 792484 5ad0b644ff25c129c422bbd9ee28acf04b3fd2b9
child 792486 052774183b99dd5657f8c3ad5916b061e68b04c4
child 792545 3a8ab7fd583fceebe5b1fc9c6cd0555260ce5d9e
push id109116
push userbmo:standard8@mozilla.com
push dateTue, 08 May 2018 13:09:14 +0000
reviewersGijs
bugs1458235
milestone62.0a1
Bug 1458235 - Drop cases of Components.stack.caller passed as the msg to Assert.* as it isn't necessary as we already work out the stack correctly for these cases. r?Gijs MozReview-Commit-ID: BfFIzLr1sXv
dom/indexedDB/test/unit/xpcshell-head-parent-process.js
services/common/tests/unit/head_helpers.js
services/sync/tests/unit/test_clients_engine.js
toolkit/mozapps/extensions/test/xpcshell/test_proxies.js
--- a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
+++ b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
@@ -12,29 +12,29 @@ ChromeUtils.import("resource://gre/modul
 
 if (!("self" in this)) {
   this.self = this;
 }
 
 var bufferCache = [];
 
 function is(a, b, msg) {
-  Assert.equal(a, b, Components.stack.caller);
+  Assert.equal(a, b, msg);
 }
 
 function ok(cond, msg) {
-  Assert.ok(!!cond, Components.stack.caller);
+  Assert.ok(!!cond, msg);
 }
 
 function isnot(a, b, msg) {
-  Assert.notEqual(a, b, Components.stack.caller);
+  Assert.notEqual(a, b, msg);
 }
 
 function todo(condition, name, diag) {
-  todo_check_true(condition, Components.stack.caller);
+  todo_check_true(condition);
 }
 
 function run_test() {
   runTest();
 }
 
 if (!this.runTest) {
   this.runTest = function()
--- a/services/common/tests/unit/head_helpers.js
+++ b/services/common/tests/unit/head_helpers.js
@@ -13,31 +13,24 @@ ChromeUtils.import("resource://testing-c
 function do_check_empty(obj) {
   do_check_attribute_count(obj, 0);
 }
 
 function do_check_attribute_count(obj, c) {
   Assert.equal(c, Object.keys(obj).length);
 }
 
-function do_check_throws(aFunc, aResult, aStack) {
-  if (!aStack) {
-    try {
-      // We might not have a 'Components' object.
-      aStack = Components.stack.caller;
-    } catch (e) {}
-  }
-
+function do_check_throws(aFunc, aResult) {
   try {
     aFunc();
   } catch (e) {
-    Assert.equal(e.result, aResult, aStack);
+    Assert.equal(e.result, aResult);
     return;
   }
-  do_throw("Expected result " + aResult + ", none thrown.", aStack);
+  do_throw("Expected result " + aResult + ", none thrown.");
 }
 
 
 /**
  * Test whether specified function throws exception with expected
  * result.
  *
  * @param func
--- a/services/sync/tests/unit/test_clients_engine.js
+++ b/services/sync/tests/unit/test_clients_engine.js
@@ -79,21 +79,20 @@ add_task(async function test_bad_hmac() 
     onCollectionDeleted(username, coll) {
       deletedCollections.push(coll);
     }
   };
   let server = await serverForFoo(engine, callback);
   let user   = server.user("foo");
 
   function check_clients_count(expectedCount) {
-    let stack = Components.stack.caller;
     let coll  = user.collection("clients");
 
     // Treat a non-existent collection as empty.
-    equal(expectedCount, coll ? coll.count() : 0, stack);
+    equal(expectedCount, coll ? coll.count() : 0);
   }
 
   function check_client_deleted(id) {
     let coll = user.collection("clients");
     let wbo  = coll.wbo(id);
     return !wbo || !wbo.payload;
   }
 
--- a/toolkit/mozapps/extensions/test/xpcshell/test_proxies.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_proxies.js
@@ -56,17 +56,17 @@ function promiseWriteFile(aFile, aData) 
 
   return OS.File.writeAtomic(aFile.path, new TextEncoder().encode(aData));
 }
 
 function checkAddonsExist() {
   for (let addon of ADDONS) {
     let file = addon.directory.clone();
     file.append("install.rdf");
-    Assert.ok(file.exists(), Components.stack.caller);
+    Assert.ok(file.exists());
   }
 }
 
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");