Skip to content

Commit

Permalink
[DevTools] Add script content hash to scriptParsed protocol event
Browse files Browse the repository at this point in the history
Added hash field to scriptParsed event.
Hash will be used for anonymous scripts blackboxing.

BUG=583193
[email protected], [email protected]

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

Cr-Commit-Position: refs/heads/master@{#378565}
  • Loading branch information
alexkozy authored and Commit bot committed Mar 1, 2016
1 parent dcd8017 commit 6224336
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
15 changes: 9 additions & 6 deletions front_end/sdk/DebuggerModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ WebInspector.DebuggerModel.prototype = {
* @param {number} endLine
* @param {number} endColumn
* @param {!RuntimeAgent.ExecutionContextId} executionContextId
* @param {string} hash
* @param {boolean} isContentScript
* @param {boolean} isInternalScript
* @param {boolean} isLiveEdit
Expand All @@ -599,9 +600,9 @@ WebInspector.DebuggerModel.prototype = {
* @param {boolean=} hasSyntaxError
* @return {!WebInspector.Script}
*/
_parsedScriptSource: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, isContentScript, isInternalScript, isLiveEdit, sourceMapURL, hasSourceURL, deprecatedCommentWasUsed, hasSyntaxError)
_parsedScriptSource: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash, isContentScript, isInternalScript, isLiveEdit, sourceMapURL, hasSourceURL, deprecatedCommentWasUsed, hasSyntaxError)
{
var script = new WebInspector.Script(this, scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, isContentScript, isInternalScript, isLiveEdit, sourceMapURL, hasSourceURL);
var script = new WebInspector.Script(this, scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash, isContentScript, isInternalScript, isLiveEdit, sourceMapURL, hasSourceURL);
this._registerScript(script);
if (!hasSyntaxError)
this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource, script);
Expand Down Expand Up @@ -986,16 +987,17 @@ WebInspector.DebuggerDispatcher.prototype = {
* @param {number} endLine
* @param {number} endColumn
* @param {!RuntimeAgent.ExecutionContextId} executionContextId
* @param {string} hash
* @param {boolean=} isContentScript
* @param {boolean=} isInternalScript
* @param {boolean=} isLiveEdit
* @param {string=} sourceMapURL
* @param {boolean=} hasSourceURL
* @param {boolean=} deprecatedCommentWasUsed
*/
scriptParsed: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, isContentScript, isInternalScript, isLiveEdit, sourceMapURL, hasSourceURL, deprecatedCommentWasUsed)
scriptParsed: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash, isContentScript, isInternalScript, isLiveEdit, sourceMapURL, hasSourceURL, deprecatedCommentWasUsed)
{
this._debuggerModel._parsedScriptSource(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, !!isContentScript, !!isInternalScript, !!isLiveEdit, sourceMapURL, hasSourceURL, deprecatedCommentWasUsed, false);
this._debuggerModel._parsedScriptSource(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash, !!isContentScript, !!isInternalScript, !!isLiveEdit, sourceMapURL, hasSourceURL, deprecatedCommentWasUsed, false);
},

/**
Expand All @@ -1007,15 +1009,16 @@ WebInspector.DebuggerDispatcher.prototype = {
* @param {number} endLine
* @param {number} endColumn
* @param {!RuntimeAgent.ExecutionContextId} executionContextId
* @param {string} hash
* @param {boolean=} isContentScript
* @param {boolean=} isInternalScript
* @param {string=} sourceMapURL
* @param {boolean=} hasSourceURL
* @param {boolean=} deprecatedCommentWasUsed
*/
scriptFailedToParse: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, isContentScript, isInternalScript, sourceMapURL, hasSourceURL, deprecatedCommentWasUsed)
scriptFailedToParse: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash, isContentScript, isInternalScript, sourceMapURL, hasSourceURL, deprecatedCommentWasUsed)
{
this._debuggerModel._parsedScriptSource(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, !!isContentScript, !!isInternalScript, false, sourceMapURL, hasSourceURL, deprecatedCommentWasUsed, true);
this._debuggerModel._parsedScriptSource(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash, !!isContentScript, !!isInternalScript, false, sourceMapURL, hasSourceURL, deprecatedCommentWasUsed, true);
},

/**
Expand Down
4 changes: 3 additions & 1 deletion front_end/sdk/Script.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
* @param {number} endLine
* @param {number} endColumn
* @param {!RuntimeAgent.ExecutionContextId} executionContextId
* @param {string} hash
* @param {boolean} isContentScript
* @param {boolean} isInternalScript
* @param {boolean} isLiveEdit
* @param {string=} sourceMapURL
* @param {boolean=} hasSourceURL
*/
WebInspector.Script = function(debuggerModel, scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, isContentScript, isInternalScript, isLiveEdit, sourceMapURL, hasSourceURL)
WebInspector.Script = function(debuggerModel, scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash, isContentScript, isInternalScript, isLiveEdit, sourceMapURL, hasSourceURL)
{
WebInspector.SDKObject.call(this, debuggerModel.target());
this.debuggerModel = debuggerModel;
Expand All @@ -52,6 +53,7 @@ WebInspector.Script = function(debuggerModel, scriptId, sourceURL, startLine, st
this.endLine = endLine;
this.endColumn = endColumn;
this._executionContextId = executionContextId;
this.hash = hash;
this._isContentScript = isContentScript;
this._isInternalScript = isInternalScript;
this._isLiveEdit = isLiveEdit;
Expand Down
2 changes: 2 additions & 0 deletions protocol.json
Original file line number Diff line number Diff line change
Expand Up @@ -3823,6 +3823,7 @@
{ "name": "endLine", "type": "integer", "description": "Last line of the script." },
{ "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." },
{ "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "description": "Specifies script creation context.", "hidden": true },
{ "name": "hash", "type": "string", "hidden": true, "description": "Content hash of the script."},
{ "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." },
{ "name": "isInternalScript", "type": "boolean", "optional": true, "description": "Determines whether this script is an internal script.", "hidden": true },
{ "name": "isLiveEdit", "type": "boolean", "optional": true, "description": "True, if this script is generated as a result of the live edit operation.", "hidden": true },
Expand All @@ -3842,6 +3843,7 @@
{ "name": "endLine", "type": "integer", "description": "Last line of the script." },
{ "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." },
{ "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "description": "Specifies script creation context.", "hidden": true },
{ "name": "hash", "type": "string", "hidden": true, "description": "Content hash of the script."},
{ "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." },
{ "name": "isInternalScript", "type": "boolean", "optional": true, "description": "Determines whether this script is an internal script.", "hidden": true },
{ "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." },
Expand Down

0 comments on commit 6224336

Please sign in to comment.