зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1513118 Part 3 - Devtools server/client support for virtual console logs, r=lsmyth.
--HG-- extra : rebase_source : fb5f80d245c145e3d5c4fea9db3a7d648694f585 extra : source : 4abb81088a9b49d700cfea840848a9dac6a0010d
This commit is contained in:
Родитель
0af6ba1fa7
Коммит
cbd795860b
|
@ -468,6 +468,12 @@ Toolbox.prototype = {
|
|||
this._threadClient = await attachThread(this);
|
||||
await domReady;
|
||||
|
||||
// The web console is immediately loaded when replaying, so that the
|
||||
// timeline will always be populated with generated messages.
|
||||
if (this.target.isReplayEnabled()) {
|
||||
await this.loadTool("webconsole");
|
||||
}
|
||||
|
||||
this.isReady = true;
|
||||
|
||||
const framesPromise = this._listFrames();
|
||||
|
|
|
@ -30,6 +30,7 @@ function WebConsoleConnectionProxy(webConsoleFrame, target) {
|
|||
this._onPageError = this._onPageError.bind(this);
|
||||
this._onLogMessage = this._onLogMessage.bind(this);
|
||||
this._onConsoleAPICall = this._onConsoleAPICall.bind(this);
|
||||
this._onVirtualConsoleLog = this._onVirtualConsoleLog.bind(this);
|
||||
this._onNetworkEvent = this._onNetworkEvent.bind(this);
|
||||
this._onNetworkEventUpdate = this._onNetworkEventUpdate.bind(this);
|
||||
this._onTabNavigated = this._onTabNavigated.bind(this);
|
||||
|
@ -127,6 +128,8 @@ WebConsoleConnectionProxy.prototype = {
|
|||
client.addListener("consoleAPICall", this._onConsoleAPICall);
|
||||
client.addListener("lastPrivateContextExited",
|
||||
this._onLastPrivateContextExited);
|
||||
client.addListener("virtualConsoleLog",
|
||||
this._onVirtualConsoleLog);
|
||||
|
||||
this.target.on("will-navigate", this._onTabWillNavigate);
|
||||
this.target.on("navigate", this._onTabNavigated);
|
||||
|
@ -310,6 +313,20 @@ WebConsoleConnectionProxy.prototype = {
|
|||
}
|
||||
this.dispatchMessageAdd(packet);
|
||||
},
|
||||
|
||||
_onVirtualConsoleLog: function(type, packet) {
|
||||
if (!this.webConsoleFrame) {
|
||||
return;
|
||||
}
|
||||
this.dispatchMessageAdd({
|
||||
type: "consoleAPICall",
|
||||
message: {
|
||||
executionPoint: packet.executionPoint,
|
||||
"arguments": [packet.url + ":" + packet.line, packet.message],
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* The "networkEvent" message type handler. We redirect any message to
|
||||
* the UI for displaying.
|
||||
|
@ -423,6 +440,8 @@ WebConsoleConnectionProxy.prototype = {
|
|||
this.client.removeListener("consoleAPICall", this._onConsoleAPICall);
|
||||
this.client.removeListener("lastPrivateContextExited",
|
||||
this._onLastPrivateContextExited);
|
||||
this.client.removeListener("virtualConsoleLog",
|
||||
this._onVirtualConsoleLog);
|
||||
this.webConsoleClient.off("networkEvent", this._onNetworkEvent);
|
||||
this.webConsoleClient.off("networkEventUpdate", this._onNetworkEventUpdate);
|
||||
this.target.off("will-navigate", this._onTabWillNavigate);
|
||||
|
|
|
@ -37,6 +37,7 @@ const UnsolicitedNotifications = {
|
|||
"evaluationResult": "evaluationResult",
|
||||
"updatedSource": "updatedSource",
|
||||
"inspectObject": "inspectObject",
|
||||
"virtualConsoleLog": "virtualConsoleLog",
|
||||
|
||||
// newSource is still emitted on the ThreadActor, in addition to the
|
||||
// BrowsingContextActor we have to keep it here until ThreadClient is converted to
|
||||
|
|
Загрузка…
Ссылка в новой задаче