Bug 1551102. Stop using [array] in nsIContentPrefService2. r=mak
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 14 May 2019 11:42:20 +0000
changeset 532584 49dd0db0018af5f94f38a4dec13ad0246964827d
parent 532583 f5d5fc68b739aa886368e844eb461a9947503890
child 532585 aa417164d4c7beb948c37df4b6d57986548a00ca
push id11270
push userrgurzau@mozilla.com
push dateWed, 15 May 2019 15:07:19 +0000
treeherdermozilla-beta@571bc76da583 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1551102
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 1551102. Stop using [array] in nsIContentPrefService2. r=mak Though maybe we should just remove getCachedBySubdomainAndName, given that it's only used in tests? Differential Revision: https://phabricator.services.mozilla.com/D30834
dom/interfaces/base/nsIContentPrefService2.idl
toolkit/components/contentprefs/ContentPrefService2.jsm
toolkit/components/contentprefs/tests/unit_cps2/head.js
--- a/dom/interfaces/base/nsIContentPrefService2.idl
+++ b/dom/interfaces/base/nsIContentPrefService2.idl
@@ -186,24 +186,21 @@ interface nsIContentPrefService2 : nsISu
    * The preferences are returned in an array through the out-parameter.  If a
    * preference for a particular subdomain is known not to exist, then an object
    * corresponding to that preference will be present in the array, and, as with
    * getCachedByDomainAndName, its value attribute will be undefined.
    *
    * @param domain   The preferences' domain.
    * @param name     The preferences' name.
    * @param context  The private-browsing context, if any.
-   * @param len      The length of the returned array.
-   * @param prefs    The array of preferences.
+   * @return         The array of preferences.
    */
-  void getCachedBySubdomainAndName(in AString domain,
-                                   in AString name,
-                                   in nsILoadContext context,
-                                   [optional] out unsigned long len,
-                                   [retval,array,size_is(len)] out nsIContentPref prefs);
+  Array<nsIContentPref> getCachedBySubdomainAndName(in AString domain,
+                                                    in AString name,
+                                                    in nsILoadContext context);
 
   /**
    * Synchronously retrieves from the in-memory cache the preference with no
    * domain and the given name.
    *
    * As with getCachedByDomainAndName, if the preference is cached then it is
    * returned; if the preference is known not to exist, then the value attribute
    * of the returned object will be undefined; if the preference is neither
--- a/toolkit/components/contentprefs/ContentPrefService2.jsm
+++ b/toolkit/components/contentprefs/ContentPrefService2.jsm
@@ -291,23 +291,19 @@ ContentPrefService2.prototype = {
                                                                    context) {
     checkGroupArg(group);
     let prefs = this._getCached(group, name, false, context);
     return prefs[0] || null;
   },
 
   getCachedBySubdomainAndName: function CPS2_getCachedBySubdomainAndName(group,
                                                                          name,
-                                                                         context,
-                                                                         len) {
+                                                                         context) {
     checkGroupArg(group);
-    let prefs = this._getCached(group, name, true, context);
-    if (len)
-      len.value = prefs.length;
-    return prefs;
+    return this._getCached(group, name, true, context);
   },
 
   getCachedGlobal: function CPS2_getCachedGlobal(name, context) {
     let prefs = this._getCached(null, name, false, context);
     return prefs[0] || null;
   },
 
   _getCached: function CPS2__getCached(group, name, includeSubdomains,
--- a/toolkit/components/contentprefs/tests/unit_cps2/head.js
+++ b/toolkit/components/contentprefs/tests/unit_cps2/head.js
@@ -161,23 +161,20 @@ function getCachedOK(args, expectedIsCac
     value: expectedVal,
   };
   getCachedOKEx("getCachedByDomainAndName", args, expectedPref, strict);
 }
 
 function getCachedSubdomainsOK(args, expectedGroupValPairs) {
   if (args.length == 2)
     args.push(undefined);
-  let len = {};
-  args.push(len);
   let actualPrefs = cps.getCachedBySubdomainAndName.apply(cps, args);
   actualPrefs = actualPrefs.sort(function(a, b) {
     return a.domain.localeCompare(b.domain);
   });
-  equal(actualPrefs.length, len.value);
   let expectedPrefs = expectedGroupValPairs.map(function([group, val]) {
     return { domain: group, name: args[1], value: val };
   });
   arraysOfArraysOK([actualPrefs], [expectedPrefs], prefOK);
 }
 
 function getCachedGlobalOK(args, expectedIsCached, expectedVal) {
   if (args.length == 1)