Bug 1616862 - Hide the address bar dropmarker based on the browser.urlbar.update1 pref rather than browser.urlbar.openViewOnFocus. r=mak
authorDão Gottwald <dao@mozilla.com>
Thu, 20 Feb 2020 16:33:06 +0000
changeset 514803 ba62a714c29fc5e5bccf32f2f548b9dad9498ab0
parent 514802 399889d8fb476119e06448d7751af816a66f431b
child 514804 e177c04d03e02fc78d3197c0a1eac380549a1bf6
push id107834
push userdgottwald@mozilla.com
push dateThu, 20 Feb 2020 16:35:43 +0000
treeherderautoland@ba62a714c29f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1616862
milestone75.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 1616862 - Hide the address bar dropmarker based on the browser.urlbar.update1 pref rather than browser.urlbar.openViewOnFocus. r=mak 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",