Bug 1471375 - Reports about missing activity stream content on new tab page and about:preferences#home panel. r=k88hudson
authorEd Lee <edilee@mozilla.com>
Fri, 29 Jun 2018 09:40:49 -0700
changeset 424459 44ee5fe5de79
parent 424458 b74ccfcd99d1
child 424460 722113b8204d
push id65741
push useredilee@gmail.com
push dateFri, 29 Jun 2018 17:49:38 +0000
treeherderautoland@44ee5fe5de79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersk88hudson
bugs1471375
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1471375 - Reports about missing activity stream content on new tab page and about:preferences#home panel. r=k88hudson MozReview-Commit-ID: F5B2woeju1c
browser/extensions/activity-stream/lib/Store.jsm
browser/extensions/activity-stream/test/unit/lib/Store.test.js
--- a/browser/extensions/activity-stream/lib/Store.jsm
+++ b/browser/extensions/activity-stream/lib/Store.jsm
@@ -147,17 +147,21 @@ this.Store = class Store {
   async _initIndexedDB(telemetryKey) {
     this.dbStorage = new ActivityStreamStorage({
       storeNames: ["sectionPrefs", "snippets"],
       telemetry: this.feeds.get(telemetryKey)
     });
     // Accessing the db causes the object stores to be created / migrated.
     // This needs to happen before other instances try to access the db, which
     // would update only a subset of the stores to the latest version.
-    await this.dbStorage.db; // eslint-disable-line no-unused-expressions
+    try {
+      await this.dbStorage.db; // eslint-disable-line no-unused-expressions
+    } catch (e) {
+      this.dbStorage.telemetry = null;
+    }
   }
 
   /**
    * uninit -  Uninitalizes each feed, clears them, and destroys the message
    *           manager channel.
    *
    * @return {type}  description
    */
--- a/browser/extensions/activity-stream/test/unit/lib/Store.test.js
+++ b/browser/extensions/activity-stream/test/unit/lib/Store.test.js
@@ -154,16 +154,26 @@ describe("Store", () => {
       assert.calledWithExactly(store._initIndexedDB, "feeds.telemetry");
     });
     it("should access the db property of indexedDB", async () => {
       store._initIndexedDB.restore();
       await store.init(new Map());
 
       assert.calledOnce(dbStub);
     });
+    it("should reset ActivityStreamStorage telemetry if opening the db fails", async () => {
+      store._initIndexedDB.restore();
+      // Force an IndexedDB error
+      dbStub.rejects();
+
+      await store.init(new Map());
+
+      assert.calledOnce(dbStub);
+      assert.isNull(store.dbStorage.telemetry);
+    });
     it("should not initialize the feed if the Pref is set to false", async () => {
       sinon.stub(store, "initFeed");
       store._prefs.set("foo", false);
       await store.init(new Map([["foo", () => {}]]));
       assert.notCalled(store.initFeed);
     });
     it("should observe the pref branch", async () => {
       sinon.stub(store._prefs, "observeBranch");