mobile/android/chrome/content/dbg-browser-actors.js

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

mercurial