Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | "use strict"; |
michael@0 | 7 | /** |
michael@0 | 8 | * Fennec-specific actors. |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | /** |
michael@0 | 12 | * Construct a root actor appropriate for use in a server running in a |
michael@0 | 13 | * browser on Android. The returned root actor: |
michael@0 | 14 | * - respects the factories registered with DebuggerServer.addGlobalActor, |
michael@0 | 15 | * - uses a MobileTabList to supply tab actors, |
michael@0 | 16 | * - sends all navigator:browser window documents a Debugger:Shutdown event |
michael@0 | 17 | * when it exits. |
michael@0 | 18 | * |
michael@0 | 19 | * * @param aConnection DebuggerServerConnection |
michael@0 | 20 | * The conection to the client. |
michael@0 | 21 | */ |
michael@0 | 22 | function createRootActor(aConnection) |
michael@0 | 23 | { |
michael@0 | 24 | let parameters = { |
michael@0 | 25 | tabList: new MobileTabList(aConnection), |
michael@0 | 26 | addonList: new BrowserAddonList(aConnection), |
michael@0 | 27 | globalActorFactories: DebuggerServer.globalActorFactories, |
michael@0 | 28 | onShutdown: sendShutdownEvent |
michael@0 | 29 | }; |
michael@0 | 30 | return new RootActor(aConnection, parameters); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | /** |
michael@0 | 34 | * A live list of BrowserTabActors representing the current browser tabs, |
michael@0 | 35 | * to be provided to the root actor to answer 'listTabs' requests. |
michael@0 | 36 | * |
michael@0 | 37 | * This object also takes care of listening for TabClose events and |
michael@0 | 38 | * onCloseWindow notifications, and exiting the BrowserTabActors concerned. |
michael@0 | 39 | * |
michael@0 | 40 | * (See the documentation for RootActor for the definition of the "live |
michael@0 | 41 | * list" interface.) |
michael@0 | 42 | * |
michael@0 | 43 | * @param aConnection DebuggerServerConnection |
michael@0 | 44 | * The connection in which this list's tab actors may participate. |
michael@0 | 45 | * |
michael@0 | 46 | * @see BrowserTabList for more a extensive description of how tab list objects |
michael@0 | 47 | * work. |
michael@0 | 48 | */ |
michael@0 | 49 | function MobileTabList(aConnection) |
michael@0 | 50 | { |
michael@0 | 51 | BrowserTabList.call(this, aConnection); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | MobileTabList.prototype = Object.create(BrowserTabList.prototype); |
michael@0 | 55 | |
michael@0 | 56 | MobileTabList.prototype.constructor = MobileTabList; |
michael@0 | 57 | |
michael@0 | 58 | MobileTabList.prototype._getSelectedBrowser = function(aWindow) { |
michael@0 | 59 | return aWindow.BrowserApp.selectedBrowser; |
michael@0 | 60 | }; |
michael@0 | 61 | |
michael@0 | 62 | MobileTabList.prototype._getChildren = function(aWindow) { |
michael@0 | 63 | return aWindow.BrowserApp.tabs.map(tab => tab.browser); |
michael@0 | 64 | }; |