Bug 1396856: Part 1 - Remove spread call fallback overhead in event dispatch. r=zombie
authorKris Maglione <maglione.k@gmail.com>
Tue, 05 Sep 2017 11:20:43 -0700
changeset 428903 1e4b5ec2904fcf7641a322480c45a4efd6da40da
parent 428902 ed7b5443cf8b98c807cd1fa29857b51511cd0076
child 428904 3b496e60f978d3ca2792c90ba01207cd7427aaf6
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerszombie
bugs1396856
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 1396856: Part 1 - Remove spread call fallback overhead in event dispatch. r=zombie MozReview-Commit-ID: 3c5p9OvRqHI
toolkit/components/extensions/ExtensionCommon.jsm
toolkit/components/extensions/ExtensionParent.jsm
--- a/toolkit/components/extensions/ExtensionCommon.jsm
+++ b/toolkit/components/extensions/ExtensionCommon.jsm
@@ -1561,36 +1561,36 @@ EventManager.prototype = {
         return true;
       }
       return false;
     };
 
     let fire = {
       sync: (...args) => {
         if (shouldFire()) {
-          return this.context.runSafe(callback, ...args);
+          return this.context.applySafe(callback, args);
         }
       },
       async: (...args) => {
         return Promise.resolve().then(() => {
           if (shouldFire()) {
-            return this.context.runSafe(callback, ...args);
+            return this.context.applySafe(callback, args);
           }
         });
       },
       raw: (...args) => {
         if (!shouldFire()) {
           throw new Error("Called raw() on unloaded/inactive context");
         }
-        return callback(...args);
+        return Reflect.apply(callback, null, args);
       },
       asyncWithoutClone: (...args) => {
         return Promise.resolve().then(() => {
           if (shouldFire()) {
-            return this.context.runSafeWithoutClone(callback, ...args);
+            return this.context.applySafeWithoutClone(callback, args);
           }
         });
       },
     };
 
 
     let unregister = this.register(fire, ...args);
     this.unregister.set(callback, unregister);
--- a/toolkit/components/extensions/ExtensionParent.jsm
+++ b/toolkit/components/extensions/ExtensionParent.jsm
@@ -411,20 +411,20 @@ class ProxyContextParent extends BaseCon
       this.pendingEventBrowser = savedBrowser;
     }
   }
 
   get cloneScope() {
     return this.sandbox;
   }
 
-  runSafe(...args) {
+  applySafe(callback, args) {
     // There's no need to clone when calling listeners for a proxied
     // context.
-    return this.runSafeWithoutClone(...args);
+    return this.applySafeWithoutClone(callback, args);
   }
 
   get xulBrowser() {
     return this.messageManagerProxy.eventTarget;
   }
 
   get parentMessageManager() {
     return this.messageManagerProxy.messageManager;