Bug 1605958 - Disable openViewOnFocus WebExt API. r=mikedeboer
authorHarry Twyford <htwyford@mozilla.com>
Mon, 30 Dec 2019 16:30:35 +0000
changeset 508499 09417381f879bb25928ca2e3bddfde157666a722
parent 508498 008852b3720d717dbb5c2c3268837e003baf72cf
child 508500 d9b16aa53c9caa4fbb3d6f9db0e375c34af212ea
push id104028
push userhtwyford@mozilla.com
push dateMon, 30 Dec 2019 18:28:10 +0000
treeherderautoland@09417381f879 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1605958
milestone73.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 1605958 - Disable openViewOnFocus WebExt API. r=mikedeboer This API is no longer needed, seeing as the Top Sites experiment is over. Dao suggested in bug 1605958 comment 1 that it be removed. Differential Revision: https://phabricator.services.mozilla.com/D58375
browser/components/extensions/parent/ext-urlbar.js
browser/components/extensions/schemas/urlbar.json
browser/components/extensions/test/xpcshell/test_ext_urlbar.js
--- a/browser/components/extensions/parent/ext-urlbar.js
+++ b/browser/components/extensions/parent/ext-urlbar.js
@@ -9,23 +9,16 @@ XPCOMUtils.defineLazyModuleGetters(this,
   UrlbarProviderExtension: "resource:///modules/UrlbarProviderExtension.jsm",
 });
 
 var { ExtensionPreferencesManager } = ChromeUtils.import(
   "resource://gre/modules/ExtensionPreferencesManager.jsm"
 );
 var { getSettingsAPI } = ExtensionPreferencesManager;
 
-ExtensionPreferencesManager.addSetting("openViewOnFocus", {
-  prefNames: ["browser.urlbar.openViewOnFocus"],
-  setCallback(value) {
-    return { [this.prefNames[0]]: value };
-  },
-});
-
 ExtensionPreferencesManager.addSetting("engagementTelemetry", {
   prefNames: ["browser.urlbar.eventTelemetry.enabled"],
   setCallback(value) {
     return { [this.prefNames[0]]: value };
   },
 });
 
 this.urlbar = class extends ExtensionAPI {
@@ -138,22 +131,16 @@ this.urlbar = class extends ExtensionAPI
               return fire.async(resultPayload).catch(error => {
                 throw context.normalizeError(error);
               });
             });
             return () => provider.setEventListener("resultPicked", null);
           },
         }).api(),
 
-        openViewOnFocus: getSettingsAPI({
-          context,
-          name: "openViewOnFocus",
-          callback: () => UrlbarPrefs.get("openViewOnFocus"),
-        }),
-
         engagementTelemetry: getSettingsAPI({
           context,
           name: "engagementTelemetry",
           callback: () => UrlbarPrefs.get("eventTelemetry.enabled"),
         }),
       },
     };
   }
--- a/browser/components/extensions/schemas/urlbar.json
+++ b/browser/components/extensions/schemas/urlbar.json
@@ -105,20 +105,16 @@
       {
         "id": "SourceType",
         "type": "string",
         "enum": ["bookmarks", "history", "local", "network", "search", "tabs"],
         "description": "Possible sources of results. <code>bookmarks</code>: The result comes from the user's bookmarks. <code>history</code>: The result comes from the user's history. <code>local</code>: The result comes from some local source not covered by another source type. <code>network</code>: The result comes from some network source not covered by another source type. <code>search</code>: The result comes from a search engine. <code>tabs</code>: The result is an open tab in the browser or a synced tab from another device."
       }
     ],
     "properties": {
-      "openViewOnFocus": {
-        "$ref": "types.Setting",
-        "description": "Enables or disables the open-view-on-focus mode."
-      },
       "engagementTelemetry": {
         "$ref": "types.Setting",
         "description": "Enables or disables the engagement telemetry."
       }
     },
     "functions": [
       {
         "name": "closeView",
--- a/browser/components/extensions/test/xpcshell/test_ext_urlbar.js
+++ b/browser/components/extensions/test/xpcshell/test_ext_urlbar.js
@@ -1409,58 +1409,16 @@ add_task(async function test_nonPrivateB
   Assert.equal(context.results.length, 2);
   Assert.ok(context.results[0].heuristic);
   Assert.equal(context.results[1].title, "Test result");
   Assert.equal(context.results[1].suggestedIndex, 1);
 
   await ext.unload();
 });
 
-// Tests that extensions can toggle openViewOnFocus.
-add_task(async function test_setOpenViewOnFocus() {
-  let getPrefValue = () => UrlbarPrefs.get("openViewOnFocus");
-
-  Assert.equal(
-    getPrefValue(),
-    true,
-    "Open-view-on-focus mode should be enabled by default"
-  );
-
-  let ext = ExtensionTestUtils.loadExtension({
-    manifest: {
-      permissions: ["urlbar"],
-    },
-    isPrivileged: true,
-    incognitoOverride: "spanning",
-    useAddonManager: "temporary",
-    async background() {
-      await browser.urlbar.openViewOnFocus.set({ value: false });
-      browser.test.sendMessage("ready");
-    },
-  });
-  await ext.startup();
-  await ext.awaitMessage("ready");
-
-  Assert.equal(
-    getPrefValue(),
-    false,
-    "Successfully disabled the open-view-on-focus mode"
-  );
-
-  let completed = promiseUninstallCompleted(ext.id);
-  await ext.unload();
-  await completed;
-
-  Assert.equal(
-    getPrefValue(),
-    true,
-    "Open-view-on-focus mode should be reset after unloading the add-on"
-  );
-});
-
 // Tests the engagementTelemetry property.
 add_task(async function test_engagementTelemetry() {
   let getPrefValue = () => UrlbarPrefs.get("eventTelemetry.enabled");
 
   Assert.equal(
     getPrefValue(),
     false,
     "Engagement telemetry should be disabled by default"
@@ -1470,19 +1428,21 @@ add_task(async function test_engagementT
     manifest: {
       permissions: ["urlbar"],
     },
     isPrivileged: true,
     incognitoOverride: "spanning",
     useAddonManager: "temporary",
     background() {
       browser.urlbar.engagementTelemetry.set({ value: true });
+      browser.test.sendMessage("ready");
     },
   });
   await ext.startup();
+  await ext.awaitMessage("ready");
 
   Assert.equal(
     getPrefValue(),
     true,
     "Successfully enabled the engagement telemetry"
   );
 
   let completed = promiseUninstallCompleted(ext.id);