mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-27 04:51:16 +00:00
2b8d14ce6d
- Bug 1253137 - Baldr: update section header structure to match BinaryEncoding.md, part 2 (r=sunfish) (dbf52e6bb6)
- Bug 1253137 - Baldr: fix unknown-section handling (r=sunfish) (5f2ca84f1f)
- Bug 1253137 - Baldr: make all the section-ids match and remove c-string labels not in BinaryEncoding.md (r=sunfish) (87fbb4e5aa)
- Bug 1253137 - Baldr: move module generator constants back to WasmBinary.h (r=bustage) (b3a02a01d6)
- Bug 1246116: Wire BrTable in wasm and add a bunch of tests; r=sunfish (7b7002830e)
- Bug 1253115 - BaldrMonkey: Implement initial load/store offset support. r=luke (10944fb68b)
- Bug 1246116 - Baldr: remove two timeout tests until there is a good way to make them not fail on platforms without wasm (arm64) (r=red) (558235d951)
- Bug 1253142 - Remove the long-deprecated nsIMemory.isLowMemory function. r=froydnj. (b29cc3bbee)
- Bug 1253137 - Baldr: remove expected type from WasmIonCompile.cpp (r=sunfish) (36a0ee01fb)
- Bug 1253137 - Baldr: switch to bottom-up validation in Wasm.cpp (r=sunfish) (ee6cbfb6c2)
- Bug 1253137 - Baldr: switch from expression-count to function body byte size (r=sunfish) (16f85fd09e)
- Bug 1253137 - Baldr: move local definitions into the body (r=sunfish) (3cc8dc6f17)
- Bug 1253137 - Baldr: change wasmEvalText/Wasm.instantiateModule to return/take a typed array view instead of buffer (r=sunfish) (93288775ff)
- Bug 1253137 - Baldr: move ValType/ExprType into WasmBinary.h and tidy up WasmBinary.h (r=sunfish) (97e87b51c6)
- Bug 1246116 - Baldr: make the wasm br_table limit match asm.js (r=bbouvier) (a911172c39)
- Bug 1253115 - Ion: include asm.js load/store offset in GVN (r=sunfish) (6fe71cee89)
- Bug 1253884 - Baldr: fix parsing of (f32.const -0) (r=sunfish) (796e4e4e43)
- Bug 1253137 - Baldr: switch local array to local entry array (r=sunfish) (ca93aeb54b)
- Bug 1254984 - Experimental text representation of WebAssembly binary code (r=luke) (555507230b)
- Bug 1253137 - Baldr: pass around Bytes instead of Bytecode/UniqueBytecode (r=sunfish) (098db250ae)
- Bug 1253137 - Baldr: use length+bytes instead of c-strings (r=sunfish) (7aba9bc27c)
- Bug 1253137 - Baldr: switch {i32, i64}.const to SLEB128 (r=sunfish) (75b4235c40)
- Bug 1243488 - use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in uriloader/exthandler/; r=bz (086e0d94ac)
- Bug 1253137 - BalderMonkey: Define encodings for eqz, rotl, and rotr r=luke (df0751ca5e)
- Bug 1253137 - Baldr: add nop placeholder for branch values (r=sunfish) (ee4b8da1ce)
- Bug 1253137 - Baldr: put exports object onto .exports field of instance object (r=sunfish) (2d280c1bfa)
- Bug 1253137 - Baldr: add explicit function body count (r=sunfish) (6205d9cea2)
- Bug 1253137 - Baldr: update encoding of br_table branch targets (r=sunfish) (84e5ed54c0)
- Bug 1253137 - Baldr: update encoding of memory access immediates (r=sunfish) (e98f220129)
- Bug 1253137 - Baldr: switch from LEB128 to prefix-based scheme to match BinaryEncoding.md (r=sunfish) (0a909bfda8)
- Bug 1254893 - Keep a list of wasm::Modules per compartment. (r=terrence) (ebc9b55096)
- Bug 1254893 - Fire onNewScript for new wasm modules. (r=jimb) (f9cd6a4dac)
- Bug 1247126: Remove Debugger's tenure promotion log. r=fitzgen (10dd84a712)
- Bug 1239813: Ensure compartments don't get GC'd while Debugger.prototype.findScripts' ScriptQuery is holding them in its HashSet. r=sfink (7278791e79)
- Bug 1239813 - Add some asserts to IterateScripts to help us track down bug 1240231. r=sfink (fd49df43e8)
- Bug 1221378: Root Debuggers in js::Debugger::slowPathOnLogAllocationSite, in case logging causes a GC. r=fitzgen (f9a4dc94d9)
- Bug 1248162 - Clear pending exceptions when ignoring OOMs in Debugger::slowPathOnNewGlobalObject; r=jimb (4f54e5ecc2)
- Bug 1246215 - Console prevents let re-declaration even when first wasan error; r=jryans,shu (6b36a886c2)
- Bug 1246215 - Guard against passing non-atoms and non-property names to LookupProperty; r=evilpie (129cbe6144)
- Bug 1250190: Make DebuggeeWouldRun checks not assume we always unlock before re-locking. r=fitzgen (d0c740a1f5)
- Bug 1245877 - Expose error message names via the debugger object; r=jorendorff (1406d70c4d)
- Bug 1250520 - Handle reporting DebuggeeWouldRun when the script has no filename. (r=fitzgen) (47402fe973)
- Bug 1252453: make Debugger::slowPathOnLogAllocationSite apply a read barrier to Debugger objects. r=terrence (b46b7fe8a2)
- Bug 1254893 - Prep Debugger.Script for a tagged union referent. (r=jimb) (d6231c1aed)
- Bug 1254893 - Prep Debugger.Source for a tagged union referent. (r=jimb) (3209106a0f)
- Bug 1254893 - Synthesize Debugger.Scripts for wasm modules and find them via findScripts. (r=jimb) (225488fb00)
- Bug 1254893 - Display placeholder text for synthesized Debugger.Sources. (r=jimb) (f2099a40fd)
- Bug 1254453 - Support using Variant inside GC wrappers. (r=terrence) (0454cc6491)
- Bug 1254893 - Add a .format property on Debugger.Script. (r=jimb) (05a71ca78c)
- Bug 1254893 - Support wasm for most of the Debugger.Source properties. (r=jimb) (941075c666)
- Bug 1254893 - Append "> wasm" to URLs of wasm Debugger.Sources to hack around blacklisting in devtools. (r=jimb) (0a78f4294c)
- Bug 1254893 - Followup: read barrier wasm modules exposed via Debugger.findScript. (r=luke) (e329952674)
- Bug 1254893 - Update Debugger.Source docs. (r=jimb) (4a19e39364)
- Bug 1254893 - Update Debugger.Script docs. (r=jimb) (97186b2dfa)
- Bug 1254893 - Synthesize Debugger.Sources for wasm modules. (r=jimb) (ee9522479a)
- Bug 1254893 - Followup: fix awkward wording in Debugger.Source docs. DONTBUILD. (r=me) (b8734c7ac8)
- Bug 1254893 - Tests for perfunctory functionality of wasm Debugger.Scripts and Debugger.Sources. (r=jimb) (37308f45c4)
- Bug 1254893 - Connect wasm::BinaryToText with Debugger.Source (r=shu) (5c7918d178)
- Bug 1254893 - Change 'Experimental' to 'Temporary' in string and DONTBUILD (r=me) (78b018aea0)
- Bug 1243267 - Guard against reentrancy into the dispatch of a scroll event. r=mats (2da2136351)
- Bug 1254105 - Avoid passing magic values to the error reporter machinery in the ShortestPaths testing function; r=jimb (a8dcdf997d)
- Bug 1252912 - Ensure that we wrap the results of the shortestPaths JS shell testing function. r=jimb (8a19ebf0a3)
- Bug 1252432 part 4 - Implement wasm {f32,f64}.convert_{u,s}/i64 on x64. r=sunfish (1d3ad096b8)
- Bug 1256633 - Reject wasm i64 ops on platforms that don't support them yet. r=bbouvier (e0452420f2)
- Bug 1255772: Implement wasm::Unreachable; r=sunfish (67b40b287a)
- Bug 1254836 - Baldr: handle over-recursion in validator (r=bbouvier) (0b35cbccdf)
- Bug 1256480: Allow passing Float32 arguments to FFI on the stack; r=luke (c1bc3e06a7)
- Bug 1256956 - Silence some GCC warnings. r=luke. (eaeeddccd9)
- Bug 1245112 - Part 12: Move MacroAssembler::branchPtrWithPatch into generic macro assembler. r=nbp (6e99b92e92)
- Bug 1245112 - Part 13: Move MacroAssembler::branchPtrInNurseryRange into generic macro assembler. r=jonco (a09ecb3d7b)
- Bug 1245112 - Part 14: Move MacroAssembler::branchValueIsNurseryObject into generic macro assembler. r=jonco (f91b64eff4)
- Bug 1245112 - Part 15: Move MacroAssembler::branchAdd32 into generic macro assembler. r=lth (3179998ae2)
- Bug 1245112 - Part 16: Move MacroAssembler::branchSub32 into generic macro assembler. r=lth (0cdb5bbf74)
- Bug 1245112 - Part 17: Move MacroAssembler::decBranchPtr into generic macro assembler. r=nbp (5f9f615121)
- Bug 1245112 - Part 18: Move MacroAssembler::branchTestInt32 into generic macro assembler. r=jandem (d19625e026)
- Bug 1245112 - Part 19: Move MacroAssembler::branchTestInt32Truthy into generic macro assembler. r=jandem (18580b219d)
- Bug 1245112 - Part 18 followup: More refactor branchTestInt32. r=nbp (0cba5f769b)
- Bug 1245112 - Part 20: Move MacroAssembler::branchTestDouble into generic macro assembler. r=nbp (36e18c1990)
- Bug 1245112 - Part 21: Move MacroAssembler::branchTestDoubleTruthy into generic macro assembler. r=nbp (706fece6a2)
- Bug 1245112 - Part 22: Move MacroAssembler::branchTestNumber into generic macro assembler. r=bhackett (53a04401bc)
- Bug 1245112 - Part 23: Move MacroAssembler::branchTestBoolean into generic macro assembler. r=sstangl (80fd098bfc)
- Bug 1245112 - Part 24: Move MacroAssembler::branchTestBooleanTruthy into generic macro assembler. r=sstangl (b6c9773d6b)
- Bug 1245112 - Part 25: Move MacroAssembler::branchTestUndefined into generic macro assembler. r=sstangl (a0e87e7c07)
- Bug 1245112 - Part 26: Move MacroAssembler::branchTestString into generic macro assembler. r=sstangl (cb74d2a341)
- Bug 1245112 - Part 27: Move MacroAssembler::branchTestStringTruthy into generic macro assembler. r=sstangl (3f0846f961)
- Bug 1245112 - Part 28: Move MacroAssembler::branchTestSymbol into generic macro assembler. r=jorendorff (20bcf1f5f0)
- Bug 1245112 - Part 29: Move MacroAssembler::branchTestNull into generic macro assembler. r=sstangl (49795964c7)
- Bug 1245112 - Part 30: Move MacroAssembler::branchTestObject into generic macro assembler. r=sstangl (48536c8883)
- Bug 1245112 - Part 31: Move MacroAssembler::branchTestGCThing into generic macro assembler. r=jandem (d3cbbb7446)
- Bug 1245112 - Part 32: Move MacroAssembler::branchTestPrimitive into generic macro assembler. r=jandem (9a89167842)
- Bug 1245112 - Part 33: Move MacroAssembler::branchTestMagic into generic macro assembler. r=jandem (65a1847bc1)
- Bug 1245112 - Part 34: Move MacroAssembler::branchTestMagicValue into generic macro assembler. r=jandem (4772aa0d5c)
- Bug 1245112 - Part 35: Move MacroAssembler::branchTestValue into generic macro assembler. r=jandem (c8e417a332)
- Bug 1245112 - Part 36: Move MacroAssembler::branchPtrImpl into generic macro assembler. r=nbp (844d3c0b07)
- Bug 1248289 - Part 0: Change OrderedHashTable::Range::ht member from a reference to a pointer to use offsetof. r=sfink (4eae1c9dd6)
- Bug 1254808 - IonMonkey: Factor MacroAssembler::popReturnAddress on ARM. r=nbp (2cee710668)
- Bug 1252326: Flush the assembly buffer at the end of codegen for plateforms which need it; r=luke (2195910785)
- Bug 1255956: Check for OOM after flushing constant pools; r=luke (d5190f17f0)
- Bug 1249961 - Rename MacroAssembler::branchEqualTypeIfNeeded to MacroAssembler::maybeBranchTestType. r=nbp (8dc9347991)
- Bug 1249960 - Rename Int32Key to RegisterOrInt32Constant, branchKey to branch32, storeKey to store32, bumpKey to inc32 and dec32. r=nbp (f29d6f63a1)
- Bug 1248289 - Part 1: Inline _GetNextMapEntryForIterator intrinsic. r=jandem (ed1ef17167)
- Bug 1253877 - Baldr: print missing text labels in resolving phase (r=mbx) (aca747eaed)
- Bug 1255691: Implement Select; r=sunfish (5dfc79e866)
- Bug 1244414 - Create iframe element from script to avoid racing with the load event; r=bz (ba1ba93693)
- Bug 1241784 - Part 3: Test. r=birtles (f87f4aff69)
- Bug 1241784 - Part 1: Add a helper function for Element.animate(). r=birtles (8dfbda09e9)
- Bug 1241784 - Part 2: Implement CSSPseudoElement.animate(). r=birtles (e52ae76368)
- Bug 1241784 - Part 4: Remove removeElement from testcommon.js. r=birtles (a78d60ae3c)
- Bug 1238694 - Limit the number of asm.js/wasm code allocations to avoid running into Linux kernel limits. r=luke (2f27e29df6)
- Bug 1258320 - Fix jump target in CodeGenerator::visitGetNextMapEntryForIterator. r=jandem (35a52f67c6)
- Bug 1254376 - Add a read barrier to the global's debugger vector r=jimb (31712fa31d)
- Bug 1245860 - Remove Debugger.onIonCompilation Hook. r=shu (8584bd0547)
- Bug 1254092 - TraceIncomingCCWs should work at the JSCompartment level of granularity. r=jimb (f1fc5ea7fb)
- Bug 1257045 - Give Debugger wrappers of wasm code their own CCW key kinds. (r=jimb) (ff4817d32e)
- Bug 1255954 - Odin: move asserts so they only run on successful validation (r=bbouvier) (4d58c80c0b)
- Bug 837192 - Stop trying to inject "use strict"; into Function.prototype.toString() output. r=Waldo. (e58bac6110)
- Bug 1256291: Fix unified build under js/; r=Ms2ger (8ce81ec08f)
- Bug 1258346: Check for success in calls to append() in WasmBinaryToText: r=jorendorff (5e106e29bd)
- Bug 1107143 - Don't build event regions unless we're painting to the window. r=tnikkel (7880bda251)
- Bug 1252374 - Increase the chunk size of the displayListArena. r=roc. (ce9543e592)
619 lines
18 KiB
JavaScript
619 lines
18 KiB
JavaScript
/* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */
|
|
/* vim: set ft=javascript 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";
|
|
|
|
const {Cc, Ci, Cu} = require("chrome");
|
|
const DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
|
|
const EventEmitter = require("devtools/toolkit/event-emitter");
|
|
|
|
loader.lazyImporter(this, "LongStringClient", "resource://gre/modules/devtools/dbg-client.jsm");
|
|
|
|
/**
|
|
* A WebConsoleClient is used as a front end for the WebConsoleActor that is
|
|
* created on the server, hiding implementation details.
|
|
*
|
|
* @param object aDebuggerClient
|
|
* The DebuggerClient instance we live for.
|
|
* @param object aResponse
|
|
* The response packet received from the "startListeners" request sent to
|
|
* the WebConsoleActor.
|
|
*/
|
|
function WebConsoleClient(aDebuggerClient, aResponse)
|
|
{
|
|
this._actor = aResponse.from;
|
|
this._client = aDebuggerClient;
|
|
this._longStrings = {};
|
|
this.traits = aResponse.traits || {};
|
|
this.events = [];
|
|
this._networkRequests = new Map();
|
|
|
|
this.pendingEvaluationResults = new Map();
|
|
this.onEvaluationResult = this.onEvaluationResult.bind(this);
|
|
this.onNetworkEvent = this._onNetworkEvent.bind(this);
|
|
this.onNetworkEventUpdate = this._onNetworkEventUpdate.bind(this);
|
|
|
|
this._client.addListener("evaluationResult", this.onEvaluationResult);
|
|
this._client.addListener("networkEvent", this.onNetworkEvent);
|
|
this._client.addListener("networkEventUpdate", this.onNetworkEventUpdate);
|
|
EventEmitter.decorate(this);
|
|
}
|
|
|
|
exports.WebConsoleClient = WebConsoleClient;
|
|
|
|
WebConsoleClient.prototype = {
|
|
_longStrings: null,
|
|
traits: null,
|
|
|
|
/**
|
|
* Holds the network requests currently displayed by the Web Console. Each key
|
|
* represents the connection ID and the value is network request information.
|
|
* @private
|
|
* @type object
|
|
*/
|
|
_networkRequests: null,
|
|
|
|
getNetworkRequest(actorId) {
|
|
return this._networkRequests.get(actorId);
|
|
},
|
|
|
|
hasNetworkRequest(actorId) {
|
|
return this._networkRequests.has(actorId);
|
|
},
|
|
|
|
removeNetworkRequest(actorId) {
|
|
this._networkRequests.delete(actorId);
|
|
},
|
|
|
|
getNetworkEvents() {
|
|
return this._networkRequests.values();
|
|
},
|
|
|
|
get actor() { return this._actor; },
|
|
|
|
/**
|
|
* The "networkEvent" message type handler. We redirect any message to
|
|
* the UI for displaying.
|
|
*
|
|
* @private
|
|
* @param string type
|
|
* Message type.
|
|
* @param object packet
|
|
* The message received from the server.
|
|
*/
|
|
_onNetworkEvent: function (type, packet)
|
|
{
|
|
if (packet.from == this._actor) {
|
|
let actor = packet.eventActor;
|
|
let networkInfo = {
|
|
_type: "NetworkEvent",
|
|
timeStamp: actor.timeStamp,
|
|
node: null,
|
|
actor: actor.actor,
|
|
discardRequestBody: true,
|
|
discardResponseBody: true,
|
|
startedDateTime: actor.startedDateTime,
|
|
request: {
|
|
url: actor.url,
|
|
method: actor.method,
|
|
},
|
|
isXHR: actor.isXHR,
|
|
response: {},
|
|
timings: {},
|
|
updates: [], // track the list of network event updates
|
|
private: actor.private,
|
|
fromCache: actor.fromCache
|
|
};
|
|
this._networkRequests.set(actor.actor, networkInfo);
|
|
|
|
this.emit("networkEvent", networkInfo);
|
|
}
|
|
},
|
|
|
|
/**
|
|
* The "networkEventUpdate" message type handler. We redirect any message to
|
|
* the UI for displaying.
|
|
*
|
|
* @private
|
|
* @param string type
|
|
* Message type.
|
|
* @param object packet
|
|
* The message received from the server.
|
|
*/
|
|
_onNetworkEventUpdate: function (type, packet)
|
|
{
|
|
let networkInfo = this.getNetworkRequest(packet.from);
|
|
if (!networkInfo) {
|
|
return;
|
|
}
|
|
|
|
networkInfo.updates.push(packet.updateType);
|
|
|
|
switch (packet.updateType) {
|
|
case "requestHeaders":
|
|
networkInfo.request.headersSize = packet.headersSize;
|
|
break;
|
|
case "requestPostData":
|
|
networkInfo.discardRequestBody = packet.discardRequestBody;
|
|
networkInfo.request.bodySize = packet.dataSize;
|
|
break;
|
|
case "responseStart":
|
|
networkInfo.response.httpVersion = packet.response.httpVersion;
|
|
networkInfo.response.status = packet.response.status;
|
|
networkInfo.response.statusText = packet.response.statusText;
|
|
networkInfo.response.headersSize = packet.response.headersSize;
|
|
networkInfo.response.remoteAddress = packet.response.remoteAddress;
|
|
networkInfo.response.remotePort = packet.response.remotePort;
|
|
networkInfo.discardResponseBody = packet.response.discardResponseBody;
|
|
break;
|
|
case "responseContent":
|
|
networkInfo.response.content = {
|
|
mimeType: packet.mimeType,
|
|
};
|
|
networkInfo.response.bodySize = packet.contentSize;
|
|
networkInfo.response.transferredSize = packet.transferredSize;
|
|
networkInfo.discardResponseBody = packet.discardResponseBody;
|
|
break;
|
|
case "eventTimings":
|
|
networkInfo.totalTime = packet.totalTime;
|
|
break;
|
|
case "securityInfo":
|
|
networkInfo.securityInfo = packet.state;
|
|
break;
|
|
}
|
|
|
|
this.emit("networkEventUpdate", {
|
|
packet: packet,
|
|
networkInfo
|
|
});
|
|
},
|
|
|
|
/**
|
|
* Retrieve the cached messages from the server.
|
|
*
|
|
* @see this.CACHED_MESSAGES
|
|
* @param array types
|
|
* The array of message types you want from the server. See
|
|
* this.CACHED_MESSAGES for known types.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
getCachedMessages: function WCC_getCachedMessages(types, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: this._actor,
|
|
type: "getCachedMessages",
|
|
messageTypes: types,
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Inspect the properties of an object.
|
|
*
|
|
* @param string aActor
|
|
* The WebConsoleObjectActor ID to send the request to.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
inspectObjectProperties:
|
|
function WCC_inspectObjectProperties(aActor, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: aActor,
|
|
type: "inspectProperties",
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Evaluate a JavaScript expression.
|
|
*
|
|
* @param string aString
|
|
* The code you want to evaluate.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
* @param object [aOptions={}]
|
|
* Options for evaluation:
|
|
*
|
|
* - bindObjectActor: an ObjectActor ID. The OA holds a reference to
|
|
* a Debugger.Object that wraps a content object. This option allows
|
|
* you to bind |_self| to the D.O of the given OA, during string
|
|
* evaluation.
|
|
*
|
|
* See: Debugger.Object.executeInGlobalWithBindings() for information
|
|
* about bindings.
|
|
*
|
|
* Use case: the variable view needs to update objects and it does so
|
|
* by knowing the ObjectActor it inspects and binding |_self| to the
|
|
* D.O of the OA. As such, variable view sends strings like these for
|
|
* eval:
|
|
* _self["prop"] = value;
|
|
*
|
|
* - frameActor: a FrameActor ID. The FA holds a reference to
|
|
* a Debugger.Frame. This option allows you to evaluate the string in
|
|
* the frame of the given FA.
|
|
*
|
|
* - url: the url to evaluate the script as. Defaults to
|
|
* "debugger eval code".
|
|
*
|
|
* - selectedNodeActor: the NodeActor ID of the current selection in the
|
|
* Inspector, if such a selection exists. This is used by helper functions
|
|
* that can reference the currently selected node in the Inspector, like
|
|
* $0.
|
|
*/
|
|
evaluateJS: function WCC_evaluateJS(aString, aOnResponse, aOptions = {})
|
|
{
|
|
let packet = {
|
|
to: this._actor,
|
|
type: "evaluateJS",
|
|
text: aString,
|
|
bindObjectActor: aOptions.bindObjectActor,
|
|
frameActor: aOptions.frameActor,
|
|
url: aOptions.url,
|
|
selectedNodeActor: aOptions.selectedNodeActor,
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Evaluate a JavaScript expression asynchronously.
|
|
* See evaluateJS for parameter and response information.
|
|
*/
|
|
evaluateJSAsync: function(aString, aOnResponse, aOptions = {})
|
|
{
|
|
// Pre-37 servers don't support async evaluation.
|
|
if (!this.traits.evaluateJSAsync) {
|
|
this.evaluateJS(aString, aOnResponse, aOptions);
|
|
return;
|
|
}
|
|
|
|
let packet = {
|
|
to: this._actor,
|
|
type: "evaluateJSAsync",
|
|
text: aString,
|
|
bindObjectActor: aOptions.bindObjectActor,
|
|
frameActor: aOptions.frameActor,
|
|
url: aOptions.url,
|
|
selectedNodeActor: aOptions.selectedNodeActor,
|
|
};
|
|
|
|
this._client.request(packet, response => {
|
|
// Null check this in case the client has been detached while waiting
|
|
// for a response.
|
|
if (this.pendingEvaluationResults) {
|
|
this.pendingEvaluationResults.set(response.resultID, aOnResponse);
|
|
}
|
|
});
|
|
},
|
|
|
|
/**
|
|
* Handler for the actors's unsolicited evaluationResult packet.
|
|
*/
|
|
onEvaluationResult: function(aNotification, aPacket) {
|
|
// Find the associated callback based on this ID, and fire it.
|
|
// In a sync evaluation, this would have already been called in
|
|
// direct response to the client.request function.
|
|
let onResponse = this.pendingEvaluationResults.get(aPacket.resultID);
|
|
if (onResponse) {
|
|
onResponse(aPacket);
|
|
this.pendingEvaluationResults.delete(aPacket.resultID);
|
|
} else {
|
|
DevToolsUtils.reportException("onEvaluationResult",
|
|
"No response handler for an evaluateJSAsync result (resultID: " + aPacket.resultID + ")");
|
|
}
|
|
},
|
|
|
|
/**
|
|
* Autocomplete a JavaScript expression.
|
|
*
|
|
* @param string aString
|
|
* The code you want to autocomplete.
|
|
* @param number aCursor
|
|
* Cursor location inside the string. Index starts from 0.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
* @param string aFrameActor
|
|
* The id of the frame actor that made the call.
|
|
*/
|
|
autocomplete: function WCC_autocomplete(aString, aCursor, aOnResponse, aFrameActor)
|
|
{
|
|
let packet = {
|
|
to: this._actor,
|
|
type: "autocomplete",
|
|
text: aString,
|
|
cursor: aCursor,
|
|
frameActor: aFrameActor,
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Clear the cache of messages (page errors and console API calls).
|
|
*/
|
|
clearMessagesCache: function WCC_clearMessagesCache()
|
|
{
|
|
let packet = {
|
|
to: this._actor,
|
|
type: "clearMessagesCache",
|
|
};
|
|
this._client.request(packet);
|
|
},
|
|
|
|
/**
|
|
* Get Web Console-related preferences on the server.
|
|
*
|
|
* @param array aPreferences
|
|
* An array with the preferences you want to retrieve.
|
|
* @param function [aOnResponse]
|
|
* Optional function to invoke when the response is received.
|
|
*/
|
|
getPreferences: function WCC_getPreferences(aPreferences, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: this._actor,
|
|
type: "getPreferences",
|
|
preferences: aPreferences,
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Set Web Console-related preferences on the server.
|
|
*
|
|
* @param object aPreferences
|
|
* An object with the preferences you want to change.
|
|
* @param function [aOnResponse]
|
|
* Optional function to invoke when the response is received.
|
|
*/
|
|
setPreferences: function WCC_setPreferences(aPreferences, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: this._actor,
|
|
type: "setPreferences",
|
|
preferences: aPreferences,
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Retrieve the request headers from the given NetworkEventActor.
|
|
*
|
|
* @param string aActor
|
|
* The NetworkEventActor ID.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
getRequestHeaders: function WCC_getRequestHeaders(aActor, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: aActor,
|
|
type: "getRequestHeaders",
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Retrieve the request cookies from the given NetworkEventActor.
|
|
*
|
|
* @param string aActor
|
|
* The NetworkEventActor ID.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
getRequestCookies: function WCC_getRequestCookies(aActor, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: aActor,
|
|
type: "getRequestCookies",
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Retrieve the request post data from the given NetworkEventActor.
|
|
*
|
|
* @param string aActor
|
|
* The NetworkEventActor ID.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
getRequestPostData: function WCC_getRequestPostData(aActor, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: aActor,
|
|
type: "getRequestPostData",
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Retrieve the response headers from the given NetworkEventActor.
|
|
*
|
|
* @param string aActor
|
|
* The NetworkEventActor ID.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
getResponseHeaders: function WCC_getResponseHeaders(aActor, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: aActor,
|
|
type: "getResponseHeaders",
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Retrieve the response cookies from the given NetworkEventActor.
|
|
*
|
|
* @param string aActor
|
|
* The NetworkEventActor ID.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
getResponseCookies: function WCC_getResponseCookies(aActor, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: aActor,
|
|
type: "getResponseCookies",
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Retrieve the response content from the given NetworkEventActor.
|
|
*
|
|
* @param string aActor
|
|
* The NetworkEventActor ID.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
getResponseContent: function WCC_getResponseContent(aActor, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: aActor,
|
|
type: "getResponseContent",
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Retrieve the timing information for the given NetworkEventActor.
|
|
*
|
|
* @param string aActor
|
|
* The NetworkEventActor ID.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
getEventTimings: function WCC_getEventTimings(aActor, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: aActor,
|
|
type: "getEventTimings",
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Retrieve the security information for the given NetworkEventActor.
|
|
*
|
|
* @param string aActor
|
|
* The NetworkEventActor ID.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
getSecurityInfo: function WCC_getSecurityInfo(aActor, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: aActor,
|
|
type: "getSecurityInfo",
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Send a HTTP request with the given data.
|
|
*
|
|
* @param string aData
|
|
* The details of the HTTP request.
|
|
* @param function aOnResponse
|
|
* The function invoked when the response is received.
|
|
*/
|
|
sendHTTPRequest: function WCC_sendHTTPRequest(aData, aOnResponse) {
|
|
let packet = {
|
|
to: this._actor,
|
|
type: "sendHTTPRequest",
|
|
request: aData
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Start the given Web Console listeners.
|
|
*
|
|
* @see this.LISTENERS
|
|
* @param array aListeners
|
|
* Array of listeners you want to start. See this.LISTENERS for
|
|
* known listeners.
|
|
* @param function aOnResponse
|
|
* Function to invoke when the server response is received.
|
|
*/
|
|
startListeners: function WCC_startListeners(aListeners, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: this._actor,
|
|
type: "startListeners",
|
|
listeners: aListeners,
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Stop the given Web Console listeners.
|
|
*
|
|
* @see this.LISTENERS
|
|
* @param array aListeners
|
|
* Array of listeners you want to stop. See this.LISTENERS for
|
|
* known listeners.
|
|
* @param function aOnResponse
|
|
* Function to invoke when the server response is received.
|
|
*/
|
|
stopListeners: function WCC_stopListeners(aListeners, aOnResponse)
|
|
{
|
|
let packet = {
|
|
to: this._actor,
|
|
type: "stopListeners",
|
|
listeners: aListeners,
|
|
};
|
|
this._client.request(packet, aOnResponse);
|
|
},
|
|
|
|
/**
|
|
* Return an instance of LongStringClient for the given long string grip.
|
|
*
|
|
* @param object aGrip
|
|
* The long string grip returned by the protocol.
|
|
* @return object
|
|
* The LongStringClient for the given long string grip.
|
|
*/
|
|
longString: function WCC_longString(aGrip)
|
|
{
|
|
if (aGrip.actor in this._longStrings) {
|
|
return this._longStrings[aGrip.actor];
|
|
}
|
|
|
|
let client = new LongStringClient(this._client, aGrip);
|
|
this._longStrings[aGrip.actor] = client;
|
|
return client;
|
|
},
|
|
|
|
/**
|
|
* Close the WebConsoleClient. This stops all the listeners on the server and
|
|
* detaches from the console actor.
|
|
*
|
|
* @param function aOnResponse
|
|
* Function to invoke when the server response is received.
|
|
*/
|
|
detach: function WCC_detach(aOnResponse)
|
|
{
|
|
this._client.removeListener("evaluationResult", this.onEvaluationResult);
|
|
this._client.removeListener("networkEvent", this.onNetworkEvent);
|
|
this._client.removeListener("networkEventUpdate", this.onNetworkEventUpdate);
|
|
this.stopListeners(null, aOnResponse);
|
|
this._longStrings = null;
|
|
this._client = null;
|
|
this.pendingEvaluationResults.clear();
|
|
this.pendingEvaluationResults = null;
|
|
this.clearNetworkRequests();
|
|
this._networkRequests = null;
|
|
},
|
|
|
|
clearNetworkRequests: function () {
|
|
this._networkRequests.clear();
|
|
}
|
|
};
|