From d8c553d744d049369583a8f5a700b3e59cd81ae5 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 15 Oct 2014 15:05:08 +0200 Subject: [PATCH] Bug 1082450 - Fix quitter extension. r=gabor --- tools/quitter/contentscript.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/quitter/contentscript.js b/tools/quitter/contentscript.js index a870a6623a8..e25f5dbc843 100644 --- a/tools/quitter/contentscript.js +++ b/tools/quitter/contentscript.js @@ -4,19 +4,14 @@ var Ci = Components.interfaces; var Cc = Components.classes; +var Cu = Components.utils; function Quitter() { } Quitter.prototype = { toString: function() { return "[Quitter]"; }, - quit: function() { - sendSyncMessage('Quitter.Quit', {}); - }, - __exposedProps__: { - 'toString': 'r', - 'quit': 'r' - } + quit: function() { sendSyncMessage('Quitter.Quit', {}); } }; // This is a frame script, so it may be running in a content process. @@ -30,8 +25,12 @@ function QuitterManager() { QuitterManager.prototype = { handleEvent: function handleEvent(aEvent) { + var quitter = new Quitter(window); var window = aEvent.target.defaultView; - window.wrappedJSObject.Quitter = new Quitter(window); + window.wrappedJSObject.Quitter = Cu.cloneInto({ + toString: quitter.toString.bind(quitter), + quit: quitter.quit.bind(quitter) + }, window, {cloneFunctions: true}); } };