Bug 1616862 - Hide the address bar dropmarker based on the browser.urlbar.update1 pref rather than browser.urlbar.openViewOnFocus. r=mak a=pascalc
☠☠ backed out by 87c0b54d1e78 ☠ ☠
authorDão Gottwald <dao@mozilla.com>
Thu, 20 Feb 2020 16:33:06 +0000
changeset 575821 9760535819af8b55083200a0b8c387dfaf46fa5a
parent 575820 d7479b264c4251f7501f174b965bf73c8d07a17a
child 575822 87c0b54d1e78f81d56d33d9e053fad350c3364a5
push id12753
push userarchaeopteryx@coole-files.de
push dateFri, 21 Feb 2020 19:06:05 +0000
treeherdermozilla-beta@9760535819af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak, pascalc
bugs1616862
milestone74.0
Bug 1616862 - Hide the address bar dropmarker based on the browser.urlbar.update1 pref rather than browser.urlbar.openViewOnFocus. r=mak a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D63490
browser/components/urlbar/UrlbarInput.jsm
browser/components/urlbar/tests/browser/browser_dropmarker.js
browser/components/urlbar/tests/browser/browser_urlbar_event_telemetry.js
--- a/browser/components/urlbar/UrlbarInput.jsm
+++ b/browser/components/urlbar/UrlbarInput.jsm
@@ -155,16 +155,17 @@ class UrlbarInput {
         set(val) {
           return (this.inputField[property] = val);
         },
       });
     }
 
     this.inputField = this.querySelector("#urlbar-input");
     this.dropmarker = this.querySelector(".urlbar-history-dropmarker");
+    this.dropmarker.hidden = this.megabar;
     this._inputContainer = this.querySelector("#urlbar-input-container");
     this._identityBox = this.querySelector("#identity-box");
     this._toolbar = this.textbox.closest("toolbar");
 
     XPCOMUtils.defineLazyGetter(this, "valueFormatter", () => {
       return new UrlbarValueFormatter(this);
     });
 
@@ -1081,17 +1082,16 @@ class UrlbarInput {
 
   _setOpenViewOnFocus() {
     // FIXME: Not using UrlbarPrefs because its pref observer may run after
     // this call, so we'd get the previous openViewOnFocus value here. This
     // can be cleaned up after bug 1560013.
     this.openViewOnFocus = Services.prefs.getBoolPref(
       "browser.urlbar.openViewOnFocus"
     );
-    this.dropmarker.hidden = this.openViewOnFocus;
   }
 
   _setValue(val, allowTrim) {
     this._untrimmedValue = val;
 
     let originalUrl = ReaderMode.getOriginalUrlObjectForDisplay(val);
     if (originalUrl) {
       val = originalUrl.displaySpec;
--- a/browser/components/urlbar/tests/browser/browser_dropmarker.js
+++ b/browser/components/urlbar/tests/browser/browser_dropmarker.js
@@ -1,16 +1,21 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 "use strict";
 
-SpecialPowers.pushPrefEnv({
-  set: [["browser.urlbar.openViewOnFocus", false]],
+add_task(async function setup() {
+  if (gURLBar.dropmarker.hidden) {
+    gURLBar.dropmarker.hidden = false;
+    registerCleanupFunction(() => {
+      gURLBar.dropmarker.hidden = true;
+    });
+  }
 });
 
 add_task(async function basic() {
   await BrowserTestUtils.withNewTab("http://example.com/", async () => {
     let queryContext = await clickDropmarker();
     is(
       queryContext.searchString,
       "",
--- a/browser/components/urlbar/tests/browser/browser_urlbar_event_telemetry.js
+++ b/browser/components/urlbar/tests/browser/browser_urlbar_event_telemetry.js
@@ -455,26 +455,27 @@ const tests = [
         selType: "history",
         selIndex: "0",
       },
     };
   },
 
   async function(win) {
     info("Open the panel with dropmarker, type something, Enter.");
-    Services.prefs.setBoolPref("browser.urlbar.openViewOnFocus", false);
+    let dropmarkerWasHidden = win.gURLBar.dropmarker.hidden;
+    win.gURLBar.dropmarker.hidden = false;
     win.gURLBar.select();
     let promise = BrowserTestUtils.browserLoaded(win.gBrowser.selectedBrowser);
     await UrlbarTestUtils.promisePopupOpen(win, () => {
       EventUtils.synthesizeMouseAtCenter(win.gURLBar.dropmarker, {}, win);
     });
     await promiseAutocompleteResultPopup("x", win, true);
     EventUtils.synthesizeKey("VK_RETURN", {}, win);
     await promise;
-    Services.prefs.clearUserPref("browser.urlbar.openViewOnFocus");
+    win.gURLBar.dropmarker.hidden = dropmarkerWasHidden;
     return {
       category: "urlbar",
       method: "engagement",
       object: "enter",
       value: "topsites",
       extra: {
         elapsed: val => parseInt(val) > 0,
         numChars: "1",
@@ -836,29 +837,30 @@ const tests = [
         elapsed: val => parseInt(val) > 0,
         numChars: "0",
       },
     };
   },
 
   async function(win) {
     info("Open the panel with dropmarker, type something, blur it.");
-    Services.prefs.setBoolPref("browser.urlbar.openViewOnFocus", false);
+    let dropmarkerWasHidden = win.gURLBar.dropmarker.hidden;
+    win.gURLBar.dropmarker.hidden = false;
     await BrowserTestUtils.withNewTab(
       { gBrowser: win.gBrowser, url: "about:blank" },
       async browser => {
         win.gURLBar.select();
         await UrlbarTestUtils.promisePopupOpen(win, () => {
           EventUtils.synthesizeMouseAtCenter(gURLBar.dropmarker, {}, win);
         });
         EventUtils.synthesizeKey("x", {}, win);
         win.gURLBar.blur();
       }
     );
-    Services.prefs.clearUserPref("browser.urlbar.openViewOnFocus");
+    win.gURLBar.dropmarker.hidden = dropmarkerWasHidden;
     return {
       category: "urlbar",
       method: "abandonment",
       object: "blur",
       value: "topsites",
       extra: {
         elapsed: val => parseInt(val) > 0,
         numChars: "1",