Bug 1356546: Part 3 - Use StructuredCloneHolder as transport for proxied message listeners. r=aswan
authorKris Maglione <maglione.k@gmail.com>
Sat, 06 May 2017 21:21:37 -0700
changeset 412785 fe952a030435f0690bd4f64d6299201b9734cb47
parent 412784 850918e6790b80ded3d5b70d4fdb845b6cb24408
child 412786 c3bf2490530f5ac768040043b8d0dd55ce6c5a03
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1356546
milestone55.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 1356546: Part 3 - Use StructuredCloneHolder as transport for proxied message listeners. r=aswan MozReview-Commit-ID: 2YeNuGkmY3k
toolkit/components/extensions/ExtensionChild.jsm
toolkit/components/extensions/ExtensionParent.jsm
--- a/toolkit/components/extensions/ExtensionChild.jsm
+++ b/toolkit/components/extensions/ExtensionChild.jsm
@@ -753,17 +753,19 @@ class ChildAPIManager {
     }
 
     switch (name || messageName) {
       case "API:RunListener":
         let map = this.listeners.get(data.path);
         let listener = map.ids.get(data.listenerId);
 
         if (listener) {
-          return this.context.runSafe(listener, ...data.args);
+          let args = data.args.deserialize(this.context.cloneScope);
+
+          return this.context.runSafeWithoutClone(listener, ...args);
         }
         if (!map.removedIds.has(data.listenerId)) {
           Services.console.logStringMessage(
             `Unknown listener at childId=${data.childId} path=${data.path} listenerId=${data.listenerId}\n`);
         }
         break;
 
       case "API:CallResult":
--- a/toolkit/components/extensions/ExtensionParent.jsm
+++ b/toolkit/components/extensions/ExtensionParent.jsm
@@ -651,17 +651,17 @@ ParentAPIManager = {
     function listener(...listenerArgs) {
       return context.sendMessage(
         context.parentMessageManager,
         "API:RunListener",
         {
           childId,
           listenerId: data.listenerId,
           path: data.path,
-          args: listenerArgs,
+          args: new StructuredCloneHolder(listenerArgs),
         },
         {
           recipient: {childId},
         });
     }
 
     context.listenerProxies.set(data.listenerId, listener);