2014-06-24 22:12:07 -07:00
|
|
|
/* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */
|
2012-09-26 10:07:57 -07:00
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2015-10-26 09:13:11 -07:00
|
|
|
const Services = require("Services");
|
2014-04-29 08:52:44 -07:00
|
|
|
const { Cc, Ci, Cu } = require("chrome");
|
|
|
|
const { DebuggerServer, ActorPool } = require("devtools/server/main");
|
2015-05-30 02:05:39 -07:00
|
|
|
const { EnvironmentActor, ThreadActor } = require("devtools/server/actors/script");
|
|
|
|
const { ObjectActor, LongStringActor, createValueGrip, stringIsLong } = require("devtools/server/actors/object");
|
2015-09-21 10:04:18 -07:00
|
|
|
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
2012-09-26 10:07:57 -07:00
|
|
|
|
2015-10-26 09:13:11 -07:00
|
|
|
loader.lazyRequireGetter(this, "NetworkMonitor", "devtools/shared/webconsole/network-monitor", true);
|
|
|
|
loader.lazyRequireGetter(this, "NetworkMonitorChild", "devtools/shared/webconsole/network-monitor", true);
|
|
|
|
loader.lazyRequireGetter(this, "ConsoleProgressListener", "devtools/shared/webconsole/network-monitor", true);
|
|
|
|
loader.lazyRequireGetter(this, "events", "sdk/event/core");
|
|
|
|
loader.lazyRequireGetter(this, "ServerLoggingListener", "devtools/shared/webconsole/server-logger", true);
|
2015-10-26 11:55:40 -07:00
|
|
|
loader.lazyRequireGetter(this, "JSPropertyProvider", "devtools/shared/webconsole/js-property-provider", true);
|
2012-09-26 10:07:57 -07:00
|
|
|
|
2013-08-03 03:29:48 -07:00
|
|
|
for (let name of ["WebConsoleUtils", "ConsoleServiceListener",
|
2015-10-26 11:55:40 -07:00
|
|
|
"ConsoleAPIListener", "addWebConsoleCommands",
|
2015-04-26 01:37:59 -07:00
|
|
|
"ConsoleReflowListener", "CONSOLE_WORKER_IDS"]) {
|
2013-08-03 03:29:48 -07:00
|
|
|
Object.defineProperty(this, name, {
|
|
|
|
get: function(prop) {
|
|
|
|
if (prop == "WebConsoleUtils") {
|
|
|
|
prop = "Utils";
|
|
|
|
}
|
2015-10-26 09:13:11 -07:00
|
|
|
if (isWorker) {
|
|
|
|
return require("devtools/shared/webconsole/worker-utils")[prop];
|
|
|
|
} else {
|
|
|
|
return require("devtools/shared/webconsole/utils")[prop];
|
|
|
|
}
|
2013-08-03 03:29:48 -07:00
|
|
|
}.bind(null, name),
|
|
|
|
configurable: true,
|
|
|
|
enumerable: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
/**
|
|
|
|
* The WebConsoleActor implements capabilities needed for the Web Console
|
|
|
|
* feature.
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param object aConnection
|
|
|
|
* The connection to the client, DebuggerServerConnection.
|
2012-10-18 12:04:53 -07:00
|
|
|
* @param object [aParentActor]
|
|
|
|
* Optional, the parent actor.
|
2012-09-26 10:07:57 -07:00
|
|
|
*/
|
2012-10-18 12:04:53 -07:00
|
|
|
function WebConsoleActor(aConnection, aParentActor)
|
2012-09-26 10:07:57 -07:00
|
|
|
{
|
|
|
|
this.conn = aConnection;
|
2013-08-01 01:51:24 -07:00
|
|
|
this.parentActor = aParentActor;
|
2012-09-26 10:02:04 -07:00
|
|
|
|
2012-11-05 08:41:59 -08:00
|
|
|
this._actorPool = new ActorPool(this.conn);
|
|
|
|
this.conn.addActorPool(this._actorPool);
|
2012-10-05 04:54:43 -07:00
|
|
|
|
|
|
|
this._prefs = {};
|
2013-03-30 04:31:10 -07:00
|
|
|
|
2014-07-28 06:01:00 -07:00
|
|
|
this.dbg = this.parentActor.makeDebugger();
|
2013-03-30 04:31:10 -07:00
|
|
|
|
2013-06-26 02:09:59 -07:00
|
|
|
this._netEvents = new Map();
|
2013-12-19 05:04:59 -08:00
|
|
|
this._gripDepth = 0;
|
2014-08-27 03:19:30 -07:00
|
|
|
this._listeners = new Set();
|
2015-03-27 07:28:19 -07:00
|
|
|
this._lastConsoleInputEvaluation = undefined;
|
2013-05-09 08:20:51 -07:00
|
|
|
|
2015-05-30 02:05:39 -07:00
|
|
|
this.objectGrip = this.objectGrip.bind(this);
|
2014-02-25 12:02:58 -08:00
|
|
|
this._onWillNavigate = this._onWillNavigate.bind(this);
|
2014-08-27 03:19:30 -07:00
|
|
|
this._onChangedToplevelDocument = this._onChangedToplevelDocument.bind(this);
|
|
|
|
events.on(this.parentActor, "changed-toplevel-document", this._onChangedToplevelDocument);
|
2013-05-09 08:20:51 -07:00
|
|
|
this._onObserverNotification = this._onObserverNotification.bind(this);
|
2013-08-01 01:51:24 -07:00
|
|
|
if (this.parentActor.isRootActor) {
|
2013-05-25 02:25:36 -07:00
|
|
|
Services.obs.addObserver(this._onObserverNotification,
|
|
|
|
"last-pb-context-exited", false);
|
|
|
|
}
|
2014-03-10 11:57:27 -07:00
|
|
|
|
|
|
|
this.traits = {
|
|
|
|
customNetworkRequest: !this._parentIsContentActor,
|
2015-01-21 13:17:02 -08:00
|
|
|
evaluateJSAsync: true,
|
2015-10-23 14:04:29 -07:00
|
|
|
transferredResponseSize: true,
|
|
|
|
selectedObjectActor: true, // 44+
|
2014-03-10 11:57:27 -07:00
|
|
|
};
|
2012-09-26 10:07:57 -07:00
|
|
|
}
|
|
|
|
|
2013-10-22 07:37:23 -07:00
|
|
|
WebConsoleActor.l10n = new WebConsoleUtils.l10n("chrome://global/locale/console.properties");
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
WebConsoleActor.prototype =
|
|
|
|
{
|
2013-03-30 04:31:10 -07:00
|
|
|
/**
|
|
|
|
* Debugger instance.
|
|
|
|
*
|
|
|
|
* @see jsdebugger.jsm
|
|
|
|
*/
|
|
|
|
dbg: null,
|
|
|
|
|
2013-12-19 05:04:59 -08:00
|
|
|
/**
|
|
|
|
* This is used by the ObjectActor to keep track of the depth of grip() calls.
|
|
|
|
* @private
|
|
|
|
* @type number
|
|
|
|
*/
|
|
|
|
_gripDepth: null,
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
/**
|
2012-11-05 08:41:59 -08:00
|
|
|
* Actor pool for all of the actors we send to the client.
|
2012-09-26 10:02:04 -07:00
|
|
|
* @private
|
|
|
|
* @type object
|
|
|
|
* @see ActorPool
|
2012-10-05 04:54:43 -07:00
|
|
|
*/
|
2012-11-05 08:41:59 -08:00
|
|
|
_actorPool: null,
|
2012-10-05 04:54:43 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Web Console-related preferences.
|
|
|
|
* @private
|
|
|
|
* @type object
|
|
|
|
*/
|
|
|
|
_prefs: null,
|
|
|
|
|
2013-06-26 02:09:59 -07:00
|
|
|
/**
|
|
|
|
* Holds a map between nsIChannel objects and NetworkEventActors for requests
|
|
|
|
* created with sendHTTPRequest.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type Map
|
|
|
|
*/
|
|
|
|
_netEvents: null,
|
|
|
|
|
2014-08-27 03:19:30 -07:00
|
|
|
/**
|
|
|
|
* Holds a set of all currently registered listeners.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type Set
|
|
|
|
*/
|
|
|
|
_listeners: null,
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
/**
|
|
|
|
* The debugger server connection instance.
|
|
|
|
* @type object
|
|
|
|
*/
|
|
|
|
conn: null,
|
|
|
|
|
2014-03-10 11:57:27 -07:00
|
|
|
/**
|
|
|
|
* List of supported features by the console actor.
|
|
|
|
* @type object
|
|
|
|
*/
|
|
|
|
traits: null,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Boolean getter that tells if the parent actor is a ContentActor.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
get _parentIsContentActor() {
|
|
|
|
return "ContentActor" in DebuggerServer &&
|
|
|
|
this.parentActor instanceof DebuggerServer.ContentActor;
|
|
|
|
},
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
/**
|
2015-11-25 07:54:26 -08:00
|
|
|
* The window or sandbox we work with.
|
|
|
|
* Note that even if it is named `window` it refers to the current
|
|
|
|
* global we are debugging, which can be a Sandbox for addons
|
|
|
|
* or browser content toolbox.
|
|
|
|
*
|
|
|
|
* @type nsIDOMWindow or Sandbox
|
2012-09-26 10:07:57 -07:00
|
|
|
*/
|
2013-09-23 03:43:37 -07:00
|
|
|
get window() {
|
|
|
|
if (this.parentActor.isRootActor) {
|
2013-10-22 07:37:23 -07:00
|
|
|
return this._getWindowForBrowserConsole();
|
2013-09-23 03:43:37 -07:00
|
|
|
}
|
|
|
|
return this.parentActor.window;
|
|
|
|
},
|
2012-09-26 10:07:57 -07:00
|
|
|
|
2013-10-22 07:37:23 -07:00
|
|
|
/**
|
|
|
|
* Get a window to use for the browser console.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @return nsIDOMWindow
|
|
|
|
* The window to use, or null if no window could be found.
|
|
|
|
*/
|
|
|
|
_getWindowForBrowserConsole: function WCA__getWindowForBrowserConsole()
|
|
|
|
{
|
|
|
|
// Check if our last used chrome window is still live.
|
|
|
|
let window = this._lastChromeWindow && this._lastChromeWindow.get();
|
|
|
|
// If not, look for a new one.
|
|
|
|
if (!window || window.closed) {
|
|
|
|
window = this.parentActor.window;
|
|
|
|
if (!window) {
|
|
|
|
// Try to find the Browser Console window to use instead.
|
|
|
|
window = Services.wm.getMostRecentWindow("devtools:webconsole");
|
|
|
|
// We prefer the normal chrome window over the console window,
|
|
|
|
// so we'll look for those windows in order to replace our reference.
|
|
|
|
let onChromeWindowOpened = () => {
|
|
|
|
// We'll look for this window when someone next requests window()
|
|
|
|
Services.obs.removeObserver(onChromeWindowOpened, "domwindowopened");
|
|
|
|
this._lastChromeWindow = null;
|
|
|
|
};
|
|
|
|
Services.obs.addObserver(onChromeWindowOpened, "domwindowopened", false);
|
|
|
|
}
|
|
|
|
|
|
|
|
this._handleNewWindow(window);
|
|
|
|
}
|
|
|
|
|
|
|
|
return window;
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Store a newly found window on the actor to be used in the future.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @param nsIDOMWindow window
|
|
|
|
* The window to store on the actor (can be null).
|
|
|
|
*/
|
|
|
|
_handleNewWindow: function WCA__handleNewWindow(window)
|
|
|
|
{
|
|
|
|
if (window) {
|
|
|
|
if (this._hadChromeWindow) {
|
|
|
|
let contextChangedMsg = WebConsoleActor.l10n.getStr("evaluationContextChanged");
|
|
|
|
Services.console.logStringMessage(contextChangedMsg);
|
|
|
|
}
|
|
|
|
this._lastChromeWindow = Cu.getWeakReference(window);
|
|
|
|
this._hadChromeWindow = true;
|
|
|
|
} else {
|
|
|
|
this._lastChromeWindow = null;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether we've been using a window before.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
_hadChromeWindow: false,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A weak reference to the last chrome window we used to work with.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type nsIWeakReference
|
|
|
|
*/
|
|
|
|
_lastChromeWindow: null,
|
|
|
|
|
2014-02-25 12:02:58 -08:00
|
|
|
// The evalWindow is used at the scope for JS evaluation.
|
|
|
|
_evalWindow: null,
|
|
|
|
get evalWindow() {
|
|
|
|
return this._evalWindow || this.window;
|
|
|
|
},
|
|
|
|
|
|
|
|
set evalWindow(aWindow) {
|
|
|
|
this._evalWindow = aWindow;
|
|
|
|
|
2014-04-22 11:17:30 -07:00
|
|
|
if (!this._progressListenerActive) {
|
|
|
|
events.on(this.parentActor, "will-navigate", this._onWillNavigate);
|
2014-02-25 12:02:58 -08:00
|
|
|
this._progressListenerActive = true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flag used to track if we are listening for events from the progress
|
|
|
|
* listener of the tab actor. We use the progress listener to clear
|
|
|
|
* this.evalWindow on page navigation.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @type boolean
|
|
|
|
*/
|
|
|
|
_progressListenerActive: false,
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
/**
|
2013-05-28 08:24:31 -07:00
|
|
|
* The ConsoleServiceListener instance.
|
2012-09-26 10:07:57 -07:00
|
|
|
* @type object
|
|
|
|
*/
|
2013-05-28 08:24:31 -07:00
|
|
|
consoleServiceListener: null,
|
2012-09-26 10:07:57 -07:00
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
/**
|
|
|
|
* The ConsoleAPIListener instance.
|
|
|
|
*/
|
|
|
|
consoleAPIListener: null,
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
/**
|
|
|
|
* The NetworkMonitor instance.
|
|
|
|
*/
|
|
|
|
networkMonitor: null,
|
|
|
|
|
2016-01-14 05:53:00 -08:00
|
|
|
/**
|
|
|
|
* The NetworkMonitor instance living in the same (child) process.
|
|
|
|
*/
|
|
|
|
networkMonitorChild: null,
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
/**
|
|
|
|
* The ConsoleProgressListener instance.
|
|
|
|
*/
|
|
|
|
consoleProgressListener: null,
|
|
|
|
|
2013-10-22 00:43:00 -07:00
|
|
|
/**
|
|
|
|
* The ConsoleReflowListener instance.
|
|
|
|
*/
|
|
|
|
consoleReflowListener: null,
|
|
|
|
|
2013-11-26 10:42:02 -08:00
|
|
|
/**
|
2015-04-06 06:41:00 -07:00
|
|
|
* The Web Console Commands names cache.
|
2013-11-26 10:42:02 -08:00
|
|
|
* @private
|
|
|
|
* @type array
|
|
|
|
*/
|
2015-04-06 06:41:00 -07:00
|
|
|
_webConsoleCommandsCache: null,
|
2013-11-26 10:42:02 -08:00
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
actorPrefix: "console",
|
|
|
|
|
2015-06-19 23:47:00 -07:00
|
|
|
get globalDebugObject() {
|
|
|
|
return this.parentActor.threadActor.globalDebugObject;
|
|
|
|
},
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
grip: function WCA_grip()
|
|
|
|
{
|
|
|
|
return { actor: this.actorID };
|
|
|
|
},
|
|
|
|
|
2014-03-03 11:11:00 -08:00
|
|
|
hasNativeConsoleAPI: function WCA_hasNativeConsoleAPI(aWindow) {
|
|
|
|
let isNative = false;
|
|
|
|
try {
|
2014-03-26 18:44:25 -07:00
|
|
|
// We are very explicitly examining the "console" property of
|
|
|
|
// the non-Xrayed object here.
|
2014-03-03 11:11:00 -08:00
|
|
|
let console = aWindow.wrappedJSObject.console;
|
|
|
|
isNative = console instanceof aWindow.Console;
|
|
|
|
}
|
|
|
|
catch (ex) { }
|
|
|
|
return isNative;
|
|
|
|
},
|
2012-09-26 10:02:04 -07:00
|
|
|
|
2013-03-30 04:31:10 -07:00
|
|
|
_findProtoChain: ThreadActor.prototype._findProtoChain,
|
|
|
|
_removeFromProtoChain: ThreadActor.prototype._removeFromProtoChain,
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
/**
|
|
|
|
* Destroy the current WebConsoleActor instance.
|
|
|
|
*/
|
|
|
|
disconnect: function WCA_disconnect()
|
|
|
|
{
|
2013-05-28 08:24:31 -07:00
|
|
|
if (this.consoleServiceListener) {
|
|
|
|
this.consoleServiceListener.destroy();
|
|
|
|
this.consoleServiceListener = null;
|
2012-09-26 10:07:57 -07:00
|
|
|
}
|
2012-09-26 10:02:04 -07:00
|
|
|
if (this.consoleAPIListener) {
|
|
|
|
this.consoleAPIListener.destroy();
|
|
|
|
this.consoleAPIListener = null;
|
|
|
|
}
|
2012-10-05 04:54:43 -07:00
|
|
|
if (this.networkMonitor) {
|
|
|
|
this.networkMonitor.destroy();
|
|
|
|
this.networkMonitor = null;
|
|
|
|
}
|
2016-01-14 05:53:00 -08:00
|
|
|
if (this.networkMonitorChild) {
|
|
|
|
this.networkMonitorChild.destroy();
|
|
|
|
this.networkMonitorChild = null;
|
|
|
|
}
|
2012-10-05 04:54:43 -07:00
|
|
|
if (this.consoleProgressListener) {
|
|
|
|
this.consoleProgressListener.destroy();
|
|
|
|
this.consoleProgressListener = null;
|
|
|
|
}
|
2013-10-22 00:43:00 -07:00
|
|
|
if (this.consoleReflowListener) {
|
|
|
|
this.consoleReflowListener.destroy();
|
|
|
|
this.consoleReflowListener = null;
|
|
|
|
}
|
2015-08-17 03:48:01 -07:00
|
|
|
if (this.serverLoggingListener) {
|
|
|
|
this.serverLoggingListener.destroy();
|
|
|
|
this.serverLoggingListener = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
events.off(this.parentActor, "changed-toplevel-document",
|
|
|
|
this._onChangedToplevelDocument);
|
|
|
|
|
2013-01-11 09:31:09 -08:00
|
|
|
this.conn.removeActorPool(this._actorPool);
|
2015-08-17 03:48:01 -07:00
|
|
|
|
2013-08-01 01:51:24 -07:00
|
|
|
if (this.parentActor.isRootActor) {
|
2013-05-25 02:25:36 -07:00
|
|
|
Services.obs.removeObserver(this._onObserverNotification,
|
|
|
|
"last-pb-context-exited");
|
|
|
|
}
|
2013-06-26 02:09:59 -07:00
|
|
|
|
2015-08-17 03:48:01 -07:00
|
|
|
this._actorPool = null;
|
2015-04-06 06:41:00 -07:00
|
|
|
this._webConsoleCommandsCache = null;
|
2015-03-27 07:28:19 -07:00
|
|
|
this._lastConsoleInputEvaluation = null;
|
2014-02-25 12:02:58 -08:00
|
|
|
this._evalWindow = null;
|
2013-06-26 02:09:59 -07:00
|
|
|
this._netEvents.clear();
|
2013-03-30 04:31:10 -07:00
|
|
|
this.dbg.enabled = false;
|
|
|
|
this.dbg = null;
|
2013-08-01 01:51:24 -07:00
|
|
|
this.conn = null;
|
2012-09-26 10:07:57 -07:00
|
|
|
},
|
|
|
|
|
2013-09-25 09:03:17 -07:00
|
|
|
/**
|
|
|
|
* Create and return an environment actor that corresponds to the provided
|
|
|
|
* Debugger.Environment. This is a straightforward clone of the ThreadActor's
|
|
|
|
* method except that it stores the environment actor in the web console
|
|
|
|
* actor's pool.
|
|
|
|
*
|
|
|
|
* @param Debugger.Environment aEnvironment
|
|
|
|
* The lexical environment we want to extract.
|
|
|
|
* @return The EnvironmentActor for aEnvironment or undefined for host
|
|
|
|
* functions or functions scoped to a non-debuggee global.
|
|
|
|
*/
|
|
|
|
createEnvironmentActor: function WCA_createEnvironmentActor(aEnvironment) {
|
|
|
|
if (!aEnvironment) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aEnvironment.actor) {
|
|
|
|
return aEnvironment.actor;
|
|
|
|
}
|
|
|
|
|
|
|
|
let actor = new EnvironmentActor(aEnvironment, this);
|
|
|
|
this._actorPool.addActor(actor);
|
|
|
|
aEnvironment.actor = actor;
|
|
|
|
|
|
|
|
return actor;
|
|
|
|
},
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
/**
|
2013-03-30 04:31:10 -07:00
|
|
|
* Create a grip for the given value.
|
2012-09-26 10:02:04 -07:00
|
|
|
*
|
|
|
|
* @param mixed aValue
|
|
|
|
* @return object
|
|
|
|
*/
|
|
|
|
createValueGrip: function WCA_createValueGrip(aValue)
|
|
|
|
{
|
2015-05-30 02:05:39 -07:00
|
|
|
return createValueGrip(aValue, this._actorPool, this.objectGrip);
|
2013-03-30 04:31:10 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Make a debuggee value for the given value.
|
|
|
|
*
|
|
|
|
* @param mixed aValue
|
|
|
|
* The value you want to get a debuggee value for.
|
2013-05-09 08:20:51 -07:00
|
|
|
* @param boolean aUseObjectGlobal
|
|
|
|
* If |true| the object global is determined and added as a debuggee,
|
|
|
|
* otherwise |this.window| is used when makeDebuggeeValue() is invoked.
|
2013-03-30 04:31:10 -07:00
|
|
|
* @return object
|
|
|
|
* Debuggee value for |aValue|.
|
|
|
|
*/
|
2013-05-09 08:20:51 -07:00
|
|
|
makeDebuggeeValue: function WCA_makeDebuggeeValue(aValue, aUseObjectGlobal)
|
2013-03-30 04:31:10 -07:00
|
|
|
{
|
2013-05-09 08:20:51 -07:00
|
|
|
if (aUseObjectGlobal && typeof aValue == "object") {
|
|
|
|
try {
|
2015-11-19 07:11:56 -08:00
|
|
|
let global = Cu.getGlobalForObject(aValue);
|
|
|
|
let dbgGlobal = this.dbg.makeGlobalObjectReference(global);
|
|
|
|
return dbgGlobal.makeDebuggeeValue(aValue);
|
2013-05-09 08:20:51 -07:00
|
|
|
}
|
|
|
|
catch (ex) {
|
2015-11-19 07:11:56 -08:00
|
|
|
// The above can throw an exception if aValue is not an actual object
|
|
|
|
// or 'Object in compartment marked as invisible to Debugger'
|
2013-05-09 08:20:51 -07:00
|
|
|
}
|
|
|
|
}
|
2015-11-19 07:11:56 -08:00
|
|
|
let dbgGlobal = this.dbg.makeGlobalObjectReference(this.window);
|
2013-05-09 08:20:51 -07:00
|
|
|
return dbgGlobal.makeDebuggeeValue(aValue);
|
2012-09-26 10:02:04 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a grip for the given object.
|
|
|
|
*
|
|
|
|
* @param object aObject
|
|
|
|
* The object you want.
|
2013-03-30 04:31:10 -07:00
|
|
|
* @param object aPool
|
|
|
|
* An ActorPool where the new actor instance is added.
|
2012-09-26 10:02:04 -07:00
|
|
|
* @param object
|
|
|
|
* The object grip.
|
|
|
|
*/
|
2013-03-30 04:31:10 -07:00
|
|
|
objectGrip: function WCA_objectGrip(aObject, aPool)
|
2012-09-26 10:02:04 -07:00
|
|
|
{
|
2015-05-30 02:05:28 -07:00
|
|
|
let actor = new ObjectActor(aObject, {
|
|
|
|
getGripDepth: () => this._gripDepth,
|
|
|
|
incrementGripDepth: () => this._gripDepth++,
|
|
|
|
decrementGripDepth: () => this._gripDepth--,
|
2015-05-30 02:05:39 -07:00
|
|
|
createValueGrip: v => this.createValueGrip(v),
|
2015-05-30 02:05:28 -07:00
|
|
|
sources: () => DevToolsUtils.reportException("WebConsoleActor",
|
|
|
|
Error("sources not yet implemented")),
|
2015-06-19 23:47:00 -07:00
|
|
|
createEnvironmentActor: (env) => this.createEnvironmentActor(env),
|
|
|
|
getGlobalDebugObject: () => this.globalDebugObject
|
2015-05-30 02:05:28 -07:00
|
|
|
});
|
2013-03-30 04:31:10 -07:00
|
|
|
aPool.addActor(actor);
|
2012-09-26 10:02:04 -07:00
|
|
|
return actor.grip();
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
2013-03-30 04:31:10 -07:00
|
|
|
* Create a grip for the given string.
|
2012-09-26 10:02:04 -07:00
|
|
|
*
|
2012-11-05 08:41:59 -08:00
|
|
|
* @param string aString
|
|
|
|
* The string you want to create the grip for.
|
2013-03-30 04:31:10 -07:00
|
|
|
* @param object aPool
|
|
|
|
* An ActorPool where the new actor instance is added.
|
|
|
|
* @return object
|
|
|
|
* A LongStringActor object that wraps the given string.
|
2012-09-26 10:02:04 -07:00
|
|
|
*/
|
2013-03-30 04:31:10 -07:00
|
|
|
longStringGrip: function WCA_longStringGrip(aString, aPool)
|
2012-09-26 10:02:04 -07:00
|
|
|
{
|
2015-05-30 02:05:39 -07:00
|
|
|
let actor = new LongStringActor(aString);
|
2013-03-30 04:31:10 -07:00
|
|
|
aPool.addActor(actor);
|
|
|
|
return actor.grip();
|
2012-09-26 10:02:04 -07:00
|
|
|
},
|
|
|
|
|
2013-06-04 08:47:39 -07:00
|
|
|
/**
|
|
|
|
* Create a long string grip if needed for the given string.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @param string aString
|
|
|
|
* The string you want to create a long string grip for.
|
|
|
|
* @return string|object
|
|
|
|
* A string is returned if |aString| is not a long string.
|
|
|
|
* A LongStringActor grip is returned if |aString| is a long string.
|
|
|
|
*/
|
|
|
|
_createStringGrip: function NEA__createStringGrip(aString)
|
|
|
|
{
|
2015-05-30 02:05:39 -07:00
|
|
|
if (aString && stringIsLong(aString)) {
|
2013-06-04 08:47:39 -07:00
|
|
|
return this.longStringGrip(aString, this._actorPool);
|
|
|
|
}
|
|
|
|
return aString;
|
|
|
|
},
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
/**
|
2012-11-05 08:41:59 -08:00
|
|
|
* Get an object actor by its ID.
|
2012-09-26 10:02:04 -07:00
|
|
|
*
|
2012-11-05 08:41:59 -08:00
|
|
|
* @param string aActorID
|
|
|
|
* @return object
|
2012-09-26 10:02:04 -07:00
|
|
|
*/
|
2012-11-05 08:41:59 -08:00
|
|
|
getActorByID: function WCA_getActorByID(aActorID)
|
2012-09-26 10:02:04 -07:00
|
|
|
{
|
2012-11-05 08:41:59 -08:00
|
|
|
return this._actorPool.get(aActorID);
|
2012-09-26 10:02:04 -07:00
|
|
|
},
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
/**
|
2012-11-05 08:41:59 -08:00
|
|
|
* Release an actor.
|
2012-10-05 04:54:43 -07:00
|
|
|
*
|
|
|
|
* @param object aActor
|
2012-11-05 08:41:59 -08:00
|
|
|
* The actor instance you want to release.
|
2012-10-05 04:54:43 -07:00
|
|
|
*/
|
2012-11-05 08:41:59 -08:00
|
|
|
releaseActor: function WCA_releaseActor(aActor)
|
2012-10-05 04:54:43 -07:00
|
|
|
{
|
2012-11-05 08:41:59 -08:00
|
|
|
this._actorPool.removeActor(aActor.actorID);
|
2012-10-05 04:54:43 -07:00
|
|
|
},
|
|
|
|
|
2015-03-27 07:28:19 -07:00
|
|
|
/**
|
|
|
|
* Returns the latest web console input evaluation.
|
|
|
|
* This is undefined if no evaluations have been completed.
|
|
|
|
*
|
|
|
|
* @return object
|
|
|
|
*/
|
|
|
|
getLastConsoleInputEvaluation: function WCU_getLastConsoleInputEvaluation()
|
|
|
|
{
|
|
|
|
return this._lastConsoleInputEvaluation;
|
|
|
|
},
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
//////////////////
|
|
|
|
// Request handlers for known packet types.
|
|
|
|
//////////////////
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
/**
|
|
|
|
* Handler for the "startListeners" request.
|
|
|
|
*
|
|
|
|
* @param object aRequest
|
|
|
|
* The JSON request object received from the Web Console client.
|
|
|
|
* @return object
|
|
|
|
* The response object which holds the startedListeners array.
|
|
|
|
*/
|
|
|
|
onStartListeners: function WCA_onStartListeners(aRequest)
|
|
|
|
{
|
2015-10-26 09:13:11 -07:00
|
|
|
// XXXworkers: Not handling the Console API yet for workers (Bug 1209353).
|
|
|
|
if (isWorker) {
|
|
|
|
aRequest.listeners = [];
|
|
|
|
}
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
let startedListeners = [];
|
2013-08-01 01:51:24 -07:00
|
|
|
let window = !this.parentActor.isRootActor ? this.window : null;
|
2014-03-10 11:57:27 -07:00
|
|
|
let appId = null;
|
|
|
|
let messageManager = null;
|
|
|
|
|
|
|
|
if (this._parentIsContentActor) {
|
|
|
|
appId = this.parentActor.docShell.appId;
|
2014-04-03 05:45:25 -07:00
|
|
|
messageManager = this.parentActor.messageManager;
|
2014-03-10 11:57:27 -07:00
|
|
|
}
|
2012-09-26 10:07:57 -07:00
|
|
|
|
|
|
|
while (aRequest.listeners.length > 0) {
|
|
|
|
let listener = aRequest.listeners.shift();
|
|
|
|
switch (listener) {
|
|
|
|
case "PageError":
|
2013-05-28 08:24:31 -07:00
|
|
|
if (!this.consoleServiceListener) {
|
|
|
|
this.consoleServiceListener =
|
|
|
|
new ConsoleServiceListener(window, this);
|
|
|
|
this.consoleServiceListener.init();
|
2012-09-26 10:07:57 -07:00
|
|
|
}
|
|
|
|
startedListeners.push(listener);
|
|
|
|
break;
|
2012-09-26 10:02:04 -07:00
|
|
|
case "ConsoleAPI":
|
|
|
|
if (!this.consoleAPIListener) {
|
|
|
|
this.consoleAPIListener =
|
2012-10-06 03:29:57 -07:00
|
|
|
new ConsoleAPIListener(window, this);
|
2012-09-26 10:02:04 -07:00
|
|
|
this.consoleAPIListener.init();
|
|
|
|
}
|
|
|
|
startedListeners.push(listener);
|
|
|
|
break;
|
2012-10-05 04:54:43 -07:00
|
|
|
case "NetworkActivity":
|
|
|
|
if (!this.networkMonitor) {
|
2014-04-03 05:45:25 -07:00
|
|
|
if (appId || messageManager) {
|
2016-01-14 05:53:00 -08:00
|
|
|
// Start a network monitor in the parent process to listen to
|
|
|
|
// most requests than happen in parent
|
2014-03-10 11:57:27 -07:00
|
|
|
this.networkMonitor =
|
2014-04-03 05:45:25 -07:00
|
|
|
new NetworkMonitorChild(appId, messageManager,
|
|
|
|
this.parentActor.actorID, this);
|
2016-01-14 05:53:00 -08:00
|
|
|
this.networkMonitor.init();
|
|
|
|
// Spawn also one in the child to listen to service workers
|
|
|
|
this.networkMonitorChild = new NetworkMonitor({ window: window },
|
|
|
|
this);
|
|
|
|
this.networkMonitorChild.init();
|
2014-03-10 11:57:27 -07:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
this.networkMonitor = new NetworkMonitor({ window: window }, this);
|
2016-01-14 05:53:00 -08:00
|
|
|
this.networkMonitor.init();
|
2014-03-10 11:57:27 -07:00
|
|
|
}
|
2012-10-05 04:54:43 -07:00
|
|
|
}
|
|
|
|
startedListeners.push(listener);
|
|
|
|
break;
|
|
|
|
case "FileActivity":
|
2014-11-07 12:24:47 -08:00
|
|
|
if (this.window instanceof Ci.nsIDOMWindow) {
|
|
|
|
if (!this.consoleProgressListener) {
|
|
|
|
this.consoleProgressListener =
|
|
|
|
new ConsoleProgressListener(this.window, this);
|
|
|
|
}
|
|
|
|
this.consoleProgressListener.startMonitor(this.consoleProgressListener.
|
|
|
|
MONITOR_FILE_ACTIVITY);
|
|
|
|
startedListeners.push(listener);
|
2012-10-05 04:54:43 -07:00
|
|
|
}
|
|
|
|
break;
|
2013-10-22 00:43:00 -07:00
|
|
|
case "ReflowActivity":
|
|
|
|
if (!this.consoleReflowListener) {
|
|
|
|
this.consoleReflowListener =
|
|
|
|
new ConsoleReflowListener(this.window, this);
|
|
|
|
}
|
|
|
|
startedListeners.push(listener);
|
|
|
|
break;
|
2015-08-17 03:48:01 -07:00
|
|
|
case "ServerLogging":
|
|
|
|
if (!this.serverLoggingListener) {
|
|
|
|
this.serverLoggingListener =
|
|
|
|
new ServerLoggingListener(this.window, this);
|
|
|
|
}
|
|
|
|
startedListeners.push(listener);
|
|
|
|
break;
|
2012-09-26 10:07:57 -07:00
|
|
|
}
|
|
|
|
}
|
2014-08-27 03:19:30 -07:00
|
|
|
|
|
|
|
// Update the live list of running listeners
|
|
|
|
startedListeners.forEach(this._listeners.add, this._listeners);
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
return {
|
|
|
|
startedListeners: startedListeners,
|
2012-12-17 12:06:13 -08:00
|
|
|
nativeConsoleAPI: this.hasNativeConsoleAPI(this.window),
|
2014-03-10 11:57:27 -07:00
|
|
|
traits: this.traits,
|
2012-09-26 10:02:04 -07:00
|
|
|
};
|
2012-09-26 10:07:57 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handler for the "stopListeners" request.
|
|
|
|
*
|
|
|
|
* @param object aRequest
|
|
|
|
* The JSON request object received from the Web Console client.
|
|
|
|
* @return object
|
|
|
|
* The response packet to send to the client: holds the
|
|
|
|
* stoppedListeners array.
|
|
|
|
*/
|
|
|
|
onStopListeners: function WCA_onStopListeners(aRequest)
|
|
|
|
{
|
|
|
|
let stoppedListeners = [];
|
|
|
|
|
|
|
|
// If no specific listeners are requested to be detached, we stop all
|
|
|
|
// listeners.
|
2012-10-05 04:54:43 -07:00
|
|
|
let toDetach = aRequest.listeners ||
|
|
|
|
["PageError", "ConsoleAPI", "NetworkActivity",
|
2015-08-17 03:48:01 -07:00
|
|
|
"FileActivity", "ServerLogging"];
|
2012-09-26 10:07:57 -07:00
|
|
|
|
|
|
|
while (toDetach.length > 0) {
|
|
|
|
let listener = toDetach.shift();
|
|
|
|
switch (listener) {
|
|
|
|
case "PageError":
|
2013-05-28 08:24:31 -07:00
|
|
|
if (this.consoleServiceListener) {
|
|
|
|
this.consoleServiceListener.destroy();
|
|
|
|
this.consoleServiceListener = null;
|
2012-09-26 10:07:57 -07:00
|
|
|
}
|
|
|
|
stoppedListeners.push(listener);
|
|
|
|
break;
|
2012-09-26 10:02:04 -07:00
|
|
|
case "ConsoleAPI":
|
|
|
|
if (this.consoleAPIListener) {
|
|
|
|
this.consoleAPIListener.destroy();
|
|
|
|
this.consoleAPIListener = null;
|
|
|
|
}
|
|
|
|
stoppedListeners.push(listener);
|
|
|
|
break;
|
2012-10-05 04:54:43 -07:00
|
|
|
case "NetworkActivity":
|
|
|
|
if (this.networkMonitor) {
|
|
|
|
this.networkMonitor.destroy();
|
|
|
|
this.networkMonitor = null;
|
|
|
|
}
|
2016-01-14 05:53:00 -08:00
|
|
|
if (this.networkMonitorChild) {
|
|
|
|
this.networkMonitorChild.destroy();
|
|
|
|
this.networkMonitorChild = null;
|
|
|
|
}
|
2012-10-05 04:54:43 -07:00
|
|
|
stoppedListeners.push(listener);
|
|
|
|
break;
|
|
|
|
case "FileActivity":
|
|
|
|
if (this.consoleProgressListener) {
|
|
|
|
this.consoleProgressListener.stopMonitor(this.consoleProgressListener.
|
|
|
|
MONITOR_FILE_ACTIVITY);
|
2013-07-01 06:47:09 -07:00
|
|
|
this.consoleProgressListener = null;
|
2012-10-05 04:54:43 -07:00
|
|
|
}
|
|
|
|
stoppedListeners.push(listener);
|
|
|
|
break;
|
2013-10-22 00:43:00 -07:00
|
|
|
case "ReflowActivity":
|
|
|
|
if (this.consoleReflowListener) {
|
|
|
|
this.consoleReflowListener.destroy();
|
|
|
|
this.consoleReflowListener = null;
|
|
|
|
}
|
|
|
|
stoppedListeners.push(listener);
|
|
|
|
break;
|
2015-08-17 03:48:01 -07:00
|
|
|
case "ServerLogging":
|
|
|
|
if (this.serverLoggingListener) {
|
|
|
|
this.serverLoggingListener.destroy();
|
|
|
|
this.serverLoggingListener = null;
|
|
|
|
}
|
|
|
|
stoppedListeners.push(listener);
|
|
|
|
break;
|
2012-09-26 10:07:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-27 03:19:30 -07:00
|
|
|
// Update the live list of running listeners
|
|
|
|
stoppedListeners.forEach(this._listeners.delete, this._listeners);
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
return { stoppedListeners: stoppedListeners };
|
|
|
|
},
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
/**
|
|
|
|
* Handler for the "getCachedMessages" request. This method sends the cached
|
|
|
|
* error messages and the window.console API calls to the client.
|
|
|
|
*
|
|
|
|
* @param object aRequest
|
|
|
|
* The JSON request object received from the Web Console client.
|
|
|
|
* @return object
|
|
|
|
* The response packet to send to the client: it holds the cached
|
|
|
|
* messages array.
|
|
|
|
*/
|
|
|
|
onGetCachedMessages: function WCA_onGetCachedMessages(aRequest)
|
|
|
|
{
|
|
|
|
let types = aRequest.messageTypes;
|
|
|
|
if (!types) {
|
|
|
|
return {
|
|
|
|
error: "missingParameter",
|
|
|
|
message: "The messageTypes parameter is missing.",
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
let messages = [];
|
|
|
|
|
|
|
|
while (types.length > 0) {
|
|
|
|
let type = types.shift();
|
|
|
|
switch (type) {
|
2013-05-28 08:24:31 -07:00
|
|
|
case "ConsoleAPI": {
|
|
|
|
if (!this.consoleAPIListener) {
|
|
|
|
break;
|
2012-09-26 10:02:04 -07:00
|
|
|
}
|
2015-11-20 06:52:32 -08:00
|
|
|
|
2015-11-25 07:54:26 -08:00
|
|
|
// See `window` definition. It isn't always a DOM Window.
|
|
|
|
let requestStartTime = this.window && this.window.performance ?
|
2015-11-20 06:52:32 -08:00
|
|
|
this.window.performance.timing.requestStart : 0;
|
|
|
|
|
2013-05-28 08:24:31 -07:00
|
|
|
let cache = this.consoleAPIListener
|
2013-08-01 01:51:24 -07:00
|
|
|
.getCachedMessages(!this.parentActor.isRootActor);
|
2013-05-28 08:24:31 -07:00
|
|
|
cache.forEach((aMessage) => {
|
2015-11-20 06:52:32 -08:00
|
|
|
// Filter out messages that came from a ServiceWorker but happened
|
|
|
|
// before the page was requested.
|
|
|
|
if (aMessage.innerID === "ServiceWorker" &&
|
|
|
|
requestStartTime > aMessage.timeStamp) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-05-28 08:24:31 -07:00
|
|
|
let message = this.prepareConsoleMessageForRemote(aMessage);
|
|
|
|
message._type = type;
|
|
|
|
messages.push(message);
|
|
|
|
});
|
2012-09-26 10:02:04 -07:00
|
|
|
break;
|
2013-05-28 08:24:31 -07:00
|
|
|
}
|
|
|
|
case "PageError": {
|
|
|
|
if (!this.consoleServiceListener) {
|
|
|
|
break;
|
2012-09-26 10:02:04 -07:00
|
|
|
}
|
2013-05-28 08:24:31 -07:00
|
|
|
let cache = this.consoleServiceListener
|
2013-08-01 01:51:24 -07:00
|
|
|
.getCachedMessages(!this.parentActor.isRootActor);
|
2013-05-28 08:24:31 -07:00
|
|
|
cache.forEach((aMessage) => {
|
|
|
|
let message = null;
|
|
|
|
if (aMessage instanceof Ci.nsIScriptError) {
|
|
|
|
message = this.preparePageErrorForRemote(aMessage);
|
|
|
|
message._type = type;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
message = {
|
|
|
|
_type: "LogMessage",
|
2013-06-23 04:35:22 -07:00
|
|
|
message: this._createStringGrip(aMessage.message),
|
2013-05-28 08:24:31 -07:00
|
|
|
timeStamp: aMessage.timeStamp,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
messages.push(message);
|
|
|
|
});
|
2012-09-26 10:02:04 -07:00
|
|
|
break;
|
2013-05-28 08:24:31 -07:00
|
|
|
}
|
2012-09-26 10:02:04 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
messages: messages,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2014-12-16 17:18:26 -08:00
|
|
|
/**
|
|
|
|
* Handler for the "evaluateJSAsync" request. This method evaluates the given
|
|
|
|
* JavaScript string and sends back a packet with a unique ID.
|
|
|
|
* The result will be returned later as an unsolicited `evaluationResult`,
|
|
|
|
* that can be associated back to this request via the `resultID` field.
|
|
|
|
*
|
|
|
|
* @param object aRequest
|
|
|
|
* The JSON request object received from the Web Console client.
|
|
|
|
* @return object
|
|
|
|
* The response packet to send to with the unique id in the
|
|
|
|
* `resultID` field.
|
|
|
|
*/
|
|
|
|
onEvaluateJSAsync: function WCA_onEvaluateJSAsync(aRequest)
|
|
|
|
{
|
|
|
|
// We want to be able to run console commands without waiting
|
|
|
|
// for the first to return (see Bug 1088861).
|
|
|
|
|
|
|
|
// First, send a response packet with the id only.
|
|
|
|
let resultID = Date.now();
|
|
|
|
this.conn.send({
|
|
|
|
from: this.actorID,
|
|
|
|
resultID: resultID
|
|
|
|
});
|
|
|
|
|
|
|
|
// Then, execute the script that may pause.
|
|
|
|
let response = this.onEvaluateJS(aRequest);
|
|
|
|
response.resultID = resultID;
|
|
|
|
|
|
|
|
// Finally, send an unsolicited evaluationResult packet with
|
|
|
|
// the normal return value
|
|
|
|
this.conn.sendActorEvent(this.actorID, "evaluationResult", response);
|
|
|
|
},
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
/**
|
|
|
|
* Handler for the "evaluateJS" request. This method evaluates the given
|
|
|
|
* JavaScript string and sends back the result.
|
|
|
|
*
|
|
|
|
* @param object aRequest
|
|
|
|
* The JSON request object received from the Web Console client.
|
|
|
|
* @return object
|
|
|
|
* The evaluation response packet.
|
|
|
|
*/
|
|
|
|
onEvaluateJS: function WCA_onEvaluateJS(aRequest)
|
|
|
|
{
|
|
|
|
let input = aRequest.text;
|
2013-03-30 04:31:10 -07:00
|
|
|
let timestamp = Date.now();
|
2012-09-26 10:02:04 -07:00
|
|
|
|
2013-03-30 04:31:10 -07:00
|
|
|
let evalOptions = {
|
|
|
|
bindObjectActor: aRequest.bindObjectActor,
|
|
|
|
frameActor: aRequest.frameActor,
|
2013-07-23 09:58:27 -07:00
|
|
|
url: aRequest.url,
|
2014-07-31 10:07:27 -07:00
|
|
|
selectedNodeActor: aRequest.selectedNodeActor,
|
2015-10-23 14:04:29 -07:00
|
|
|
selectedObjectActor: aRequest.selectedObjectActor,
|
2013-03-30 04:31:10 -07:00
|
|
|
};
|
2014-07-31 10:07:27 -07:00
|
|
|
|
2013-03-30 04:31:10 -07:00
|
|
|
let evalInfo = this.evalWithDebugger(input, evalOptions);
|
|
|
|
let evalResult = evalInfo.result;
|
2013-05-09 08:20:51 -07:00
|
|
|
let helperResult = evalInfo.helperResult;
|
2013-03-30 04:31:10 -07:00
|
|
|
|
2013-11-01 09:03:30 -07:00
|
|
|
let result, errorMessage, errorGrip = null;
|
2013-03-30 04:31:10 -07:00
|
|
|
if (evalResult) {
|
|
|
|
if ("return" in evalResult) {
|
|
|
|
result = evalResult.return;
|
2015-06-15 11:22:00 -07:00
|
|
|
} else if ("yield" in evalResult) {
|
2013-03-30 04:31:10 -07:00
|
|
|
result = evalResult.yield;
|
2015-06-15 11:22:00 -07:00
|
|
|
} else if ("throw" in evalResult) {
|
2013-11-01 09:03:30 -07:00
|
|
|
let error = evalResult.throw;
|
|
|
|
errorGrip = this.createValueGrip(error);
|
2015-10-26 09:13:11 -07:00
|
|
|
// XXXworkers: Calling unsafeDereference() returns an object with no
|
|
|
|
// toString method in workers. See Bug 1215120.
|
|
|
|
let unsafeDereference = error && (typeof error === "object") &&
|
|
|
|
error.unsafeDereference();
|
|
|
|
errorMessage = unsafeDereference && unsafeDereference.toString
|
|
|
|
? unsafeDereference.toString()
|
2015-06-15 11:22:00 -07:00
|
|
|
: "" + error;
|
2013-03-30 04:31:10 -07:00
|
|
|
}
|
2012-09-26 10:02:04 -07:00
|
|
|
}
|
|
|
|
|
2014-07-21 06:06:02 -07:00
|
|
|
// If a value is encountered that the debugger server doesn't support yet,
|
|
|
|
// the console should remain functional.
|
|
|
|
let resultGrip;
|
|
|
|
try {
|
|
|
|
resultGrip = this.createValueGrip(result);
|
|
|
|
} catch (e) {
|
|
|
|
errorMessage = e;
|
|
|
|
}
|
|
|
|
|
2015-03-27 07:28:19 -07:00
|
|
|
this._lastConsoleInputEvaluation = result;
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
input: input,
|
2014-07-21 06:06:02 -07:00
|
|
|
result: resultGrip,
|
2012-09-26 10:02:04 -07:00
|
|
|
timestamp: timestamp,
|
2013-11-01 09:03:30 -07:00
|
|
|
exception: errorGrip,
|
2014-11-14 02:05:00 -08:00
|
|
|
exceptionMessage: this._createStringGrip(errorMessage),
|
2012-09-26 10:02:04 -07:00
|
|
|
helperResult: helperResult,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Autocomplete request handler.
|
|
|
|
*
|
|
|
|
* @param object aRequest
|
|
|
|
* The request message - what input to autocomplete.
|
|
|
|
* @return object
|
|
|
|
* The response message - matched properties.
|
|
|
|
*/
|
|
|
|
onAutocomplete: function WCA_onAutocomplete(aRequest)
|
|
|
|
{
|
2013-11-26 10:42:02 -08:00
|
|
|
let frameActorId = aRequest.frameActor;
|
|
|
|
let dbgObject = null;
|
|
|
|
let environment = null;
|
2015-12-03 11:35:33 -08:00
|
|
|
let hadDebuggee = false;
|
2013-11-26 10:42:02 -08:00
|
|
|
|
|
|
|
// This is the case of the paused debugger
|
|
|
|
if (frameActorId) {
|
|
|
|
let frameActor = this.conn.getActor(frameActorId);
|
|
|
|
if (frameActor) {
|
|
|
|
let frame = frameActor.frame;
|
|
|
|
environment = frame.environment;
|
|
|
|
}
|
|
|
|
else {
|
2015-10-26 09:13:11 -07:00
|
|
|
DevToolsUtils.reportException("onAutocomplete",
|
|
|
|
Error("The frame actor was not found: " + frameActorId));
|
2013-11-26 10:42:02 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// This is the general case (non-paused debugger)
|
|
|
|
else {
|
2015-12-03 11:35:33 -08:00
|
|
|
hadDebuggee = this.dbg.hasDebuggee(this.evalWindow);
|
|
|
|
dbgObject = this.dbg.addDebuggee(this.evalWindow);
|
2013-11-26 10:42:02 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
let result = JSPropertyProvider(dbgObject, environment, aRequest.text,
|
|
|
|
aRequest.cursor, frameActorId) || {};
|
2015-12-03 11:35:33 -08:00
|
|
|
|
|
|
|
if (!hadDebuggee && dbgObject) {
|
|
|
|
this.dbg.removeDebuggee(this.evalWindow);
|
|
|
|
}
|
|
|
|
|
2013-07-27 01:44:00 -07:00
|
|
|
let matches = result.matches || [];
|
|
|
|
let reqText = aRequest.text.substr(0, aRequest.cursor);
|
|
|
|
|
|
|
|
// We consider '$' as alphanumerc because it is used in the names of some
|
|
|
|
// helper functions.
|
|
|
|
let lastNonAlphaIsDot = /[.][a-zA-Z0-9$]*$/.test(reqText);
|
|
|
|
if (!lastNonAlphaIsDot) {
|
2015-04-06 06:41:00 -07:00
|
|
|
if (!this._webConsoleCommandsCache) {
|
2013-11-26 10:42:02 -08:00
|
|
|
let helpers = {
|
|
|
|
sandbox: Object.create(null)
|
|
|
|
};
|
2015-04-06 06:41:00 -07:00
|
|
|
addWebConsoleCommands(helpers);
|
|
|
|
this._webConsoleCommandsCache =
|
|
|
|
Object.getOwnPropertyNames(helpers.sandbox);
|
2013-11-26 10:42:02 -08:00
|
|
|
}
|
2015-04-06 06:41:00 -07:00
|
|
|
matches = matches.concat(this._webConsoleCommandsCache
|
|
|
|
.filter(n => n.startsWith(result.matchProp)));
|
2013-07-27 01:44:00 -07:00
|
|
|
}
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
return {
|
|
|
|
from: this.actorID,
|
2013-07-27 01:44:00 -07:00
|
|
|
matches: matches.sort(),
|
2012-09-26 10:02:04 -07:00
|
|
|
matchProp: result.matchProp,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The "clearMessagesCache" request handler.
|
|
|
|
*/
|
|
|
|
onClearMessagesCache: function WCA_onClearMessagesCache()
|
|
|
|
{
|
|
|
|
// TODO: Bug 717611 - Web Console clear button does not clear cached errors
|
2013-08-01 01:51:24 -07:00
|
|
|
let windowId = !this.parentActor.isRootActor ?
|
2012-10-06 03:29:57 -07:00
|
|
|
WebConsoleUtils.getInnerWindowId(this.window) : null;
|
2014-02-27 15:38:54 -08:00
|
|
|
let ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"]
|
|
|
|
.getService(Ci.nsIConsoleAPIStorage);
|
2012-09-26 10:02:04 -07:00
|
|
|
ConsoleAPIStorage.clearEvents(windowId);
|
2014-02-27 15:38:54 -08:00
|
|
|
|
2015-04-26 01:37:59 -07:00
|
|
|
CONSOLE_WORKER_IDS.forEach((aId) => {
|
|
|
|
ConsoleAPIStorage.clearEvents(aId);
|
|
|
|
});
|
|
|
|
|
2013-08-01 01:51:24 -07:00
|
|
|
if (this.parentActor.isRootActor) {
|
2013-05-28 08:24:31 -07:00
|
|
|
Services.console.logStringMessage(null); // for the Error Console
|
|
|
|
Services.console.reset();
|
|
|
|
}
|
2012-09-26 10:02:04 -07:00
|
|
|
return {};
|
|
|
|
},
|
|
|
|
|
2013-06-26 13:35:39 -07:00
|
|
|
/**
|
|
|
|
* The "getPreferences" request handler.
|
|
|
|
*
|
|
|
|
* @param object aRequest
|
|
|
|
* The request message - which preferences need to be retrieved.
|
|
|
|
* @return object
|
|
|
|
* The response message - a { key: value } object map.
|
|
|
|
*/
|
|
|
|
onGetPreferences: function WCA_onGetPreferences(aRequest)
|
|
|
|
{
|
|
|
|
let prefs = Object.create(null);
|
|
|
|
for (let key of aRequest.preferences) {
|
|
|
|
prefs[key] = !!this._prefs[key];
|
|
|
|
}
|
|
|
|
return { preferences: prefs };
|
|
|
|
},
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
/**
|
|
|
|
* The "setPreferences" request handler.
|
|
|
|
*
|
|
|
|
* @param object aRequest
|
|
|
|
* The request message - which preferences need to be updated.
|
|
|
|
*/
|
|
|
|
onSetPreferences: function WCA_onSetPreferences(aRequest)
|
|
|
|
{
|
|
|
|
for (let key in aRequest.preferences) {
|
|
|
|
this._prefs[key] = aRequest.preferences[key];
|
2014-03-10 11:57:27 -07:00
|
|
|
|
|
|
|
if (key == "NetworkMonitor.saveRequestAndResponseBodies" &&
|
|
|
|
this.networkMonitor) {
|
|
|
|
this.networkMonitor.saveRequestAndResponseBodies = this._prefs[key];
|
2016-01-20 14:09:25 -08:00
|
|
|
if (this.networkMonitorChild) {
|
|
|
|
this.networkMonitorChild.saveRequestAndResponseBodies = this._prefs[key];
|
|
|
|
}
|
2014-03-10 11:57:27 -07:00
|
|
|
}
|
2012-10-05 04:54:43 -07:00
|
|
|
}
|
|
|
|
return { updated: Object.keys(aRequest.preferences) };
|
|
|
|
},
|
|
|
|
|
|
|
|
//////////////////
|
|
|
|
// End of request handlers.
|
|
|
|
//////////////////
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
/**
|
2013-05-09 08:20:51 -07:00
|
|
|
* Create an object with the API we expose to the Web Console during
|
|
|
|
* JavaScript evaluation.
|
2013-03-30 04:31:10 -07:00
|
|
|
* This object inherits properties and methods from the Web Console actor.
|
2012-09-26 10:02:04 -07:00
|
|
|
*
|
2013-03-30 04:31:10 -07:00
|
|
|
* @private
|
2013-05-09 08:20:51 -07:00
|
|
|
* @param object aDebuggerGlobal
|
2013-03-30 04:31:10 -07:00
|
|
|
* A Debugger.Object that wraps a content global. This is used for the
|
2015-04-06 06:41:00 -07:00
|
|
|
* Web Console Commands.
|
2013-03-30 04:31:10 -07:00
|
|
|
* @return object
|
2013-05-09 08:20:51 -07:00
|
|
|
* The same object as |this|, but with an added |sandbox| property.
|
|
|
|
* The sandbox holds methods and properties that can be used as
|
|
|
|
* bindings during JS evaluation.
|
2012-09-26 10:02:04 -07:00
|
|
|
*/
|
2015-04-06 06:41:00 -07:00
|
|
|
_getWebConsoleCommands: function(aDebuggerGlobal)
|
2012-09-26 10:02:04 -07:00
|
|
|
{
|
2013-06-28 09:16:18 -07:00
|
|
|
let helpers = {
|
2014-02-25 12:02:58 -08:00
|
|
|
window: this.evalWindow,
|
2013-06-28 09:16:18 -07:00
|
|
|
chromeWindow: this.chromeWindow.bind(this),
|
|
|
|
makeDebuggeeValue: aDebuggerGlobal.makeDebuggeeValue.bind(aDebuggerGlobal),
|
|
|
|
createValueGrip: this.createValueGrip.bind(this),
|
|
|
|
sandbox: Object.create(null),
|
|
|
|
helperResult: null,
|
2014-02-25 12:02:58 -08:00
|
|
|
consoleActor: this,
|
2013-06-28 09:16:18 -07:00
|
|
|
};
|
2015-04-06 06:41:00 -07:00
|
|
|
addWebConsoleCommands(helpers);
|
2013-03-30 04:31:10 -07:00
|
|
|
|
2014-09-03 13:02:36 -07:00
|
|
|
let evalWindow = this.evalWindow;
|
|
|
|
function maybeExport(obj, name) {
|
|
|
|
if (typeof obj[name] != "function") {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// By default, chrome-implemented functions that are exposed to content
|
|
|
|
// refuse to accept arguments that are cross-origin for the caller. This
|
|
|
|
// is generally the safe thing, but causes problems for certain console
|
|
|
|
// helpers like cd(), where we users sometimes want to pass a cross-origin
|
|
|
|
// window. To circumvent this restriction, we use exportFunction along
|
|
|
|
// with a special option designed for this purpose. See bug 1051224.
|
|
|
|
obj[name] =
|
|
|
|
Cu.exportFunction(obj[name], evalWindow, { allowCrossOriginArguments: true });
|
|
|
|
}
|
2013-03-30 04:31:10 -07:00
|
|
|
for (let name in helpers.sandbox) {
|
|
|
|
let desc = Object.getOwnPropertyDescriptor(helpers.sandbox, name);
|
2015-10-26 09:13:11 -07:00
|
|
|
|
|
|
|
// Workers don't have access to Cu so won't be able to exportFunction.
|
|
|
|
if (!isWorker) {
|
|
|
|
maybeExport(desc, 'get');
|
|
|
|
maybeExport(desc, 'set');
|
|
|
|
maybeExport(desc, 'value');
|
|
|
|
}
|
2014-09-03 13:02:36 -07:00
|
|
|
if (desc.value) {
|
|
|
|
// Make sure the helpers can be used during eval.
|
|
|
|
desc.value = aDebuggerGlobal.makeDebuggeeValue(desc.value);
|
2013-03-30 04:31:10 -07:00
|
|
|
}
|
2014-09-03 13:02:36 -07:00
|
|
|
Object.defineProperty(helpers.sandbox, name, desc);
|
2012-09-26 10:02:04 -07:00
|
|
|
}
|
2013-03-30 04:31:10 -07:00
|
|
|
return helpers;
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Evaluates a string using the debugger API.
|
|
|
|
*
|
2013-05-09 08:20:51 -07:00
|
|
|
* To allow the variables view to update properties from the Web Console we
|
2013-03-30 04:31:10 -07:00
|
|
|
* provide the "bindObjectActor" mechanism: the Web Console tells the
|
|
|
|
* ObjectActor ID for which it desires to evaluate an expression. The
|
|
|
|
* Debugger.Object pointed at by the actor ID is bound such that it is
|
2015-08-30 15:08:19 -07:00
|
|
|
* available during expression evaluation (executeInGlobalWithBindings()).
|
2013-03-30 04:31:10 -07:00
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* _self['foobar'] = 'test'
|
|
|
|
* where |_self| refers to the desired object.
|
|
|
|
*
|
|
|
|
* The |frameActor| property allows the Web Console client to provide the
|
|
|
|
* frame actor ID, such that the expression can be evaluated in the
|
|
|
|
* user-selected stack frame.
|
|
|
|
*
|
2013-05-09 08:20:51 -07:00
|
|
|
* For the above to work we need the debugger and the Web Console to share
|
2013-03-30 04:31:10 -07:00
|
|
|
* a connection, otherwise the Web Console actor will not find the frame
|
|
|
|
* actor.
|
|
|
|
*
|
|
|
|
* The Debugger.Frame comes from the jsdebugger's Debugger instance, which
|
|
|
|
* is different from the Web Console's Debugger instance. This means that
|
2015-04-06 06:41:00 -07:00
|
|
|
* for evaluation to work, we need to create a new instance for the Web
|
|
|
|
* Console Commands helpers - they need to be Debugger.Objects coming from the
|
|
|
|
* jsdebugger's Debugger instance.
|
2013-03-30 04:31:10 -07:00
|
|
|
*
|
2013-05-09 08:20:51 -07:00
|
|
|
* When |bindObjectActor| is used objects can come from different iframes,
|
|
|
|
* from different domains. To avoid permission-related errors when objects
|
|
|
|
* come from a different window, we also determine the object's own global,
|
|
|
|
* such that evaluation happens in the context of that global. This means that
|
|
|
|
* evaluation will happen in the object's iframe, rather than the top level
|
|
|
|
* window.
|
|
|
|
*
|
2013-03-30 04:31:10 -07:00
|
|
|
* @param string aString
|
|
|
|
* String to evaluate.
|
|
|
|
* @param object [aOptions]
|
|
|
|
* Options for evaluation:
|
|
|
|
* - bindObjectActor: the ObjectActor ID to use for evaluation.
|
|
|
|
* |evalWithBindings()| will be called with one additional binding:
|
|
|
|
* |_self| which will point to the Debugger.Object of the given
|
|
|
|
* ObjectActor.
|
2015-10-23 14:04:29 -07:00
|
|
|
* - selectedObjectActor: Like bindObjectActor, but executes with the
|
|
|
|
* top level window as the global.
|
2013-03-30 04:31:10 -07:00
|
|
|
* - frameActor: the FrameActor ID to use for evaluation. The given
|
|
|
|
* debugger frame is used for evaluation, instead of the global window.
|
2014-07-31 10:07:27 -07:00
|
|
|
* - selectedNodeActor: the NodeActor ID of the currently selected node
|
|
|
|
* in the Inspector (or null, if there is no selection). This is used
|
|
|
|
* for helper functions that make reference to the currently selected
|
|
|
|
* node, like $0.
|
2013-03-30 04:31:10 -07:00
|
|
|
* @return object
|
|
|
|
* An object that holds the following properties:
|
|
|
|
* - dbg: the debugger where the string was evaluated.
|
|
|
|
* - frame: (optional) the frame where the string was evaluated.
|
|
|
|
* - window: the Debugger.Object for the global where the string was
|
|
|
|
* evaluated.
|
|
|
|
* - result: the result of the evaluation.
|
2015-04-06 06:41:00 -07:00
|
|
|
* - helperResult: any result coming from a Web Console commands
|
|
|
|
* function.
|
2013-07-23 09:58:27 -07:00
|
|
|
* - url: the url to evaluate the script as. Defaults to
|
|
|
|
* "debugger eval code".
|
2013-03-30 04:31:10 -07:00
|
|
|
*/
|
|
|
|
evalWithDebugger: function WCA_evalWithDebugger(aString, aOptions = {})
|
|
|
|
{
|
2015-02-11 09:08:05 -08:00
|
|
|
let trimmedString = aString.trim();
|
2013-03-30 04:31:10 -07:00
|
|
|
// The help function needs to be easy to guess, so we make the () optional.
|
2015-02-11 09:08:05 -08:00
|
|
|
if (trimmedString == "help" || trimmedString == "?") {
|
2012-09-26 10:02:04 -07:00
|
|
|
aString = "help()";
|
|
|
|
}
|
|
|
|
|
2015-02-11 09:08:05 -08:00
|
|
|
// Add easter egg for console.mihai().
|
|
|
|
if (trimmedString == "console.mihai()" || trimmedString == "console.mihai();") {
|
|
|
|
aString = "\"http://incompleteness.me/blog/2015/02/09/console-dot-mihai/\"";
|
|
|
|
}
|
|
|
|
|
2013-06-28 09:16:18 -07:00
|
|
|
// Find the Debugger.Frame of the given FrameActor.
|
2013-03-30 04:31:10 -07:00
|
|
|
let frame = null, frameActor = null;
|
|
|
|
if (aOptions.frameActor) {
|
|
|
|
frameActor = this.conn.getActor(aOptions.frameActor);
|
|
|
|
if (frameActor) {
|
|
|
|
frame = frameActor.frame;
|
|
|
|
}
|
|
|
|
else {
|
2015-10-26 09:13:11 -07:00
|
|
|
DevToolsUtils.reportException("evalWithDebugger",
|
|
|
|
Error("The frame actor was not found: " + aOptions.frameActor));
|
2013-03-30 04:31:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-17 15:21:11 -07:00
|
|
|
// If we've been given a frame actor in whose scope we should evaluate the
|
|
|
|
// expression, be sure to use that frame's Debugger (that is, the JavaScript
|
|
|
|
// debugger's Debugger) for the whole operation, not the console's Debugger.
|
|
|
|
// (One Debugger will treat a different Debugger's Debugger.Object instances
|
|
|
|
// as ordinary objects, not as references to be followed, so mixing
|
|
|
|
// debuggers causes strange behaviors.)
|
|
|
|
let dbg = frame ? frameActor.threadActor.dbg : this.dbg;
|
2014-02-25 12:02:58 -08:00
|
|
|
let dbgWindow = dbg.makeGlobalObjectReference(this.evalWindow);
|
2013-09-17 15:21:11 -07:00
|
|
|
|
|
|
|
// If we have an object to bind to |_self|, create a Debugger.Object
|
|
|
|
// referring to that object, belonging to dbg.
|
|
|
|
let bindSelf = null;
|
2015-10-23 14:04:29 -07:00
|
|
|
if (aOptions.bindObjectActor || aOptions.selectedObjectActor) {
|
|
|
|
let objActor = this.getActorByID(aOptions.bindObjectActor ||
|
|
|
|
aOptions.selectedObjectActor);
|
2013-09-17 15:21:11 -07:00
|
|
|
if (objActor) {
|
|
|
|
let jsObj = objActor.obj.unsafeDereference();
|
|
|
|
// If we use the makeDebuggeeValue method of jsObj's own global, then
|
|
|
|
// we'll get a D.O that sees jsObj as viewed from its own compartment -
|
|
|
|
// that is, without wrappers. The evalWithBindings call will then wrap
|
|
|
|
// jsObj appropriately for the evaluation compartment.
|
|
|
|
let global = Cu.getGlobalForObject(jsObj);
|
2015-10-23 14:04:29 -07:00
|
|
|
let _dbgWindow = dbg.makeGlobalObjectReference(global);
|
2013-09-17 15:21:11 -07:00
|
|
|
bindSelf = dbgWindow.makeDebuggeeValue(jsObj);
|
2015-10-23 14:04:29 -07:00
|
|
|
|
|
|
|
if (aOptions.bindObjectActor) {
|
|
|
|
dbgWindow = _dbgWindow;
|
|
|
|
}
|
2013-05-09 08:20:51 -07:00
|
|
|
}
|
2013-06-28 09:16:18 -07:00
|
|
|
}
|
|
|
|
|
2015-04-06 06:41:00 -07:00
|
|
|
// Get the Web Console commands for the given debugger window.
|
|
|
|
let helpers = this._getWebConsoleCommands(dbgWindow);
|
2013-06-28 09:16:18 -07:00
|
|
|
let bindings = helpers.sandbox;
|
|
|
|
if (bindSelf) {
|
|
|
|
bindings._self = bindSelf;
|
|
|
|
}
|
|
|
|
|
2014-07-31 10:07:27 -07:00
|
|
|
if (aOptions.selectedNodeActor) {
|
|
|
|
let actor = this.conn.getActor(aOptions.selectedNodeActor);
|
|
|
|
if (actor) {
|
|
|
|
helpers.selectedNode = actor.rawNode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-28 09:16:18 -07:00
|
|
|
// Check if the Debugger.Frame or Debugger.Object for the global include
|
2015-04-06 06:41:00 -07:00
|
|
|
// $ or $$. We will not overwrite these functions with the Web Console
|
|
|
|
// commands.
|
2013-06-28 09:16:18 -07:00
|
|
|
let found$ = false, found$$ = false;
|
|
|
|
if (frame) {
|
|
|
|
let env = frame.environment;
|
|
|
|
if (env) {
|
|
|
|
found$ = !!env.find("$");
|
|
|
|
found$$ = !!env.find("$$");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
found$ = !!dbgWindow.getOwnPropertyDescriptor("$");
|
|
|
|
found$$ = !!dbgWindow.getOwnPropertyDescriptor("$$");
|
2013-03-30 04:31:10 -07:00
|
|
|
}
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
let $ = null, $$ = null;
|
2013-03-30 04:31:10 -07:00
|
|
|
if (found$) {
|
|
|
|
$ = bindings.$;
|
|
|
|
delete bindings.$;
|
|
|
|
}
|
|
|
|
if (found$$) {
|
|
|
|
$$ = bindings.$$;
|
|
|
|
delete bindings.$$;
|
|
|
|
}
|
2012-09-26 10:02:04 -07:00
|
|
|
|
2013-06-28 09:16:18 -07:00
|
|
|
// Ready to evaluate the string.
|
2013-03-30 04:31:10 -07:00
|
|
|
helpers.evalInput = aString;
|
|
|
|
|
2013-07-23 09:58:27 -07:00
|
|
|
let evalOptions;
|
|
|
|
if (typeof aOptions.url == "string") {
|
|
|
|
evalOptions = { url: aOptions.url };
|
|
|
|
}
|
|
|
|
|
2013-03-30 04:31:10 -07:00
|
|
|
let result;
|
|
|
|
if (frame) {
|
2013-07-23 09:58:27 -07:00
|
|
|
result = frame.evalWithBindings(aString, bindings, evalOptions);
|
2012-09-26 10:02:04 -07:00
|
|
|
}
|
2013-03-30 04:31:10 -07:00
|
|
|
else {
|
2015-08-30 15:08:19 -07:00
|
|
|
result = dbgWindow.executeInGlobalWithBindings(aString, bindings, evalOptions);
|
2012-09-26 10:02:04 -07:00
|
|
|
}
|
|
|
|
|
2013-05-09 08:20:51 -07:00
|
|
|
let helperResult = helpers.helperResult;
|
2013-03-30 04:31:10 -07:00
|
|
|
delete helpers.evalInput;
|
2013-05-09 08:20:51 -07:00
|
|
|
delete helpers.helperResult;
|
2014-07-31 10:07:27 -07:00
|
|
|
delete helpers.selectedNode;
|
2012-09-26 10:02:04 -07:00
|
|
|
|
|
|
|
if ($) {
|
2013-03-30 04:31:10 -07:00
|
|
|
bindings.$ = $;
|
2012-09-26 10:02:04 -07:00
|
|
|
}
|
|
|
|
if ($$) {
|
2013-03-30 04:31:10 -07:00
|
|
|
bindings.$$ = $$;
|
2012-09-26 10:02:04 -07:00
|
|
|
}
|
|
|
|
|
2013-03-30 04:31:10 -07:00
|
|
|
if (bindings._self) {
|
|
|
|
delete bindings._self;
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
result: result,
|
2013-05-09 08:20:51 -07:00
|
|
|
helperResult: helperResult,
|
2013-03-30 04:31:10 -07:00
|
|
|
dbg: dbg,
|
|
|
|
frame: frame,
|
|
|
|
window: dbgWindow,
|
|
|
|
};
|
2012-09-26 10:02:04 -07:00
|
|
|
},
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
//////////////////
|
|
|
|
// Event handlers for various listeners.
|
|
|
|
//////////////////
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
/**
|
2013-05-28 08:24:31 -07:00
|
|
|
* Handler for messages received from the ConsoleServiceListener. This method
|
|
|
|
* sends the nsIConsoleMessage to the remote Web Console client.
|
2012-09-26 10:07:57 -07:00
|
|
|
*
|
2013-05-28 08:24:31 -07:00
|
|
|
* @param nsIConsoleMessage aMessage
|
|
|
|
* The message we need to send to the client.
|
2012-09-26 10:07:57 -07:00
|
|
|
*/
|
2013-05-28 08:24:31 -07:00
|
|
|
onConsoleServiceMessage: function WCA_onConsoleServiceMessage(aMessage)
|
2012-09-26 10:07:57 -07:00
|
|
|
{
|
2013-05-28 08:24:31 -07:00
|
|
|
let packet;
|
|
|
|
if (aMessage instanceof Ci.nsIScriptError) {
|
|
|
|
packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "pageError",
|
|
|
|
pageError: this.preparePageErrorForRemote(aMessage),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "logMessage",
|
2013-06-04 08:47:39 -07:00
|
|
|
message: this._createStringGrip(aMessage.message),
|
2013-05-28 08:24:31 -07:00
|
|
|
timeStamp: aMessage.timeStamp,
|
|
|
|
};
|
|
|
|
}
|
2012-09-26 10:07:57 -07:00
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare an nsIScriptError to be sent to the client.
|
|
|
|
*
|
|
|
|
* @param nsIScriptError aPageError
|
|
|
|
* The page error we need to send to the client.
|
|
|
|
* @return object
|
|
|
|
* The object you can send to the remote client.
|
|
|
|
*/
|
|
|
|
preparePageErrorForRemote: function WCA_preparePageErrorForRemote(aPageError)
|
|
|
|
{
|
2015-09-08 09:48:38 -07:00
|
|
|
let stack = null;
|
|
|
|
// Convert stack objects to the JSON attributes expected by client code
|
|
|
|
if (aPageError.stack) {
|
|
|
|
stack = [];
|
|
|
|
let s = aPageError.stack;
|
|
|
|
while (s !== null) {
|
|
|
|
stack.push({
|
|
|
|
filename: s.source,
|
|
|
|
lineNumber: s.line,
|
|
|
|
columnNumber: s.column,
|
|
|
|
functionName: s.functionDisplayName
|
|
|
|
});
|
|
|
|
s = s.parent;
|
|
|
|
}
|
|
|
|
}
|
2013-06-23 04:35:22 -07:00
|
|
|
let lineText = aPageError.sourceLine;
|
|
|
|
if (lineText && lineText.length > DebuggerServer.LONG_STRING_INITIAL_LENGTH) {
|
|
|
|
lineText = lineText.substr(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH);
|
|
|
|
}
|
|
|
|
|
2012-09-26 10:07:57 -07:00
|
|
|
return {
|
2013-06-04 08:47:39 -07:00
|
|
|
errorMessage: this._createStringGrip(aPageError.errorMessage),
|
2012-09-26 10:07:57 -07:00
|
|
|
sourceName: aPageError.sourceName,
|
2013-06-23 04:35:22 -07:00
|
|
|
lineText: lineText,
|
2012-09-26 10:07:57 -07:00
|
|
|
lineNumber: aPageError.lineNumber,
|
|
|
|
columnNumber: aPageError.columnNumber,
|
|
|
|
category: aPageError.category,
|
|
|
|
timeStamp: aPageError.timeStamp,
|
|
|
|
warning: !!(aPageError.flags & aPageError.warningFlag),
|
|
|
|
error: !!(aPageError.flags & aPageError.errorFlag),
|
|
|
|
exception: !!(aPageError.flags & aPageError.exceptionFlag),
|
|
|
|
strict: !!(aPageError.flags & aPageError.strictFlag),
|
2015-04-27 23:39:47 -07:00
|
|
|
info: !!(aPageError.flags & aPageError.infoFlag),
|
2013-05-25 02:25:36 -07:00
|
|
|
private: aPageError.isFromPrivateWindow,
|
2015-09-08 09:48:38 -07:00
|
|
|
stacktrace: stack
|
2012-09-26 10:07:57 -07:00
|
|
|
};
|
|
|
|
},
|
2012-09-26 10:02:04 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handler for window.console API calls received from the ConsoleAPIListener.
|
|
|
|
* This method sends the object to the remote Web Console client.
|
|
|
|
*
|
2012-10-05 04:54:43 -07:00
|
|
|
* @see ConsoleAPIListener
|
2012-09-26 10:02:04 -07:00
|
|
|
* @param object aMessage
|
|
|
|
* The console API call we need to send to the remote client.
|
|
|
|
*/
|
|
|
|
onConsoleAPICall: function WCA_onConsoleAPICall(aMessage)
|
|
|
|
{
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "consoleAPICall",
|
|
|
|
message: this.prepareConsoleMessageForRemote(aMessage),
|
|
|
|
};
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
/**
|
|
|
|
* Handler for network events. This method is invoked when a new network event
|
|
|
|
* is about to be recorded.
|
|
|
|
*
|
|
|
|
* @see NetworkEventActor
|
2013-08-03 03:29:48 -07:00
|
|
|
* @see NetworkMonitor from webconsole/utils.js
|
2012-10-05 04:54:43 -07:00
|
|
|
*
|
|
|
|
* @param object aEvent
|
|
|
|
* The initial network request event information.
|
2014-03-10 11:57:27 -07:00
|
|
|
* @param nsIHttpChannel aChannel
|
|
|
|
* The network request nsIHttpChannel object.
|
2012-10-05 04:54:43 -07:00
|
|
|
* @return object
|
|
|
|
* A new NetworkEventActor is returned. This is used for tracking the
|
|
|
|
* network request and response.
|
|
|
|
*/
|
2013-06-26 02:09:59 -07:00
|
|
|
onNetworkEvent: function WCA_onNetworkEvent(aEvent, aChannel)
|
2012-10-05 04:54:43 -07:00
|
|
|
{
|
2013-06-26 02:09:59 -07:00
|
|
|
let actor = this.getNetworkEventActor(aChannel);
|
|
|
|
actor.init(aEvent);
|
2012-10-05 04:54:43 -07:00
|
|
|
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "networkEvent",
|
2015-04-24 11:57:00 -07:00
|
|
|
eventActor: actor.grip()
|
2012-10-05 04:54:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
|
|
|
|
return actor;
|
|
|
|
},
|
|
|
|
|
2013-06-26 02:09:59 -07:00
|
|
|
/**
|
|
|
|
* Get the NetworkEventActor for a nsIChannel, if it exists,
|
|
|
|
* otherwise create a new one.
|
|
|
|
*
|
2014-03-10 11:57:27 -07:00
|
|
|
* @param nsIHttpChannel aChannel
|
2013-06-26 02:09:59 -07:00
|
|
|
* The channel for the network event.
|
2014-03-10 11:57:27 -07:00
|
|
|
* @return object
|
|
|
|
* The NetworkEventActor for the given channel.
|
2013-06-26 02:09:59 -07:00
|
|
|
*/
|
|
|
|
getNetworkEventActor: function WCA_getNetworkEventActor(aChannel) {
|
|
|
|
let actor = this._netEvents.get(aChannel);
|
|
|
|
if (actor) {
|
|
|
|
// delete from map as we should only need to do this check once
|
|
|
|
this._netEvents.delete(aChannel);
|
|
|
|
actor.channel = null;
|
|
|
|
return actor;
|
|
|
|
}
|
|
|
|
|
|
|
|
actor = new NetworkEventActor(aChannel, this);
|
|
|
|
this._actorPool.addActor(actor);
|
|
|
|
return actor;
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send a new HTTP request from the target's window.
|
|
|
|
*
|
|
|
|
* @param object aMessage
|
|
|
|
* Object with 'request' - the HTTP request details.
|
|
|
|
*/
|
|
|
|
onSendHTTPRequest: function WCA_onSendHTTPRequest(aMessage)
|
|
|
|
{
|
|
|
|
let details = aMessage.request;
|
|
|
|
|
|
|
|
// send request from target's window
|
2013-08-01 01:51:24 -07:00
|
|
|
let request = new this.window.XMLHttpRequest();
|
2013-06-26 02:09:59 -07:00
|
|
|
request.open(details.method, details.url, true);
|
|
|
|
|
|
|
|
for (let {name, value} of details.headers) {
|
|
|
|
request.setRequestHeader(name, value);
|
|
|
|
}
|
|
|
|
request.send(details.body);
|
|
|
|
|
|
|
|
let actor = this.getNetworkEventActor(request.channel);
|
|
|
|
|
|
|
|
// map channel to actor so we can associate future events with it
|
|
|
|
this._netEvents.set(request.channel, actor);
|
|
|
|
|
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
eventActor: actor.grip()
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
/**
|
|
|
|
* Handler for file activity. This method sends the file request information
|
|
|
|
* to the remote Web Console client.
|
|
|
|
*
|
|
|
|
* @see ConsoleProgressListener
|
|
|
|
* @param string aFileURI
|
|
|
|
* The requested file URI.
|
|
|
|
*/
|
|
|
|
onFileActivity: function WCA_onFileActivity(aFileURI)
|
|
|
|
{
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "fileActivity",
|
|
|
|
uri: aFileURI,
|
|
|
|
};
|
|
|
|
this.conn.send(packet);
|
2013-10-22 00:43:00 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handler for reflow activity. This method forwards reflow events to the
|
|
|
|
* remote Web Console client.
|
|
|
|
*
|
|
|
|
* @see ConsoleReflowListener
|
|
|
|
* @param Object aReflowInfo
|
|
|
|
*/
|
|
|
|
onReflowActivity: function WCA_onReflowActivity(aReflowInfo)
|
|
|
|
{
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "reflowActivity",
|
|
|
|
interruptible: aReflowInfo.interruptible,
|
|
|
|
start: aReflowInfo.start,
|
|
|
|
end: aReflowInfo.end,
|
|
|
|
sourceURL: aReflowInfo.sourceURL,
|
|
|
|
sourceLine: aReflowInfo.sourceLine,
|
|
|
|
functionName: aReflowInfo.functionName
|
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
2012-10-05 04:54:43 -07:00
|
|
|
},
|
|
|
|
|
2015-08-17 03:48:01 -07:00
|
|
|
/**
|
|
|
|
* Handler for server logging. This method forwards log events to the
|
|
|
|
* remote Web Console client.
|
|
|
|
*
|
|
|
|
* @see ServerLoggingListener
|
|
|
|
* @param object aMessage
|
|
|
|
* The console API call on the server we need to send to the remote client.
|
|
|
|
*/
|
|
|
|
onServerLogCall: function WCA_onServerLogCall(aMessage)
|
|
|
|
{
|
|
|
|
// Clone all data into the content scope (that's where
|
|
|
|
// passed arguments comes from).
|
|
|
|
let msg = Cu.cloneInto(aMessage, this.window);
|
|
|
|
|
|
|
|
// All arguments within the message need to be converted into
|
|
|
|
// debuggees to properly send it to the client side.
|
|
|
|
// Use the default target: this.window as the global object
|
|
|
|
// since that's the correct scope for data in the message.
|
|
|
|
// The 'false' argument passed into prepareConsoleMessageForRemote()
|
|
|
|
// ensures that makeDebuggeeValue uses content debuggee.
|
|
|
|
// See also:
|
|
|
|
// * makeDebuggeeValue()
|
|
|
|
// * prepareConsoleMessageForRemote()
|
|
|
|
msg = this.prepareConsoleMessageForRemote(msg, false);
|
|
|
|
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "serverLogCall",
|
|
|
|
message: msg,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
//////////////////
|
|
|
|
// End of event handlers for various listeners.
|
|
|
|
//////////////////
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
/**
|
|
|
|
* Prepare a message from the console API to be sent to the remote Web Console
|
|
|
|
* instance.
|
|
|
|
*
|
|
|
|
* @param object aMessage
|
|
|
|
* The original message received from console-api-log-event.
|
2015-08-17 03:48:01 -07:00
|
|
|
* @param boolean aUseObjectGlobal
|
|
|
|
* If |true| the object global is determined and added as a debuggee,
|
|
|
|
* otherwise |this.window| is used when makeDebuggeeValue() is invoked.
|
2012-09-26 10:02:04 -07:00
|
|
|
* @return object
|
|
|
|
* The object that can be sent to the remote client.
|
|
|
|
*/
|
|
|
|
prepareConsoleMessageForRemote:
|
2015-08-17 03:48:01 -07:00
|
|
|
function WCA_prepareConsoleMessageForRemote(aMessage, aUseObjectGlobal = true)
|
2012-09-26 10:02:04 -07:00
|
|
|
{
|
2013-01-15 06:02:25 -08:00
|
|
|
let result = WebConsoleUtils.cloneObject(aMessage);
|
2015-04-26 01:37:59 -07:00
|
|
|
|
2015-11-05 12:03:31 -08:00
|
|
|
result.workerType = WebConsoleUtils.getWorkerType(result) || "none";
|
2015-04-26 01:37:59 -07:00
|
|
|
|
2013-01-15 06:02:25 -08:00
|
|
|
delete result.wrappedJSObject;
|
2013-05-25 02:25:36 -07:00
|
|
|
delete result.ID;
|
|
|
|
delete result.innerID;
|
2014-05-01 08:36:01 -07:00
|
|
|
delete result.consoleID;
|
2013-01-15 06:02:25 -08:00
|
|
|
|
2013-05-09 08:20:51 -07:00
|
|
|
result.arguments = Array.map(aMessage.arguments || [], (aObj) => {
|
2015-08-17 03:48:01 -07:00
|
|
|
let dbgObj = this.makeDebuggeeValue(aObj, aUseObjectGlobal);
|
2013-05-09 08:20:51 -07:00
|
|
|
return this.createValueGrip(dbgObj);
|
|
|
|
});
|
2013-01-15 06:02:25 -08:00
|
|
|
|
2014-04-10 07:59:21 -07:00
|
|
|
result.styles = Array.map(aMessage.styles || [], (aString) => {
|
|
|
|
return this.createValueGrip(aString);
|
|
|
|
});
|
|
|
|
|
2015-08-17 03:48:01 -07:00
|
|
|
result.category = aMessage.category || "webdev";
|
|
|
|
|
2012-09-26 10:02:04 -07:00
|
|
|
return result;
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Find the XUL window that owns the content window.
|
|
|
|
*
|
|
|
|
* @return Window
|
|
|
|
* The XUL window that owns the content window.
|
|
|
|
*/
|
|
|
|
chromeWindow: function WCA_chromeWindow()
|
|
|
|
{
|
2013-03-30 04:31:10 -07:00
|
|
|
let window = null;
|
|
|
|
try {
|
|
|
|
window = this.window.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
|
|
.getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShell)
|
|
|
|
.chromeEventHandler.ownerDocument.defaultView;
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
// The above can fail because chromeEventHandler is not available for all
|
|
|
|
// kinds of |this.window|.
|
|
|
|
}
|
|
|
|
|
|
|
|
return window;
|
2012-09-26 10:02:04 -07:00
|
|
|
},
|
2013-05-09 08:20:51 -07:00
|
|
|
|
|
|
|
/**
|
2013-09-17 15:21:11 -07:00
|
|
|
* Notification observer for the "last-pb-context-exited" topic.
|
2013-05-09 08:20:51 -07:00
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @param object aSubject
|
|
|
|
* Notification subject - in this case it is the inner window ID that
|
|
|
|
* was destroyed.
|
2013-05-25 02:25:36 -07:00
|
|
|
* @param string aTopic
|
|
|
|
* Notification topic.
|
2013-05-09 08:20:51 -07:00
|
|
|
*/
|
2013-05-25 02:25:36 -07:00
|
|
|
_onObserverNotification: function WCA__onObserverNotification(aSubject, aTopic)
|
2013-05-09 08:20:51 -07:00
|
|
|
{
|
2013-05-25 02:25:36 -07:00
|
|
|
switch (aTopic) {
|
|
|
|
case "last-pb-context-exited":
|
|
|
|
this.conn.send({
|
|
|
|
from: this.actorID,
|
|
|
|
type: "lastPrivateContextExited",
|
|
|
|
});
|
|
|
|
break;
|
2013-05-09 08:20:51 -07:00
|
|
|
}
|
2014-02-25 12:02:58 -08:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The "will-navigate" progress listener. This is used to clear the current
|
|
|
|
* eval scope.
|
|
|
|
*/
|
2014-04-22 11:17:30 -07:00
|
|
|
_onWillNavigate: function WCA__onWillNavigate({ window, isTopLevel })
|
2014-02-25 12:02:58 -08:00
|
|
|
{
|
2014-04-22 11:17:30 -07:00
|
|
|
if (isTopLevel) {
|
|
|
|
this._evalWindow = null;
|
|
|
|
events.off(this.parentActor, "will-navigate", this._onWillNavigate);
|
|
|
|
this._progressListenerActive = false;
|
|
|
|
}
|
2014-02-25 12:02:58 -08:00
|
|
|
},
|
2014-08-27 03:19:30 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This listener is called when we switch to another frame,
|
|
|
|
* mostly to unregister previous listeners and start listening on the new document.
|
|
|
|
*/
|
|
|
|
_onChangedToplevelDocument: function WCA__onChangedToplevelDocument()
|
|
|
|
{
|
|
|
|
// Convert the Set to an Array
|
|
|
|
let listeners = [...this._listeners];
|
|
|
|
|
|
|
|
// Unregister existing listener on the previous document
|
|
|
|
// (pass a copy of the array as it will shift from it)
|
|
|
|
this.onStopListeners({listeners: listeners.slice()});
|
|
|
|
|
|
|
|
// This method is called after this.window is changed,
|
|
|
|
// so we register new listener on this new window
|
|
|
|
this.onStartListeners({listeners: listeners});
|
2015-03-03 20:47:00 -08:00
|
|
|
|
|
|
|
// Also reset the cached top level chrome window being targeted
|
|
|
|
this._lastChromeWindow = null;
|
2014-08-27 03:19:30 -07:00
|
|
|
},
|
2012-09-26 10:07:57 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
WebConsoleActor.prototype.requestTypes =
|
|
|
|
{
|
|
|
|
startListeners: WebConsoleActor.prototype.onStartListeners,
|
|
|
|
stopListeners: WebConsoleActor.prototype.onStopListeners,
|
2012-09-26 10:02:04 -07:00
|
|
|
getCachedMessages: WebConsoleActor.prototype.onGetCachedMessages,
|
|
|
|
evaluateJS: WebConsoleActor.prototype.onEvaluateJS,
|
2014-12-16 17:18:26 -08:00
|
|
|
evaluateJSAsync: WebConsoleActor.prototype.onEvaluateJSAsync,
|
2012-09-26 10:02:04 -07:00
|
|
|
autocomplete: WebConsoleActor.prototype.onAutocomplete,
|
|
|
|
clearMessagesCache: WebConsoleActor.prototype.onClearMessagesCache,
|
2013-06-26 13:35:39 -07:00
|
|
|
getPreferences: WebConsoleActor.prototype.onGetPreferences,
|
2012-10-05 04:54:43 -07:00
|
|
|
setPreferences: WebConsoleActor.prototype.onSetPreferences,
|
2013-06-26 02:09:59 -07:00
|
|
|
sendHTTPRequest: WebConsoleActor.prototype.onSendHTTPRequest
|
2012-09-26 10:02:04 -07:00
|
|
|
};
|
|
|
|
|
2014-09-16 03:00:00 -07:00
|
|
|
exports.WebConsoleActor = WebConsoleActor;
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
/**
|
|
|
|
* Creates an actor for a network event.
|
|
|
|
*
|
|
|
|
* @constructor
|
2013-06-26 02:09:59 -07:00
|
|
|
* @param object aChannel
|
|
|
|
* The nsIChannel associated with this event.
|
2012-10-05 04:54:43 -07:00
|
|
|
* @param object aWebConsoleActor
|
|
|
|
* The parent WebConsoleActor instance for this object.
|
|
|
|
*/
|
2013-06-26 02:09:59 -07:00
|
|
|
function NetworkEventActor(aChannel, aWebConsoleActor)
|
2012-10-05 04:54:43 -07:00
|
|
|
{
|
|
|
|
this.parent = aWebConsoleActor;
|
|
|
|
this.conn = this.parent.conn;
|
2013-06-26 02:09:59 -07:00
|
|
|
this.channel = aChannel;
|
2012-10-05 04:54:43 -07:00
|
|
|
|
|
|
|
this._request = {
|
2013-06-26 02:09:59 -07:00
|
|
|
method: null,
|
|
|
|
url: null,
|
|
|
|
httpVersion: null,
|
2012-10-05 04:54:43 -07:00
|
|
|
headers: [],
|
|
|
|
cookies: [],
|
2013-06-26 02:09:59 -07:00
|
|
|
headersSize: null,
|
2012-10-05 04:54:43 -07:00
|
|
|
postData: {},
|
|
|
|
};
|
|
|
|
|
|
|
|
this._response = {
|
|
|
|
headers: [],
|
|
|
|
cookies: [],
|
|
|
|
content: {},
|
|
|
|
};
|
|
|
|
|
|
|
|
this._timings = {};
|
2013-06-04 08:47:39 -07:00
|
|
|
|
|
|
|
// Keep track of LongStringActors owned by this NetworkEventActor.
|
2012-11-05 08:41:59 -08:00
|
|
|
this._longStringActors = new Set();
|
2012-10-05 04:54:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NetworkEventActor.prototype =
|
|
|
|
{
|
|
|
|
_request: null,
|
|
|
|
_response: null,
|
|
|
|
_timings: null,
|
2012-11-05 08:41:59 -08:00
|
|
|
_longStringActors: null,
|
2012-10-05 04:54:43 -07:00
|
|
|
|
|
|
|
actorPrefix: "netEvent",
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a grip for this actor for returning in a protocol message.
|
|
|
|
*/
|
|
|
|
grip: function NEA_grip()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
actor: this.actorID,
|
|
|
|
startedDateTime: this._startedDateTime,
|
2015-04-27 09:59:35 -07:00
|
|
|
timeStamp: Date.parse(this._startedDateTime),
|
2012-10-05 04:54:43 -07:00
|
|
|
url: this._request.url,
|
|
|
|
method: this._request.method,
|
2013-05-25 02:25:36 -07:00
|
|
|
isXHR: this._isXHR,
|
2015-04-24 11:57:00 -07:00
|
|
|
fromCache: this._fromCache,
|
2016-01-14 05:53:00 -08:00
|
|
|
fromServiceWorker: this._fromServiceWorker,
|
2013-05-25 02:25:36 -07:00
|
|
|
private: this._private,
|
2012-10-05 04:54:43 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Releases this actor from the pool.
|
|
|
|
*/
|
|
|
|
release: function NEA_release()
|
|
|
|
{
|
2012-11-05 08:41:59 -08:00
|
|
|
for (let grip of this._longStringActors) {
|
|
|
|
let actor = this.parent.getActorByID(grip.actor);
|
|
|
|
if (actor) {
|
|
|
|
this.parent.releaseActor(actor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this._longStringActors = new Set();
|
2013-06-26 02:09:59 -07:00
|
|
|
|
|
|
|
if (this.channel) {
|
|
|
|
this.parent._netEvents.delete(this.channel);
|
|
|
|
}
|
2012-11-05 08:41:59 -08:00
|
|
|
this.parent.releaseActor(this);
|
2012-10-05 04:54:43 -07:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle a protocol request to release a grip.
|
|
|
|
*/
|
|
|
|
onRelease: function NEA_onRelease()
|
|
|
|
{
|
|
|
|
this.release();
|
|
|
|
return {};
|
|
|
|
},
|
|
|
|
|
2013-06-26 02:09:59 -07:00
|
|
|
/**
|
|
|
|
* Set the properties of this actor based on it's corresponding
|
|
|
|
* network event.
|
|
|
|
*
|
|
|
|
* @param object aNetworkEvent
|
|
|
|
* The network event associated with this actor.
|
|
|
|
*/
|
|
|
|
init: function NEA_init(aNetworkEvent)
|
|
|
|
{
|
|
|
|
this._startedDateTime = aNetworkEvent.startedDateTime;
|
|
|
|
this._isXHR = aNetworkEvent.isXHR;
|
2015-04-24 11:57:00 -07:00
|
|
|
this._fromCache = aNetworkEvent.fromCache;
|
2016-01-14 05:53:00 -08:00
|
|
|
this._fromServiceWorker = aNetworkEvent.fromServiceWorker;
|
2013-06-26 02:09:59 -07:00
|
|
|
|
|
|
|
for (let prop of ['method', 'url', 'httpVersion', 'headersSize']) {
|
|
|
|
this._request[prop] = aNetworkEvent[prop];
|
|
|
|
}
|
|
|
|
|
|
|
|
this._discardRequestBody = aNetworkEvent.discardRequestBody;
|
|
|
|
this._discardResponseBody = aNetworkEvent.discardResponseBody;
|
|
|
|
this._private = aNetworkEvent.private;
|
|
|
|
},
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
/**
|
|
|
|
* The "getRequestHeaders" packet type handler.
|
|
|
|
*
|
|
|
|
* @return object
|
|
|
|
* The response packet - network request headers.
|
|
|
|
*/
|
|
|
|
onGetRequestHeaders: function NEA_onGetRequestHeaders()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
headers: this._request.headers,
|
|
|
|
headersSize: this._request.headersSize,
|
2015-02-11 04:49:32 -08:00
|
|
|
rawHeaders: this._request.rawHeaders,
|
2012-10-05 04:54:43 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The "getRequestCookies" packet type handler.
|
|
|
|
*
|
|
|
|
* @return object
|
|
|
|
* The response packet - network request cookies.
|
|
|
|
*/
|
|
|
|
onGetRequestCookies: function NEA_onGetRequestCookies()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
cookies: this._request.cookies,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The "getRequestPostData" packet type handler.
|
|
|
|
*
|
|
|
|
* @return object
|
|
|
|
* The response packet - network POST data.
|
|
|
|
*/
|
|
|
|
onGetRequestPostData: function NEA_onGetRequestPostData()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
postData: this._request.postData,
|
|
|
|
postDataDiscarded: this._discardRequestBody,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2015-01-05 16:58:00 -08:00
|
|
|
/**
|
|
|
|
* The "getSecurityInfo" packet type handler.
|
|
|
|
*
|
|
|
|
* @return object
|
|
|
|
* The response packet - connection security information.
|
|
|
|
*/
|
|
|
|
onGetSecurityInfo: function NEA_onGetSecurityInfo()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
securityInfo: this._securityInfo,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
/**
|
|
|
|
* The "getResponseHeaders" packet type handler.
|
|
|
|
*
|
|
|
|
* @return object
|
|
|
|
* The response packet - network response headers.
|
|
|
|
*/
|
|
|
|
onGetResponseHeaders: function NEA_onGetResponseHeaders()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
headers: this._response.headers,
|
|
|
|
headersSize: this._response.headersSize,
|
2015-02-11 04:49:32 -08:00
|
|
|
rawHeaders: this._response.rawHeaders,
|
2012-10-05 04:54:43 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The "getResponseCookies" packet type handler.
|
|
|
|
*
|
|
|
|
* @return object
|
|
|
|
* The response packet - network response cookies.
|
|
|
|
*/
|
|
|
|
onGetResponseCookies: function NEA_onGetResponseCookies()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
cookies: this._response.cookies,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The "getResponseContent" packet type handler.
|
|
|
|
*
|
|
|
|
* @return object
|
|
|
|
* The response packet - network response content.
|
|
|
|
*/
|
|
|
|
onGetResponseContent: function NEA_onGetResponseContent()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
content: this._response.content,
|
|
|
|
contentDiscarded: this._discardResponseBody,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The "getEventTimings" packet type handler.
|
|
|
|
*
|
|
|
|
* @return object
|
|
|
|
* The response packet - network event timings.
|
|
|
|
*/
|
|
|
|
onGetEventTimings: function NEA_onGetEventTimings()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
from: this.actorID,
|
|
|
|
timings: this._timings,
|
2015-04-24 11:57:00 -07:00
|
|
|
totalTime: this._totalTime
|
2012-10-05 04:54:43 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* Listeners for new network event data coming from NetworkMonitor.
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add network request headers.
|
|
|
|
*
|
|
|
|
* @param array aHeaders
|
|
|
|
* The request headers array.
|
2015-02-11 04:49:32 -08:00
|
|
|
* @param string aRawHeaders
|
|
|
|
* The raw headers source.
|
2012-10-05 04:54:43 -07:00
|
|
|
*/
|
2015-02-11 04:49:32 -08:00
|
|
|
addRequestHeaders: function NEA_addRequestHeaders(aHeaders, aRawHeaders)
|
2012-10-05 04:54:43 -07:00
|
|
|
{
|
|
|
|
this._request.headers = aHeaders;
|
2012-11-05 08:41:59 -08:00
|
|
|
this._prepareHeaders(aHeaders);
|
2012-10-05 04:54:43 -07:00
|
|
|
|
2015-02-11 04:49:32 -08:00
|
|
|
var rawHeaders = this.parent._createStringGrip(aRawHeaders);
|
|
|
|
if (typeof rawHeaders == "object") {
|
|
|
|
this._longStringActors.add(rawHeaders);
|
|
|
|
}
|
|
|
|
this._request.rawHeaders = rawHeaders;
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "networkEventUpdate",
|
|
|
|
updateType: "requestHeaders",
|
|
|
|
headers: aHeaders.length,
|
|
|
|
headersSize: this._request.headersSize,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add network request cookies.
|
|
|
|
*
|
|
|
|
* @param array aCookies
|
|
|
|
* The request cookies array.
|
|
|
|
*/
|
|
|
|
addRequestCookies: function NEA_addRequestCookies(aCookies)
|
|
|
|
{
|
|
|
|
this._request.cookies = aCookies;
|
2012-11-05 08:41:59 -08:00
|
|
|
this._prepareHeaders(aCookies);
|
2012-10-05 04:54:43 -07:00
|
|
|
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "networkEventUpdate",
|
|
|
|
updateType: "requestCookies",
|
|
|
|
cookies: aCookies.length,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add network request POST data.
|
|
|
|
*
|
|
|
|
* @param object aPostData
|
|
|
|
* The request POST data.
|
|
|
|
*/
|
|
|
|
addRequestPostData: function NEA_addRequestPostData(aPostData)
|
|
|
|
{
|
|
|
|
this._request.postData = aPostData;
|
2013-06-04 08:47:39 -07:00
|
|
|
aPostData.text = this.parent._createStringGrip(aPostData.text);
|
2012-11-05 08:41:59 -08:00
|
|
|
if (typeof aPostData.text == "object") {
|
|
|
|
this._longStringActors.add(aPostData.text);
|
|
|
|
}
|
2012-10-05 04:54:43 -07:00
|
|
|
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "networkEventUpdate",
|
|
|
|
updateType: "requestPostData",
|
|
|
|
dataSize: aPostData.text.length,
|
|
|
|
discardRequestBody: this._discardRequestBody,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add the initial network response information.
|
|
|
|
*
|
|
|
|
* @param object aInfo
|
|
|
|
* The response information.
|
2015-02-11 04:49:32 -08:00
|
|
|
* @param string aRawHeaders
|
|
|
|
* The raw headers source.
|
2012-10-05 04:54:43 -07:00
|
|
|
*/
|
2015-02-11 04:49:32 -08:00
|
|
|
addResponseStart: function NEA_addResponseStart(aInfo, aRawHeaders)
|
2012-10-05 04:54:43 -07:00
|
|
|
{
|
2015-02-11 04:49:32 -08:00
|
|
|
var rawHeaders = this.parent._createStringGrip(aRawHeaders);
|
|
|
|
if (typeof rawHeaders == "object") {
|
|
|
|
this._longStringActors.add(rawHeaders);
|
|
|
|
}
|
|
|
|
this._response.rawHeaders = rawHeaders;
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
this._response.httpVersion = aInfo.httpVersion;
|
|
|
|
this._response.status = aInfo.status;
|
|
|
|
this._response.statusText = aInfo.statusText;
|
|
|
|
this._response.headersSize = aInfo.headersSize;
|
|
|
|
this._discardResponseBody = aInfo.discardResponseBody;
|
|
|
|
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "networkEventUpdate",
|
|
|
|
updateType: "responseStart",
|
2015-04-24 11:57:00 -07:00
|
|
|
response: aInfo
|
2012-10-05 04:54:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
2015-01-05 16:58:00 -08:00
|
|
|
/**
|
|
|
|
* Add connection security information.
|
|
|
|
*
|
|
|
|
* @param object info
|
|
|
|
* The object containing security information.
|
|
|
|
*/
|
|
|
|
addSecurityInfo: function NEA_addSecurityInfo(info)
|
|
|
|
{
|
|
|
|
this._securityInfo = info;
|
|
|
|
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "networkEventUpdate",
|
|
|
|
updateType: "securityInfo",
|
|
|
|
state: info.state,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
2012-10-05 04:54:43 -07:00
|
|
|
/**
|
|
|
|
* Add network response headers.
|
|
|
|
*
|
|
|
|
* @param array aHeaders
|
|
|
|
* The response headers array.
|
|
|
|
*/
|
|
|
|
addResponseHeaders: function NEA_addResponseHeaders(aHeaders)
|
|
|
|
{
|
|
|
|
this._response.headers = aHeaders;
|
2012-11-05 08:41:59 -08:00
|
|
|
this._prepareHeaders(aHeaders);
|
2012-10-05 04:54:43 -07:00
|
|
|
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "networkEventUpdate",
|
|
|
|
updateType: "responseHeaders",
|
|
|
|
headers: aHeaders.length,
|
|
|
|
headersSize: this._response.headersSize,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add network response cookies.
|
|
|
|
*
|
|
|
|
* @param array aCookies
|
|
|
|
* The response cookies array.
|
|
|
|
*/
|
|
|
|
addResponseCookies: function NEA_addResponseCookies(aCookies)
|
|
|
|
{
|
|
|
|
this._response.cookies = aCookies;
|
2012-11-05 08:41:59 -08:00
|
|
|
this._prepareHeaders(aCookies);
|
2012-10-05 04:54:43 -07:00
|
|
|
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "networkEventUpdate",
|
|
|
|
updateType: "responseCookies",
|
|
|
|
cookies: aCookies.length,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add network response content.
|
|
|
|
*
|
|
|
|
* @param object aContent
|
|
|
|
* The response content.
|
|
|
|
* @param boolean aDiscardedResponseBody
|
|
|
|
* Tells if the response content was recorded or not.
|
|
|
|
*/
|
|
|
|
addResponseContent:
|
|
|
|
function NEA_addResponseContent(aContent, aDiscardedResponseBody)
|
|
|
|
{
|
|
|
|
this._response.content = aContent;
|
2013-06-04 08:47:39 -07:00
|
|
|
aContent.text = this.parent._createStringGrip(aContent.text);
|
2012-11-05 08:41:59 -08:00
|
|
|
if (typeof aContent.text == "object") {
|
|
|
|
this._longStringActors.add(aContent.text);
|
|
|
|
}
|
2012-10-05 04:54:43 -07:00
|
|
|
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "networkEventUpdate",
|
|
|
|
updateType: "responseContent",
|
|
|
|
mimeType: aContent.mimeType,
|
2015-10-28 11:40:23 -07:00
|
|
|
contentSize: aContent.size,
|
2015-11-09 04:46:12 -08:00
|
|
|
encoding: aContent.encoding,
|
2015-01-21 13:17:02 -08:00
|
|
|
transferredSize: aContent.transferredSize,
|
2012-10-05 04:54:43 -07:00
|
|
|
discardResponseBody: aDiscardedResponseBody,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add network event timing information.
|
|
|
|
*
|
|
|
|
* @param number aTotal
|
|
|
|
* The total time of the network event.
|
|
|
|
* @param object aTimings
|
|
|
|
* Timing details about the network event.
|
|
|
|
*/
|
|
|
|
addEventTimings: function NEA_addEventTimings(aTotal, aTimings)
|
|
|
|
{
|
|
|
|
this._totalTime = aTotal;
|
|
|
|
this._timings = aTimings;
|
|
|
|
|
|
|
|
let packet = {
|
|
|
|
from: this.actorID,
|
|
|
|
type: "networkEventUpdate",
|
|
|
|
updateType: "eventTimings",
|
2015-04-24 11:57:00 -07:00
|
|
|
totalTime: aTotal
|
2012-10-05 04:54:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
this.conn.send(packet);
|
|
|
|
},
|
2012-11-05 08:41:59 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare the headers array to be sent to the client by using the
|
|
|
|
* LongStringActor for the header values, when needed.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @param array aHeaders
|
|
|
|
*/
|
|
|
|
_prepareHeaders: function NEA__prepareHeaders(aHeaders)
|
|
|
|
{
|
|
|
|
for (let header of aHeaders) {
|
2013-06-04 08:47:39 -07:00
|
|
|
header.value = this.parent._createStringGrip(header.value);
|
2012-11-05 08:41:59 -08:00
|
|
|
if (typeof header.value == "object") {
|
|
|
|
this._longStringActors.add(header.value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2012-10-05 04:54:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
NetworkEventActor.prototype.requestTypes =
|
|
|
|
{
|
|
|
|
"release": NetworkEventActor.prototype.onRelease,
|
|
|
|
"getRequestHeaders": NetworkEventActor.prototype.onGetRequestHeaders,
|
|
|
|
"getRequestCookies": NetworkEventActor.prototype.onGetRequestCookies,
|
|
|
|
"getRequestPostData": NetworkEventActor.prototype.onGetRequestPostData,
|
|
|
|
"getResponseHeaders": NetworkEventActor.prototype.onGetResponseHeaders,
|
|
|
|
"getResponseCookies": NetworkEventActor.prototype.onGetResponseCookies,
|
|
|
|
"getResponseContent": NetworkEventActor.prototype.onGetResponseContent,
|
|
|
|
"getEventTimings": NetworkEventActor.prototype.onGetEventTimings,
|
2015-01-05 16:58:00 -08:00
|
|
|
"getSecurityInfo": NetworkEventActor.prototype.onGetSecurityInfo,
|
2012-10-05 04:54:43 -07:00
|
|
|
};
|