Bug 1550131 - Expose an iterator for AboutLoginsParent subscribers. r=jaws
☠☠ backed out by d650f8a160f8 ☠ ☠
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Mon, 20 May 2019 02:56:01 +0000
changeset 474589 b562886d574d225ceeae632b98285110fdc80a64
parent 474588 e62a90a57da1f9e2e546376fe317c1850ca2f553
child 474590 32ff6a0b84360340e1e2fff213a8e0065586272a
push id36042
push userdvarga@mozilla.com
push dateTue, 21 May 2019 04:19:40 +0000
treeherdermozilla-central@ca560ff55451 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1550131
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 1550131 - Expose an iterator for AboutLoginsParent subscribers. r=jaws Differential Revision: https://phabricator.services.mozilla.com/D31698
browser/components/aboutlogins/AboutLoginsParent.jsm
--- a/browser/components/aboutlogins/AboutLoginsParent.jsm
+++ b/browser/components/aboutlogins/AboutLoginsParent.jsm
@@ -136,25 +136,31 @@ var AboutLoginsParent = {
         this.messageSubscribers("AboutLogins:LoginRemoved", login);
       }
       default: {
         break;
       }
     }
   },
 
-  messageSubscribers(name, details) {
+  * _subscriberIterator() {
     let subscribers = ChromeUtils.nondeterministicGetWeakSetKeys(this._subscribers);
     for (let subscriber of subscribers) {
       if (subscriber.remoteType != EXPECTED_ABOUTLOGINS_REMOTE_TYPE ||
           !subscriber.contentPrincipal ||
           subscriber.contentPrincipal.originNoSuffix != ABOUT_LOGINS_ORIGIN) {
         this._subscribers.delete(subscriber);
         continue;
       }
+      yield subscriber;
+    }
+  },
+
+  messageSubscribers(name, details) {
+    for (let subscriber of this._subscriberIterator()) {
       try {
         subscriber.messageManager.sendAsyncMessage(name, details);
       } catch (ex) {}
     }
   },
 
   getAllLogins() {
     return Services.logins