Bug 1394580 - 7. Follow-up to unpack fields in function signature; r=me
authorJim Chen <nchen@mozilla.com>
Wed, 06 Sep 2017 14:26:18 -0400
changeset 379226 ef59984ad7b0ef0e882d6c48b1c0bc6a1a9e2932
parent 379225 3067ce95b439f75c85c57f51d54623edf5eafa24
child 379227 5c18cf6c6ebdb79c12ef9941e3fe6c37cde2fef6
push id94614
push usernchen@mozilla.com
push dateWed, 06 Sep 2017 18:26:38 +0000
treeherdermozilla-inbound@ef59984ad7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1394580
milestone57.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 1394580 - 7. Follow-up to unpack fields in function signature; r=me Unpack fields from the parameter object in the function signature itself. r=me for trivial patch. MozReview-Commit-ID: BeMPOlLgNcQ
mobile/android/components/geckoview/GeckoViewStartup.js
--- a/mobile/android/components/geckoview/GeckoViewStartup.js
+++ b/mobile/android/components/geckoview/GeckoViewStartup.js
@@ -12,60 +12,59 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 function GeckoViewStartup() {
 }
 
 GeckoViewStartup.prototype = {
   classID: Components.ID("{8e993c34-fdd6-432c-967e-f995d888777f}"),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
 
-  addLazyGetter: function(aOptions) {
-    let {name, script, service, module, observers, ppmm, mm} = aOptions;
+  addLazyGetter: function({name, script, service, module,
+                           observers, ppmm, mm, init, once}) {
     if (script) {
       XPCOMUtils.defineLazyScriptGetter(this, name, script);
     } else if (module) {
       XPCOMUtils.defineLazyGetter(this, name, _ => {
         let sandbox = {};
         Cu.import(module, sandbox);
-        if (aOptions.init) {
-          aOptions.init.call(this, sandbox[name]);
+        if (init) {
+          init.call(this, sandbox[name]);
         }
         return sandbox[name];
       });
     } else if (service) {
       XPCOMUtils.defineLazyGetter(this, name, _ =>
         Cc[service].getService(Ci.nsISupports).wrappedJSObject);
     }
 
     if (observers) {
       let observer = (subject, topic, data) => {
         Services.obs.removeObserver(observer, topic);
-        if (!aOptions.once) {
+        if (!once) {
           Services.obs.addObserver(this[name], topic);
         }
         this[name].observe(subject, topic, data); // Explicitly notify new observer
       };
       observers.forEach(topic => Services.obs.addObserver(observer, topic));
     }
 
     if (ppmm || mm) {
       let target = ppmm ? Services.ppmm : Services.mm;
       let listener = msg => {
         target.removeMessageListener(msg.name, listener);
-        if (!aOptions.once) {
+        if (!once) {
           target.addMessageListener(msg.name, this[name]);
         }
         this[name].receiveMessage(msg);
       };
       (ppmm || mm).forEach(msg => target.addMessageListener(msg, listener));
     }
   },
 
-  addLazyEventListener: function(aOptions) {
-    let {name, target, events, options} = aOptions;
+  addLazyEventListener: function({name, target, events, options}) {
     let listener = event => {
       if (!options || !options.once) {
         target.removeEventListener(event.type, listener, options);
         target.addEventListener(event.type, this[name], options);
       }
       this[name].handleEvent(event);
     };
     events.forEach(event => target.addEventListener(event, listener, options));