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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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/. */
     6 "use strict";
     7 /**
     8  * Fennec-specific actors.
     9  */
    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 }
    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 }
    54 MobileTabList.prototype = Object.create(BrowserTabList.prototype);
    56 MobileTabList.prototype.constructor = MobileTabList;
    58 MobileTabList.prototype._getSelectedBrowser = function(aWindow) {
    59   return aWindow.BrowserApp.selectedBrowser;
    60 };
    62 MobileTabList.prototype._getChildren = function(aWindow) {
    63   return aWindow.BrowserApp.tabs.map(tab => tab.browser);
    64 };

mercurial