Commit 95bcfb37 authored by sergeyv@chromium.org's avatar sergeyv@chromium.org

DevTools: Add executionContextId in ConsoleMessage in backend

BUG=
R=pfeldman@chromium.org

Review URL: https://codereview.chromium.org/221923003

git-svn-id: svn://svn.chromium.org/blink/trunk@170664 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 441611d1
......@@ -35,6 +35,7 @@
#include "bindings/v8/ScriptCallStackFactory.h"
#include "bindings/v8/ScriptValue.h"
#include "core/dom/ExecutionContext.h"
#include "core/inspector/IdentifiersFactory.h"
#include "core/inspector/InjectedScript.h"
#include "core/inspector/InjectedScriptManager.h"
......@@ -64,6 +65,7 @@ ConsoleMessage::ConsoleMessage(bool canGenerateCallStack, MessageSource source,
, m_type(type)
, m_level(level)
, m_message(message)
, m_scriptState(state)
, m_url(url)
, m_line(line)
, m_column(column)
......@@ -78,6 +80,7 @@ ConsoleMessage::ConsoleMessage(bool, MessageSource source, MessageType type, Mes
, m_type(type)
, m_level(level)
, m_message(message)
, m_scriptState(0)
, m_arguments(nullptr)
, m_line(0)
, m_column(0)
......@@ -98,6 +101,7 @@ ConsoleMessage::ConsoleMessage(bool canGenerateCallStack, MessageSource source,
, m_type(type)
, m_level(level)
, m_message(message)
, m_scriptState(state)
, m_arguments(arguments)
, m_url()
, m_line(0)
......@@ -194,6 +198,8 @@ void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, Injecte
jsonObj->setLine(static_cast<int>(m_line));
jsonObj->setColumn(static_cast<int>(m_column));
jsonObj->setUrl(m_url);
if (m_scriptState && m_scriptState->executionContext()->isDocument())
jsonObj->setExecutionContextId(injectedScriptManager->injectedScriptIdFor(m_scriptState));
if (m_source == NetworkMessageSource && !m_requestId.isEmpty())
jsonObj->setNetworkRequestId(m_requestId);
if (m_arguments && m_arguments->argumentCount()) {
......@@ -229,6 +235,9 @@ void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, Injecte
void ConsoleMessage::windowCleared(DOMWindow* window)
{
if (m_scriptState && m_scriptState->domWindow() == window)
m_scriptState = 0;
if (!m_arguments)
return;
if (m_arguments->globalState()->domWindow() != window)
......
......@@ -72,6 +72,7 @@ private:
MessageType m_type;
MessageLevel m_level;
String m_message;
ScriptState* m_scriptState;
RefPtr<ScriptArguments> m_arguments;
RefPtr<ScriptCallStack> m_callStack;
String m_url;
......
......@@ -208,9 +208,10 @@ WebInspector.ConsoleModel.prototype = {
* @param {!Array.<!ConsoleAgent.CallFrame>=} stackTrace
* @param {number=} timestamp
* @param {boolean=} isOutdated
* @param {!RuntimeAgent.ExecutionContextId=} executionContextId
*/
WebInspector.ConsoleMessage = function(source, level, messageText, type, url, line, column, requestId, parameters, stackTrace, timestamp, isOutdated)
WebInspector.ConsoleMessage = function(source, level, messageText, type, url, line, column, requestId, parameters, stackTrace, timestamp, isOutdated, executionContextId)
{
this.source = source;
this.level = level;
......@@ -223,6 +224,7 @@ WebInspector.ConsoleMessage = function(source, level, messageText, type, url, li
this.stackTrace = stackTrace;
this.timestamp = timestamp || Date.now();
this.isOutdated = isOutdated;
this.executionContextId = executionContextId;
this.request = requestId ? WebInspector.networkLog.requestForId(requestId) : null;
}
......@@ -264,7 +266,8 @@ WebInspector.ConsoleMessage.prototype = {
this.parameters,
this.stackTrace,
this.timestamp,
this.isOutdated);
this.isOutdated,
this.executionContextId);
},
/**
......@@ -387,7 +390,8 @@ WebInspector.ConsoleDispatcher.prototype = {
payload.parameters,
payload.stackTrace,
payload.timestamp * 1000, // Convert to ms.
this._console._enablingConsole);
this._console._enablingConsole,
payload.executionContextId);
this._console.addMessage(consoleMessage, true);
},
......
......@@ -847,7 +847,8 @@
{ "name": "parameters", "type": "array", "items": { "$ref": "Runtime.RemoteObject" }, "optional": true, "description": "Message parameters in case of the formatted message." },
{ "name": "stackTrace", "$ref": "StackTrace", "optional": true, "description": "JavaScript stack trace for assertions and error messages." },
{ "name": "networkRequestId", "$ref": "Network.RequestId", "optional": true, "description": "Identifier of the network request associated with this message." },
{ "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp, when this message was fired.", "hidden": true }
{ "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp, when this message was fired.", "hidden": true },
{"name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "optional": true, "description": "identifier of the context where message was created", "hidden": true }
]
},
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment