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
--- 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");