Bug 1549810 - Initialize the value of the filter to the query parameter when set. r=MattN
authorJared Wein <jwein@mozilla.com>
Thu, 30 May 2019 16:26:03 +0000
changeset 476226 3034b68282fa8c0e96bb789911fb2186093525a1
parent 476225 f5b8f8b186660ba03d4e48b0df79c068524c3f74
child 476227 807c329de7ea4079b2b7130c3f62c359b40e3769
push id36090
push usernbeleuzu@mozilla.com
push dateFri, 31 May 2019 03:59:09 +0000
treeherdermozilla-central@63568b2a8178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1549810
milestone69.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 1549810 - Initialize the value of the filter to the query parameter when set. r=MattN Differential Revision: https://phabricator.services.mozilla.com/D33034
browser/components/BrowserGlue.jsm
browser/components/aboutlogins/content/aboutLogins.js
browser/components/aboutlogins/content/components/login-filter.js
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -27,17 +27,17 @@ let ACTORS = {
 
     allFrames: true,
   },
 };
 
 let LEGACY_ACTORS = {
   AboutLogins: {
     child: {
-      matches: ["about:logins"],
+      matches: ["about:logins", "about:logins?*"],
       module: "resource:///actors/AboutLoginsChild.jsm",
       events: {
         "AboutLoginsCreateLogin": {wantUntrusted: true},
         "AboutLoginsDeleteLogin": {wantUntrusted: true},
         "AboutLoginsOpenSite": {wantUntrusted: true},
         "AboutLoginsUpdateLogin": {wantUntrusted: true},
         "AboutLoginsInit": {wantUntrusted: true},
       },
--- a/browser/components/aboutlogins/content/aboutLogins.js
+++ b/browser/components/aboutlogins/content/aboutLogins.js
@@ -2,16 +2,23 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 let gElements = {};
 
 document.addEventListener("DOMContentLoaded", () => {
   gElements.loginList = document.querySelector("login-list");
   gElements.loginItem = document.querySelector("login-item");
+  gElements.loginFilter = document.querySelector("login-filter");
+
+  let {searchParams} = new URL(document.location);
+  if (searchParams.get("filter")) {
+    gElements.loginFilter.value = searchParams.get("filter");
+  }
+
   gElements.newLoginButton = document.querySelector("#create-login-button");
 
   gElements.newLoginButton.addEventListener("click", () => {
     gElements.loginItem.setLogin({});
     gElements.loginList.clearSelection();
   });
 
   document.dispatchEvent(new CustomEvent("AboutLoginsInit", {bubbles: true}));
--- a/browser/components/aboutlogins/content/components/login-filter.js
+++ b/browser/components/aboutlogins/content/components/login-filter.js
@@ -35,16 +35,24 @@ class LoginFilter extends ReflectedFluen
   static get reflectedFluentIDs() {
     return ["placeholder"];
   }
 
   static get observedAttributes() {
     return this.reflectedFluentIDs;
   }
 
+  get value() {
+    return this.shadowRoot.querySelector("input").value;
+  }
+
+  set value(val) {
+    this.shadowRoot.querySelector("input").value = val;
+  }
+
   handleSpecialCaseFluentString(attrName) {
     if (attrName != "placeholder") {
       return false;
     }
 
     this.shadowRoot.querySelector("input").placeholder = this.getAttribute(attrName);
     return true;
   }