Bug 1551657 part 2. Stop using [array] in getAllDisabledHosts. r=MattN
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 14 May 2019 19:28:52 +0000
changeset 532759 40d655af6177f18e6e30a4e0933846ca35600661
parent 532758 5a94b7075ddaa1a1958606ae59d3e683b659ee26
child 532760 288bafa86adbbcbdf71e015ac2bc8b15e127f8f8
push id11272
push userapavel@mozilla.com
push dateThu, 16 May 2019 15:28:22 +0000
treeherdermozilla-beta@2265bfc5920d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1551657
milestone68.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 1551657 part 2. Stop using [array] in getAllDisabledHosts. r=MattN Differential Revision: https://phabricator.services.mozilla.com/D31118
toolkit/components/passwordmgr/LoginManager.jsm
toolkit/components/passwordmgr/nsILoginManager.idl
--- a/toolkit/components/passwordmgr/LoginManager.jsm
+++ b/toolkit/components/passwordmgr/LoginManager.jsm
@@ -142,17 +142,17 @@ LoginManager.prototype = {
   _gatherTelemetry(referenceTimeMs) {
     function clearAndGetHistogram(histogramId) {
       let histogram = Services.telemetry.getHistogramById(histogramId);
       histogram.clear();
       return histogram;
     }
 
     clearAndGetHistogram("PWMGR_BLOCKLIST_NUM_SITES").add(
-      this.getAllDisabledHosts({}).length
+      this.getAllDisabledHosts().length
     );
     clearAndGetHistogram("PWMGR_NUM_SAVED_PASSWORDS").add(
       this.countLogins("", "", "")
     );
     clearAndGetHistogram("PWMGR_NUM_HTTPAUTH_PASSWORDS").add(
       this.countLogins("", null, "")
     );
     Services.obs.notifyObservers(null, "weave:telemetry:histogram", "PWMGR_BLOCKLIST_NUM_SITES");
@@ -342,30 +342,26 @@ LoginManager.prototype = {
   /**
    * Get a list of all origins for which logins are disabled.
    *
    * @param {Number} count - only needed for XPCOM.
    *
    * @return {String[]} of disabled origins. If there are no disabled origins,
    *                    the array is empty.
    */
-  getAllDisabledHosts(count) {
+  getAllDisabledHosts() {
     log.debug("Getting a list of all disabled origins");
 
     let disabledHosts = [];
     for (let perm of Services.perms.enumerator) {
       if (perm.type == PERMISSION_SAVE_LOGINS && perm.capability == Services.perms.DENY_ACTION) {
         disabledHosts.push(perm.principal.URI.displayPrePath);
       }
     }
 
-    if (count) {
-      count.value = disabledHosts.length;
-    } // needed for XPCOM
-
     log.debug("getAllDisabledHosts: returning", disabledHosts.length, "disabled hosts.");
     return disabledHosts;
   },
 
 
   /**
    * Search for the known logins for entries matching the specified criteria.
    */
--- a/toolkit/components/passwordmgr/nsILoginManager.idl
+++ b/toolkit/components/passwordmgr/nsILoginManager.idl
@@ -104,28 +104,23 @@ interface nsILoginManager : nsISupports 
    *       (|logins| is an array).
    */
   Array<nsILoginInfo> getAllLogins();
 
 
   /**
    * Obtain a list of all hosts for which password saving is disabled.
    *
-   * @param count
-   *        The number of elements in the array. JS callers can simply use
-   *        the array's .length property and omit this param.
-   * @param hostnames
-   *        An array of hostname strings, in origin URL format without a
-   *        pathname. For example: "https://www.site.com".
+   * @return An array of hostname strings, in origin URL format without a
+   *         pathname. For example: "https://www.site.com".
    *
    * NOTE: This can be called from JS as:
-   *       var logins = pwmgr.getDisabledAllLogins();
+   *       var logins = pwmgr.getAllDisabledHosts();
    */
-  void getAllDisabledHosts([optional] out unsigned long count,
-                    [retval, array, size_is(count)] out wstring hostnames);
+  Array<AString> getAllDisabledHosts();
 
 
   /**
    * Check to see if saving logins has been disabled for a host.
    *
    * @param aHost
    *        The hostname to check. This argument should be in the origin
    *        URL format, without a pathname. For example: "http://foo.com".