michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: var Ci = Components.interfaces; michael@0: var Cc = Components.classes; michael@0: michael@0: function Quitter() { michael@0: } michael@0: michael@0: Quitter.prototype = { michael@0: toString: function() { return "[Quitter]"; }, michael@0: quit: function() { michael@0: sendSyncMessage('Quitter.Quit', {}); michael@0: }, michael@0: __exposedProps__: { michael@0: 'toString': 'r', michael@0: 'quit': 'r' michael@0: } michael@0: }; michael@0: michael@0: // This is a frame script, so it may be running in a content process. michael@0: // In any event, it is targeted at a specific "tab", so we listen for michael@0: // the DOMWindowCreated event to be notified about content windows michael@0: // being created in this context. michael@0: michael@0: function QuitterManager() { michael@0: addEventListener("DOMWindowCreated", this, false); michael@0: } michael@0: michael@0: QuitterManager.prototype = { michael@0: handleEvent: function handleEvent(aEvent) { michael@0: var window = aEvent.target.defaultView; michael@0: window.wrappedJSObject.Quitter = new Quitter(window); michael@0: } michael@0: }; michael@0: michael@0: var quittermanager = new QuitterManager();