Bug 1371844 - Add explicit API to set Debugging.failTestsOnAutoClose in Sqlite.jsm. r=mak
With JSM global sharing, the Debugging object is no longer a property
directly on the global of the Sqllite object. Instead of going through
this back door, add a setter method to Sqllite and use that.
MozReview-Commit-ID: HVCZ4Zb42q7
--- a/toolkit/modules/Sqlite.jsm
+++ b/toolkit/modules/Sqlite.jsm
@@ -1466,10 +1466,13 @@ this.Sqlite = {
/**
* Shutdown barrier client. May be used by clients to perform last-minute
* cleanup prior to the shutdown of this module.
*
* See the documentation of AsyncShutdown.Barrier.prototype.client.
*/
get shutdown() {
return Barriers.shutdown.client;
- }
+ },
+ failTestsOnAutoClose(enabled) {
+ Debugging.failTestsOnAutoClose = enabled;
+ },
};
--- a/toolkit/modules/tests/xpcshell/test_sqlite.js
+++ b/toolkit/modules/tests/xpcshell/test_sqlite.js
@@ -28,17 +28,17 @@ function sleep(ms) {
}, ms, timer.TYPE_ONE_SHOT);
});
}
// When testing finalization, use this to tell Sqlite.jsm to not throw
// an uncatchable `Promise.reject`
function failTestsOnAutoClose(enabled) {
- Cu.getGlobalForObject(Sqlite).Debugging.failTestsOnAutoClose = enabled;
+ Sqlite.failTestsOnAutoClose(enabled);
}
function getConnection(dbName, extraOptions = {}) {
let path = dbName + ".sqlite";
let options = {path};
for (let [k, v] of Object.entries(extraOptions)) {
options[k] = v;
}