Bug 1371844 - Add explicit API to set Debugging.failTestsOnAutoClose in Sqlite.jsm. r=mak draft
authorAndrew McCreight <continuation@gmail.com>
Thu, 25 May 2017 15:40:55 -0700
changeset 600426 c551af54f835da84068f2b7a9d78029a1b16d6f3
parent 599782 c03f906e6579fce0b61524c4f5c8445dfa76ffe0
child 634991 e17c3bbe2b955fff2397f91a2a5ecb4c72edda84
push id65758
push userbmo:continuation@gmail.com
push dateMon, 26 Jun 2017 20:06:04 +0000
reviewersmak
bugs1371844
milestone56.0a1
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
toolkit/modules/Sqlite.jsm
toolkit/modules/tests/xpcshell/test_sqlite.js
--- 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;
   }