Bug 1300755 - Rename pageproxystate to editing and separate from blank page state. r?paolo draft
authorJohann Hofmann <jhofmann@mozilla.com>
Wed, 21 Sep 2016 11:53:39 +0200
changeset 421309 7b2a0dc10df78f6529a45632c99fd05a77cc1ebb
parent 421308 bf599f68e9404b55b1816d43360e55dedfb75789
child 533028 0f61e2c84a542185a2ba536f94a1afdf108ec1f0
push id31446
push userbmo:jhofmann@mozilla.com
push dateWed, 05 Oct 2016 19:08:01 +0000
reviewerspaolo
bugs1300755
milestone52.0a1
Bug 1300755 - Rename pageproxystate to editing and separate from blank page state. r?paolo MozReview-Commit-ID: 6eqx5vTJam5
browser/base/content/browser.css
browser/base/content/browser.js
browser/base/content/browser.xul
browser/base/content/test/general/browser_drag.js
browser/base/content/test/urlbar/browser_locationBarCommand.js
browser/base/content/test/urlbar/browser_urlbarCopying.js
browser/base/content/test/urlbar/browser_urlbarHashChangeProxyState.js
browser/base/content/test/urlbar/browser_urlbarTrimURLs.js
browser/base/content/test/urlbar/browser_urlbar_stop_pending.js
browser/base/content/urlbarBindings.xml
browser/components/extensions/test/browser/head.js
browser/components/sessionstore/test/browser_parentProcessRestoreHash.js
browser/themes/shared/identity-block/icons.inc.css
browser/themes/shared/identity-block/identity-block.inc.css
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -510,20 +510,22 @@ toolbar:not(#TabsToolbar) > #personal-bo
 #PopupAutoCompleteRichResult > richlistbox {
   transition: height 100ms;
 }
 
 #PopupAutoCompleteRichResult.showSearchSuggestionsNotification > richlistbox {
   transition: none;
 }
 
-#urlbar[pageproxystate="invalid"] > #urlbar-icons > .urlbar-icon,
-#urlbar[pageproxystate="invalid"][focused="true"] > #urlbar-go-button ~ toolbarbutton,
-#urlbar[pageproxystate="valid"] > #urlbar-go-button,
-#urlbar:not([focused="true"]) > #urlbar-go-button {
+#urlbar[editing] > #urlbar-icons > .urlbar-icon,
+/* Show the "Go" button instead of the reload button
+ * when editing the url or on a blank page */
+#urlbar[editing] > #urlbar-go-button ~ toolbarbutton,
+#urlbar.blankPage > #urlbar-go-button ~ toolbarbutton,
+#urlbar:not([editing]):not(.blankPage) > #urlbar-go-button {
   visibility: collapse;
 }
 
 #identity-icon-labels {
   max-width: 18em;
 }
 @media (max-width: 700px) {
   #urlbar-container {
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2417,20 +2417,30 @@ function URLBarSetURI(aURI) {
     } else {
       // We should deal with losslessDecodeURI throwing for exotic URIs
       try {
         value = losslessDecodeURI(uri);
       } catch (ex) {
         value = "about:blank";
       }
     }
-  }
+
+    gURLBar.originalUrl = value;
+  }
+
+  // On blank pages, the URL bar has less interactive elements.
+  gURLBar.classList.toggle("blankPage", isBlankPageURL(gBrowser.currentURI.spec));
 
   gURLBar.value = value;
-  SetPageProxyState(gURLBar.valueIsTyped ? "invalid" : "valid");
+
+  if (gURLBar.valueIsTyped) {
+    SetUrlBarEditing();
+  } else {
+    UnsetUrlBarEditing();
+  }
 }
 
 function losslessDecodeURI(aURI) {
   let scheme = aURI.scheme;
   if (scheme == "moz-action")
     throw new Error("losslessDecodeURI should never get a moz-action URI");
 
   var value = aURI.spec;
@@ -2513,47 +2523,37 @@ function UpdateUrlbarSearchSplitterState
       splitter.setAttribute("overflows", "false");
       splitter.className = "chromeclass-toolbar-additional";
     }
     urlbar.parentNode.insertBefore(splitter, ibefore);
   } else if (splitter)
     splitter.parentNode.removeChild(splitter);
 }
 
-function InvalidatePageProxyState() {
-  if (gURLBar && gURLBar.value != gLastValidURLStr)
-    SetPageProxyState("invalid");
-}
-
-function ValidatePageProxyState() {
-  SetPageProxyState("valid");
-}
-
-function SetPageProxyState(aState)
-{
+function SetUrlBarEditing() {
   if (!gURLBar)
     return;
 
-  // about:blank is always invalid
-  if (isBlankPageURL(gBrowser.currentURI.spec)) {
-    aState = "invalid";
-  }
-
-  gURLBar.setAttribute("pageproxystate", aState);
-
-  // the page proxy state is set to valid via OnLocationChange, which
-  // gets called when we switch tabs.
-  if (aState == "valid") {
-    gLastValidURLStr = gURLBar.value;
-    gURLBar.addEventListener("input", InvalidatePageProxyState, false);
-    gURLBar.removeEventListener("blur", ValidatePageProxyState, false);
-  } else if (aState == "invalid") {
-    gURLBar.removeEventListener("input", InvalidatePageProxyState, false);
-    gURLBar.addEventListener("blur", ValidatePageProxyState, false);
-  }
+  if (gURLBar.value != gLastValidURLStr) {
+    gURLBar.setAttribute("editing", "true");
+
+    gURLBar.removeEventListener("input", SetUrlBarEditing, false);
+    gURLBar.addEventListener("blur", UnsetUrlBarEditing, false);
+  }
+}
+
+function UnsetUrlBarEditing() {
+  if (!gURLBar)
+    return;
+
+  gURLBar.removeAttribute("editing");
+
+  gLastValidURLStr = gURLBar.value;
+  gURLBar.addEventListener("input", SetUrlBarEditing, false);
+  gURLBar.removeEventListener("blur", UnsetUrlBarEditing, false);
 }
 
 function PageProxyClickHandler(aEvent)
 {
   if (aEvent.button == 1 && gPrefService.getBoolPref("middlemouse.paste"))
     middleMousePaste(aEvent);
 }
 
@@ -7331,17 +7331,17 @@ var gIdentityHandler = {
 
     if ((event.type == "click" && event.button != 0) ||
         (event.type == "keypress" && event.charCode != KeyEvent.DOM_VK_SPACE &&
          event.keyCode != KeyEvent.DOM_VK_RETURN)) {
       return; // Left click, space or enter only
     }
 
     // Don't allow left click, space or enter if the location has been modified.
-    if (gURLBar.getAttribute("pageproxystate") != "valid") {
+    if (gURLBar.hasAttribute("editing")) {
       return;
     }
 
     // Make sure that the display:none style we set in xul is removed now that
     // the popup is actually needed
     this._identityPopup.hidden = false;
 
     // Update the popup strings
@@ -7383,17 +7383,17 @@ var gIdentityHandler = {
 
   observe(subject, topic, data) {
     if (topic == "perm-changed") {
       this.refreshIdentityBlock();
     }
   },
 
   onDragStart: function (event) {
-    if (gURLBar.getAttribute("pageproxystate") != "valid")
+    if (gURLBar.hasAttribute("editing"))
       return;
 
     let value = gBrowser.currentURI.spec;
     let urlString = value + "\n" + gBrowser.contentTitle;
     let htmlString = "<a href=\"" + value + "\">" + value + "</a>";
 
     let dt = event.dataTransfer;
     dt.setData("text/x-moz-url", urlString);
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -669,17 +669,17 @@
                      tabscrolling="true"
                      showcommentcolumn="true"
                      showimagecolumn="true"
                      enablehistory="true"
                      maxrows="10"
                      newlines="stripsurroundingwhitespace"
                      ontextentered="this.handleCommand(param);"
                      ontextreverted="return this.handleRevert();"
-                     pageproxystate="invalid"
+                     editing="true"
                      onfocus="document.getElementById('identity-box').style.MozUserFocus= 'normal'"
                      onblur="setTimeout(() => { document.getElementById('identity-box').style.MozUserFocus = ''; }, 0);">
               <!-- Use onclick instead of normal popup= syntax since the popup
                    code fires onmousedown, and hence eats our favicon drag events.
                    We only add the identity-box button to the tab order when the location bar
                    has focus, otherwise pressing F6 focuses it instead of the location bar -->
               <box id="identity-box" role="button"
                    align="center"
--- a/browser/base/content/test/general/browser_drag.js
+++ b/browser/base/content/test/general/browser_drag.js
@@ -16,22 +16,19 @@ function test()
       data  : urlString },
     { type  : "text/uri-list",
       data  : value },
     { type  : "text/plain",
       data  : value },
     { type  : "text/html",
       data  : htmlString }
   ] ];
-  // set the valid attribute so dropping is allowed
-  var oldstate = gURLBar.getAttribute("pageproxystate");
-  gURLBar.setAttribute("pageproxystate", "valid");
+  gURLBar.removeAttribute("editing");
   var dt = EventUtils.synthesizeDragStart(document.getElementById("identity-box"), expected);
   is(dt, null, "drag on proxy icon");
-  gURLBar.setAttribute("pageproxystate", oldstate);
   // Now, the identity information panel is opened by the proxy icon click.
   // We need to close it for next tests.
   EventUtils.synthesizeKey("VK_ESCAPE", {}, window);
 
   // now test dragging onto a tab
   var tab = gBrowser.addTab("about:blank", {skipAnimation: true});
   var browser = gBrowser.getBrowserForTab(tab);
 
--- a/browser/base/content/test/urlbar/browser_locationBarCommand.js
+++ b/browser/base/content/test/urlbar/browser_locationBarCommand.js
@@ -153,24 +153,22 @@ add_task(function* load_in_new_tab_test(
 
     // Cleanup.
     gBrowser.removeCurrentTab();
     gBrowser.removeCurrentTab();
   }
 });
 
 function triggerCommand(shouldClick, event) {
+  gURLBar.focus();
   gURLBar.value = TEST_VALUE;
-  gURLBar.focus();
 
   if (shouldClick) {
-    is(gURLBar.getAttribute("pageproxystate"), "invalid",
-       "page proxy state must be invalid for go button to be visible");
-
     let goButton = document.getElementById("urlbar-go-button");
+    is(window.getComputedStyle(goButton).visibility, "visible", "go button is visible");
     EventUtils.synthesizeMouseAtCenter(goButton, event);
   } else {
     EventUtils.synthesizeKey("VK_RETURN", event);
   }
 }
 
 function promiseLoadStarted() {
   return new Promise(resolve => {
--- a/browser/base/content/test/urlbar/browser_urlbarCopying.js
+++ b/browser/base/content/test/urlbar/browser_urlbarCopying.js
@@ -19,28 +19,28 @@ function test() {
   Services.prefs.setIntPref(phishyUserPassPref, 32); // avoid prompting about phishing
 
   waitForExplicitFinish();
 
   nextTest();
 }
 
 var tests = [
-  // pageproxystate="invalid"
+  // urlbar in editing state
   {
     setURL: "http://example.com/",
     expectedURL: "example.com",
     copyExpected: "example.com"
   },
   {
     copyVal: "<e>xample.com",
     copyExpected: "e"
   },
 
-  // pageproxystate="valid" from this point on (due to the load)
+  // urlbar not in editing state
   {
     loadURL: "http://example.com/",
     expectedURL: "example.com",
     copyExpected: "http://example.com/"
   },
   {
     copyVal: "<example.co>m",
     copyExpected: "example.co"
--- a/browser/base/content/test/urlbar/browser_urlbarHashChangeProxyState.js
+++ b/browser/base/content/test/urlbar/browser_urlbarHashChangeProxyState.js
@@ -10,17 +10,17 @@ add_task(function* () {
   yield BrowserTestUtils.withNewTab({ gBrowser, url }, function*(browser) {
     let identityBox = document.getElementById("identity-box");
     let expectedURL = url;
 
     let verifyURLBarState = testType => {
       is(gURLBar.textValue, expectedURL, "URL bar visible value should be correct " + testType);
       is(gURLBar.value, expectedURL, "URL bar value should be correct " + testType);
       ok(identityBox.classList.contains("verifiedDomain"), "Identity box should know we're doing SSL " + testType);
-      is(gURLBar.getAttribute("pageproxystate"), "valid", "URL bar is in valid page proxy state");
+      ok(!gURLBar.hasAttribute("editing"), "valid", "URL bar is not in editing state");
     };
 
     verifyURLBarState("at the beginning");
 
     let locationChangePromise;
     let resolveLocationChangePromise;
     let expectURL = url => {
       expectedURL = url;
@@ -99,13 +99,13 @@ add_task(function* () {
   EventUtils.sendKey("return");
   yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
   is(gURLBar.textValue, url, "URL bar visible value should be correct when the page loads from about:newtab");
   is(gURLBar.value, url, "URL bar value should be correct when the page loads from about:newtab");
   let identityBox = document.getElementById("identity-box");
   ok(identityBox.classList.contains("verifiedDomain"),
      "Identity box should know we're doing SSL when the page loads from about:newtab");
-  is(gURLBar.getAttribute("pageproxystate"), "valid",
-     "URL bar is in valid page proxy state when SSL page with hash loads from about:newtab");
+  ok(!gURLBar.getAttribute("editing"),
+     "URL bar is not in editing state when SSL page with hash loads from about:newtab");
   yield BrowserTestUtils.removeTab(tab);
 });
 
--- a/browser/base/content/test/urlbar/browser_urlbarTrimURLs.js
+++ b/browser/base/content/test/urlbar/browser_urlbarTrimURLs.js
@@ -80,17 +80,17 @@ function test() {
   waitForExplicitFinish();
 
   gBrowser.selectedBrowser.addEventListener("load", function () {
     gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
 
     is(gBrowser.currentURI.spec, "http://example.com/", "expected page should have loaded");
 
     testCopy("example.com", "http://example.com/", function () {
-      SetPageProxyState("invalid");
+      SetUrlBarEditing();
       gURLBar.valueIsTyped = true;
       testCopy("example.com", "example.com", finish);
     });
   }, true);
 
   gBrowser.loadURI("http://example.com/");
 }
 
--- a/browser/base/content/test/urlbar/browser_urlbar_stop_pending.js
+++ b/browser/base/content/test/urlbar/browser_urlbar_stop_pending.js
@@ -17,17 +17,17 @@ add_task(function*() {
   let sawChange = false;
   let handler = e => {
     sawChange = true;
     is(gURLBar.value, expectedURLBarChange, "Should not change URL bar value!");
   };
 
   let obs = new MutationObserver(handler);
 
-  obs.observe(gURLBar, {attributes: true});
+  obs.observe(gURLBar, { attributes: true, subtree: true });
   gURLBar.value = SLOW_PAGE;
   gURLBar.handleCommand();
 
   // If this ever starts going intermittent, we've broken this.
   yield new Promise(resolve => setTimeout(resolve, 200));
   expectedURLBarChange = SLOW_PAGE2;
   let pageLoadPromise = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
   gURLBar.value = expectedURLBarChange;
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -272,17 +272,17 @@ file, You can obtain one at http://mozil
             trimmedLength = "http://".length;
           }
 
           let matchedURL = value.match(/^((?:[a-z]+:\/\/)(?:[^\/#?]+@)?)(\S+?)(?::\d+)?\s*(?:[\/#?]|$)/);
           if (!matchedURL)
             return;
 
           // Strike out the "https" part if mixed active content is loaded.
-          if (this.getAttribute("pageproxystate") == "valid" &&
+          if (!this.hasAttribute("editing") &&
               value.startsWith("https:") &&
               gBrowser.securityUI.state &
                 Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT) {
             let range = document.createRange();
             range.setStart(textNode, 0);
             range.setEnd(textNode, 5);
             strikeOut.addRange(range);
           }
@@ -670,17 +670,17 @@ file, You can obtain one at http://mozil
           let links = browserDragAndDrop.dropLinks(aEvent);
 
           // The URL bar automatically handles inputs with newline characters,
           // so we can get away with treating text/x-moz-url flavours as text/plain.
           if (links.length > 0 && links[0].url) {
             let url = links[0].url;
             aEvent.preventDefault();
             this.value = url;
-            SetPageProxyState("invalid");
+            SetUrlBarEditing();
             this.focus();
             try {
               urlSecurityCheck(url,
                                gBrowser.contentPrincipal,
                                Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
             } catch (ex) {
               return;
             }
@@ -705,25 +705,25 @@ file, You can obtain one at http://mozil
             let remainder = inputVal.replace(selectedVal, "");
             if (remainder != "" && remainder[0] != "/")
               return selectedVal;
           }
 
           let uriFixup = Cc["@mozilla.org/docshell/urifixup;1"].getService(Ci.nsIURIFixup);
 
           let uri;
-          if (this.getAttribute("pageproxystate") == "valid") {
-            uri = gBrowser.currentURI;
-          } else {
+          if (this.originalUrl !== this._value) {
             // We're dealing with an autocompleted value, create a new URI from that.
             try {
               uri = uriFixup.createFixupURI(inputVal, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
             } catch (e) {}
             if (!uri)
               return selectedVal;
+          } else {
+            uri = gBrowser.currentURI;
           }
 
           // Avoid copying 'about:reader?url=', and always provide the original URI:
           let readerOriginalURL = ReaderMode.getOriginalUrl(uri.spec);
           if (readerOriginalURL) {
             uri = uriFixup.createFixupURI(readerOriginalURL, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
           }
 
@@ -774,17 +774,17 @@ file, You can obtain one at http://mozil
               urlbar.inputField.value = urlbar.inputField.value.substring(0, start) +
                                         urlbar.inputField.value.substring(end);
               urlbar.selectionStart = urlbar.selectionEnd = start;
 
               let event = document.createEvent("UIEvents");
               event.initUIEvent("input", true, false, window, 0);
               urlbar.dispatchEvent(event);
 
-              SetPageProxyState("invalid");
+              SetUrlBarEditing();
             }
 
             Cc["@mozilla.org/widget/clipboardhelper;1"]
               .getService(Ci.nsIClipboardHelper)
               .copyString(val);
           },
           supportsCommand: function(aCommand) {
             switch (aCommand) {
@@ -1144,18 +1144,17 @@ file, You can obtain one at http://mozil
         if (this.inputField != event.originalTarget &&
             !(this.inputField.compareDocumentPosition(event.originalTarget) &
               Node.DOCUMENT_POSITION_CONTAINED_BY))
           return;
 
         // Drag only if the entire value is selected and it's a valid URI.
         var isFullSelection = this.selectionStart == 0 &&
                               this.selectionEnd == this.textLength;
-        if (!isFullSelection ||
-            this.getAttribute("pageproxystate") != "valid")
+        if (!isFullSelection || this.hasAttribute("editing"))
           return;
 
         var urlString = gBrowser.selectedBrowser.currentURI.spec;
         var title = gBrowser.selectedBrowser.contentTitle || urlString;
         var htmlString = "<a href=\"" + urlString + "\">" + urlString + "</a>";
 
         var dt = event.dataTransfer;
         dt.setData("text/x-moz-url", urlString + "\n" + title);
--- a/browser/components/extensions/test/browser/head.js
+++ b/browser/components/extensions/test/browser/head.js
@@ -196,18 +196,18 @@ function getPageActionPopup(extension, w
 
 function clickPageAction(extension, win = window) {
   // This would normally be set automatically on navigation, and cleared
   // when the user types a value into the URL bar, to show and hide page
   // identity info and icons such as page action buttons.
   //
   // Unfortunately, that doesn't happen automatically in browser chrome
   // tests.
-  /* globals SetPageProxyState */
-  SetPageProxyState("valid");
+  /* globals SetUrlBarEditing */
+  SetUrlBarEditing();
 
   let pageActionId = makeWidgetId(extension.id) + "-page-action";
   let elem = win.document.getElementById(pageActionId);
 
   EventUtils.synthesizeMouseAtCenter(elem, {}, win);
   return new Promise(SimpleTest.executeSoon);
 }
 
--- a/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js
+++ b/browser/components/sessionstore/test/browser_parentProcessRestoreHash.js
@@ -80,16 +80,16 @@ add_task(function* () {
   EventUtils.sendKey("return");
 
   yield locationChangePromise;
 
   ok(!tab.linkedBrowser.isRemoteBrowser, "Browser should no longer be remote");
 
   is(gURLBar.textValue, TESTURL, "URL bar visible value should be correct.");
   is(gURLBar.value, TESTURL, "URL bar value should be correct.");
-  is(gURLBar.getAttribute("pageproxystate"), "valid", "URL bar is in valid page proxy state");
+  ok(!gURLBar.hasAttribute("editing"), "URL bar is not in editing state");
 
   ok(!tab.linkedBrowser.userTypedValue, "No userTypedValue should be on the browser.");
 
   yield BrowserTestUtils.removeTab(tab);
   gBrowser.removeProgressListener(wpl);
   TestAboutPage.unregister();
 });
--- a/browser/themes/shared/identity-block/icons.inc.css
+++ b/browser/themes/shared/identity-block/icons.inc.css
@@ -17,46 +17,46 @@
   list-style-image: url(chrome://browser/skin/identity-icon.svg#notice@iconVariant@);
 }
 
 @selectorPrefix@#identity-box.grantedPermissions:hover > #identity-icon:not(.no-hover)@selectorSuffix@,
 @selectorPrefix@#identity-box.grantedPermissions[open=true] > #identity-icon@selectorSuffix@ {
   list-style-image: url(chrome://browser/skin/identity-icon.svg#notice-hover@iconVariant@);
 }
 
-@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.chromeUI > #identity-icon@selectorSuffix@ {
+@selectorPrefix@#urlbar:not([editing]) > #identity-box.chromeUI > #identity-icon@selectorSuffix@ {
   list-style-image: url(chrome://branding/content/identity-icons-brand.svg);
 }
 
 
 @selectorPrefix@#tracking-protection-icon@selectorSuffix@ {
   list-style-image: url(chrome://browser/skin/tracking-protection-16.svg#enabled@iconVariant@);
 }
 
 @selectorPrefix@#tracking-protection-icon[state="loaded-tracking-content"]@selectorSuffix@ {
   list-style-image: url(chrome://browser/skin/tracking-protection-16.svg#disabled@iconVariant@);
 }
 
 
-@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.verifiedDomain > #connection-icon@selectorSuffix@,
-@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity > #connection-icon@selectorSuffix@,
-@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.mixedActiveBlocked > #connection-icon@selectorSuffix@ {
+@selectorPrefix@#urlbar:not([editing]) > #identity-box.verifiedDomain > #connection-icon@selectorSuffix@,
+@selectorPrefix@#urlbar:not([editing]) > #identity-box.verifiedIdentity > #connection-icon@selectorSuffix@,
+@selectorPrefix@#urlbar:not([editing]) > #identity-box.mixedActiveBlocked > #connection-icon@selectorSuffix@ {
   list-style-image: url(chrome://browser/skin/connection-secure.svg);
   visibility: visible;
 }
 
-@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.certUserOverridden > #connection-icon@selectorSuffix@ {
+@selectorPrefix@#urlbar:not([editing]) > #identity-box.certUserOverridden > #connection-icon@selectorSuffix@ {
   list-style-image: url(chrome://browser/skin/connection-mixed-passive-loaded.svg#icon@iconVariant@);
   visibility: visible;
 }
 
-@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.insecureLoginForms > #connection-icon@selectorSuffix@,
-@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.mixedActiveContent > #connection-icon@selectorSuffix@ {
+@selectorPrefix@#urlbar:not([editing]) > #identity-box.insecureLoginForms > #connection-icon@selectorSuffix@,
+@selectorPrefix@#urlbar:not([editing]) > #identity-box.mixedActiveContent > #connection-icon@selectorSuffix@ {
   list-style-image: url(chrome://browser/skin/connection-mixed-active-loaded.svg#icon@iconVariant@);
   visibility: visible;
 }
 
-@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.weakCipher > #connection-icon@selectorSuffix@,
-@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.mixedDisplayContent > #connection-icon@selectorSuffix@,
-@selectorPrefix@#urlbar[pageproxystate="valid"] > #identity-box.mixedDisplayContentLoadedActiveBlocked > #connection-icon@selectorSuffix@ {
+@selectorPrefix@#urlbar:not([editing]) > #identity-box.weakCipher > #connection-icon@selectorSuffix@,
+@selectorPrefix@#urlbar:not([editing]) > #identity-box.mixedDisplayContent > #connection-icon@selectorSuffix@,
+@selectorPrefix@#urlbar:not([editing]) > #identity-box.mixedDisplayContentLoadedActiveBlocked > #connection-icon@selectorSuffix@ {
   list-style-image: url(chrome://browser/skin/connection-mixed-passive-loaded.svg#icon@iconVariant@);
   visibility: visible;
 }
--- a/browser/themes/shared/identity-block/identity-block.inc.css
+++ b/browser/themes/shared/identity-block/identity-block.inc.css
@@ -20,21 +20,21 @@
   font-size: .9em;
   padding: 3px 5px;
   overflow: hidden;
   /* The padding-left and padding-right transitions handle the delayed hiding of
      the forward button when hovered. */
   transition: padding-left, padding-right;
 }
 
-#urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity > #identity-icon-labels {
+#urlbar:not([editing]) > #identity-box.verifiedIdentity > #identity-icon-labels {
   color: hsl(92,100%,30%);
 }
 
-#urlbar[pageproxystate="valid"] > #identity-box.chromeUI > #identity-icon-labels {
+#urlbar:not([editing]) > #identity-box.chromeUI > #identity-icon-labels {
 %ifdef MOZ_OFFICIAL_BRANDING
   color: rgb(229,115,0);
 %else
   color: inherit;
 %endif
 }
 
 #identity-icon-labels:-moz-locale-dir(ltr) {
@@ -63,21 +63,22 @@
 
 /* MAIN IDENTITY ICON */
 
 #identity-icon {
   width: 16px;
   height: 16px;
 }
 
-#urlbar[pageproxystate="invalid"] > #identity-box > #identity-icon {
+#urlbar.blankPage > #identity-box > #identity-icon,
+#urlbar[editing] > #identity-box > #identity-icon {
   opacity: .3;
 }
 
-#urlbar[pageproxystate="invalid"][actiontype="searchengine"] > #identity-box > #identity-icon {
+#urlbar[editing][actiontype="searchengine"] > #identity-box > #identity-icon {
   -moz-image-region: inherit;
   list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg#search-icon);
 }
 
 /* SHARING ICON */
 
 #sharing-icon {
   width: 16px;
@@ -94,22 +95,22 @@
 #identity-box[sharing="microphone"] > #sharing-icon {
   list-style-image: url("chrome://browser/skin/notification-icons.svg#microphone-sharing");
 }
 
 #identity-box[sharing="screen"] > #sharing-icon {
   list-style-image: url("chrome://browser/skin/notification-icons.svg#screen-sharing");
 }
 
-#urlbar[pageproxystate="valid"] > #identity-box[sharing] > #sharing-icon {
+#urlbar:not([editing]) > #identity-box[sharing] > #sharing-icon {
   display: -moz-box;
   animation-delay: -1.5s;
 }
 
-#urlbar[pageproxystate="valid"] > #identity-box[sharing] > #identity-icon,
+#urlbar:not([editing]) > #identity-box[sharing] > #identity-icon,
 #sharing-icon {
   animation: 3s linear pulse infinite;
 }
 
 @keyframes pulse {
   0%, 16.66%, 83.33%, 100% {
     opacity: 0;
   }
@@ -134,25 +135,30 @@
 #tracking-protection-icon:not([state]) {
   margin-inline-end: -18px;
   pointer-events: none;
   opacity: 0;
   /* Only animate the shield in, when it disappears hide it immediately. */
   transition: none;
 }
 
-#urlbar[pageproxystate="invalid"] > #identity-box {
+#urlbar.blankPage > #identity-box,
+#urlbar[editing] > #identity-box {
   pointer-events: none;
 }
 
-#urlbar[pageproxystate="invalid"] > #identity-box > #connection-icon,
-#urlbar[pageproxystate="invalid"] > #identity-box > #identity-icon-labels,
-#urlbar[pageproxystate="invalid"] > #identity-box > #notification-popup-box,
-#urlbar[pageproxystate="invalid"] > #identity-box > #blocked-permissions-container,
-#urlbar[pageproxystate="invalid"] > #identity-box > #tracking-protection-icon {
+#urlbar.blankPage > #identity-box > #notification-popup-box {
+  pointer-events: auto;
+}
+
+#urlbar[editing] > #identity-box > #connection-icon,
+#urlbar[editing] > #identity-box > #identity-icon-labels,
+#urlbar[editing] > #identity-box > #notification-popup-box,
+#urlbar[editing] > #identity-box > #blocked-permissions-container,
+#urlbar[editing] > #identity-box > #tracking-protection-icon {
   visibility: collapse;
 }
 
 /* CONNECTION ICON */
 
 #connection-icon {
   width: 16px;
   height: 16px;