Skip to content

Commit

Permalink
squash 'resources/unpacked/devtools' changes from 61e53c7..ea1001a
Browse files Browse the repository at this point in the history
ea1001a [DevTools] Support broken UMA metric from M49 frontend.
e42e78a Revert of [DevTools] Added keyboard search while in sources (patchset #7 id:120001 of https://codereview.chromium.org/1831903002/ )
b3fb203 DevTools: teach SourceMapNamesResolver to resolve "this" object
c0fed8a Revert of DevTools: extract CPU profile independent part of CPUProfileNode. (patchset #3 id:40001 of https://codereview.chromium.org/1873973002/ )
decf4d4 DevTools: improve identifier extraction in SourceMapNamesResolver
e2ca0ad Rename Heap to ThreadHeap
8228bda Revert of Rename Heap to ThreadHeap (patchset #13 id:240001 of https://codereview.chromium.org/1845543002/ )
2a81c34 DevTools: extract CPU profile independent part of CPUProfileNode.
53d311c Rename Heap to ThreadHeap
b095eff [DevTools] Fix autocomplete for iframe in top context
81abc28 DevTools: add -webkit-user-select and -webkit-user-modify completions
93a9291 DevTools: cleanup occurences of selection.getRangeAt to avoid NPE
bb4305f [DevTools] Fix console history for evaluated object literals
18c6c34 [DevTools] Fix condition in ElementsTreeElement.js
4264bde DevTools: workaround bug in Blink selection API
81e05cb DevTools: deprecate InspectorTest.runAfterPendingDispatches
2dda9ca [DevTools] Added keyboard search while in sources

git-subtree-dir: resources/unpacked/devtools
git-subtree-split: ea1001a
  • Loading branch information
darwin committed Apr 18, 2016
1 parent e99292e commit 47be2d5
Show file tree
Hide file tree
Showing 20 changed files with 280 additions and 85 deletions.
2 changes: 1 addition & 1 deletion front_end/Tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ TestSuite.prototype.testPauseInSharedWorkerInitialization1 = function()
function callback()
{
var target = WebInspector.targetManager.targetsWithJSContext()[0];
target._connection.runAfterPendingDispatches(this.releaseControl.bind(this));
target._connection.deprecatedRunAfterPendingDispatches(this.releaseControl.bind(this));
}
};

Expand Down
10 changes: 10 additions & 0 deletions front_end/common/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ WebInspector.TextCursor.prototype = {
return this._offset;
},

/**
* @param {number} offset
*/
resetTo: function(offset)
{
this._offset = offset;
this._lineNumber = this._lineEndings.lowerBound(offset);
this._columnNumber = this._lineNumber ? this._offset - this._lineEndings[this._lineNumber - 1] - 1 : this._offset;
},

/**
* @return {number}
*/
Expand Down
3 changes: 3 additions & 0 deletions front_end/devtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,9 @@ InspectorFrontendHostImpl.prototype = {
*/
recordEnumeratedHistogram: function(actionName, actionCode, bucketSize)
{
// Support for M49 frontend.
if (actionName === "DevTools.DrawerShown")
return;
DevToolsAPI.sendMessageToEmbedder("recordEnumeratedHistogram", [actionName, actionCode, bucketSize], null);
},

Expand Down
2 changes: 1 addition & 1 deletion front_end/elements/ElementsTreeElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ WebInspector.ElementsTreeElement.prototype = {
return anchor;
}

if (node && name === "src" || name === "href") {
if (node && (name === "src" || name === "href")) {
attrValueElement.appendChild(linkifyValue.call(this, value));
} else if (node && node.nodeName().toLowerCase() === "img" && name === "srcset") {
var sources = value.split(",");
Expand Down
11 changes: 8 additions & 3 deletions front_end/es_tree/ESTreeWalker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
/**
* @constructor
* @param {function(!ESTree.Node)} beforeVisit
* @param {function(!ESTree.Node)} afterVisit
* @param {function(!ESTree.Node)=} afterVisit
*/
WebInspector.ESTreeWalker = function(beforeVisit, afterVisit)
{
this._beforeVisit = beforeVisit;
this._afterVisit = afterVisit;
this._afterVisit = afterVisit || new Function();
}

WebInspector.ESTreeWalker.SkipSubtree = {};

WebInspector.ESTreeWalker.prototype = {
/**
* @param {!ESTree.Node} ast
Expand All @@ -32,7 +34,10 @@ WebInspector.ESTreeWalker.prototype = {
return;
node.parent = parent;

this._beforeVisit.call(null, node);
if (this._beforeVisit.call(null, node) === WebInspector.ESTreeWalker.SkipSubtree) {
this._afterVisit.call(null, node);
return;
}

var walkOrder = WebInspector.ESTreeWalker._walkOrder[node.type];
if (!walkOrder) {
Expand Down
2 changes: 2 additions & 0 deletions front_end/externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,8 @@ ESTree.Node = function()
this.name;
/** @type {(?ESTree.Node|undefined)} */
this.id;
/** @type {(number|undefined)} */
this.length;
}

/**
Expand Down
40 changes: 20 additions & 20 deletions front_end/formatter_worker/FormatterWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,49 +131,49 @@ WebInspector.evaluatableJavaScriptSubstring = function(content)
*/
WebInspector.javaScriptIdentifiers = function(content)
{
var root = acorn.parse(content, {});
var root = acorn.parse(content, { ranges: false, ecmaVersion: 6 });

/** @type {!Array<!ESTree.Node>} */
var identifiers = [];
var functionDeclarationCounter = 0;
var walker = new WebInspector.ESTreeWalker(beforeVisit, afterVisit);
var walker = new WebInspector.ESTreeWalker(beforeVisit);

/**
* @param {!ESTree.Node} node
* @return {boolean}
*/
function isFunction(node)
{
return node.type === "FunctionDeclaration" || node.type === "FunctionExpression";
return node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
}

/**
* @param {!ESTree.Node} node
*/
function beforeVisit(node)
{
if (isFunction(node))
functionDeclarationCounter++;
if (isFunction(node)) {
if (node.id)
identifiers.push(node.id);
return WebInspector.ESTreeWalker.SkipSubtree;
}

if (functionDeclarationCounter > 1)
if (node.type !== "Identifier")
return;

if (isFunction(node) && node.params)
identifiers.pushAll(node.params);

if (node.type === "VariableDeclarator")
identifiers.push(/** @type {!ESTree.Node} */(node.id));
if (node.parent && node.parent.type === "MemberExpression" && node.parent.property === node && !node.parent.computed)
return;
identifiers.push(node);
}

/**
* @param {!ESTree.Node} node
*/
function afterVisit(node)
{
if (isFunction(node))
functionDeclarationCounter--;
if (!root || root.type !== "Program" || root.body.length !== 1 || !isFunction(root.body[0])) {
postMessage([]);
return;
}

walker.walk(root);
var functionNode = root.body[0];
for (var param of functionNode.params)
walker.walk(param);
walker.walk(functionNode.body);
var reduced = identifiers.map(id => ({name: id.name, offset: id.start}));
postMessage(reduced);
}
Expand Down
2 changes: 1 addition & 1 deletion front_end/main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ WebInspector.Main.prototype = {
}
}

this._mainConnection.runAfterPendingDispatches(invokeMethod);
this._mainConnection.deprecatedRunAfterPendingDispatches(invokeMethod);
}
}

Expand Down
8 changes: 5 additions & 3 deletions front_end/platform/DOMExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ Node.prototype.isComponentSelectionCollapsed = function()
{
// FIXME: crbug.com/447523, use selection.isCollapsed when it is fixed for shadow dom.
var selection = this.getComponentSelection();
return selection && selection.rangeCount ? selection.getRangeAt(0).collapsed : true;
var range = selection && selection.rangeCount ? selection.getRangeAt(0) : null;
return range ? range.collapsed : true;
}

/**
Expand Down Expand Up @@ -348,9 +349,10 @@ Element.prototype.removeChildren = function()
Element.prototype.isInsertionCaretInside = function()
{
var selection = this.getComponentSelection();
if (!selection.rangeCount || !selection.isCollapsed)
// @see crbug.com/602541
var selectionRange = selection && selection.rangeCount ? selection.getRangeAt(0) : null;
if (!selectionRange || !selection.isCollapsed)
return false;
var selectionRange = selection.getRangeAt(0);
return selectionRange.startContainer.isSelfOrDescendant(this);
}

Expand Down
13 changes: 13 additions & 0 deletions front_end/platform/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,19 @@ Map.prototype.keysArray = function()
return Array.from(this.keys());
}

/**
* @return {!Multimap<!KEY, !VALUE>}
*/
Map.prototype.inverse = function()
{
var result = new Multimap();
for (var key of this.keys()) {
var value = this.get(key);
result.set(value, key);
}
return result;
}

/**
* @constructor
* @template K, V
Expand Down
6 changes: 6 additions & 0 deletions front_end/sdk/CSSMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,12 @@ WebInspector.CSSMetadata._propertyDataMap = {
"-webkit-line-break": { values: [
"auto", "loose", "normal", "strict"
] },
"-webkit-user-select": { values: [
"none", "text", "all"
] },
"-webkit-user-modify": { values: [
"read-only", "read-write", "read-write-plaintext-only"
] },
"text-align-last": { values: [
"auto", "start", "end", "left", "right", "center", "justify"
] },
Expand Down
3 changes: 2 additions & 1 deletion front_end/sdk/ConsoleModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ WebInspector.ConsoleModel.prototype = {
WebInspector.ConsoleModel.evaluateCommandInConsole = function(executionContext, text, useCommandLineAPI)
{
var target = executionContext.target();
var requestedText = text;

var commandMessage = new WebInspector.ConsoleMessage(target, WebInspector.ConsoleMessage.MessageSource.JS, null, text, WebInspector.ConsoleMessage.MessageType.Command);
commandMessage.setExecutionContextId(executionContext.id);
Expand All @@ -209,7 +210,7 @@ WebInspector.ConsoleModel.evaluateCommandInConsole = function(executionContext,
WebInspector.console.showPromise().then(reportUponEvaluation);
function reportUponEvaluation()
{
target.consoleModel.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEvaluated, {result: result, wasThrown: wasThrown, text: text, commandMessage: commandMessage, exceptionDetails: exceptionDetails});
target.consoleModel.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEvaluated, {result: result, wasThrown: wasThrown, text: requestedText, commandMessage: commandMessage, exceptionDetails: exceptionDetails});
}
}
if (/^\s*\{/.test(text) && /\}\s*$/.test(text))
Expand Down
9 changes: 8 additions & 1 deletion front_end/sdk/DebuggerModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,6 @@ WebInspector.DebuggerModel.CallFrame.fromPayloadArray = function(debuggerModel,
}

WebInspector.DebuggerModel.CallFrame.prototype = {

/**
* @return {!WebInspector.Script}
*/
Expand Down Expand Up @@ -1205,6 +1204,14 @@ WebInspector.DebuggerModel.Scope = function(callFrame, ordinal)
}

WebInspector.DebuggerModel.Scope.prototype = {
/**
* @return {!WebInspector.DebuggerModel.CallFrame}
*/
callFrame: function()
{
return this._callFrame;
},

/**
* @return {string}
*/
Expand Down
6 changes: 3 additions & 3 deletions front_end/sdk/InspectorBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ InspectorBackendClass.Connection.prototype = {
console.log("time-stats: " + callback.methodName + " = " + (processingStartTime - callback.sendRequestTime) + " + " + (Date.now() - processingStartTime));

if (this._scripts && !this._pendingResponsesCount)
this.runAfterPendingDispatches();
this.deprecatedRunAfterPendingDispatches();
return;
} else {
var method = messageObject.method.split(".");
Expand Down Expand Up @@ -376,7 +376,7 @@ InspectorBackendClass.Connection.prototype = {
/**
* @param {function()=} script
*/
runAfterPendingDispatches: function(script)
deprecatedRunAfterPendingDispatches: function(script)
{
if (!this._scripts)
this._scripts = [];
Expand All @@ -389,7 +389,7 @@ InspectorBackendClass.Connection.prototype = {
if (!this._pendingResponsesCount)
this._executeAfterPendingDispatches();
else
this.runAfterPendingDispatches();
this.deprecatedRunAfterPendingDispatches();
}.bind(this), 0);
},

Expand Down
6 changes: 3 additions & 3 deletions front_end/sdk/RuntimeModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ WebInspector.ExecutionContext.prototype = {
object = this;

var resultSet = {};
for (var o = object; o; o = o.__proto__) {
try {
try {
for (var o = object; o; o = o.__proto__) {
if (type === "array" && o === object && ArrayBuffer.isView(o) && o.length > 9999)
continue;
var names = Object.getOwnPropertyNames(o);
Expand All @@ -507,8 +507,8 @@ WebInspector.ExecutionContext.prototype = {
continue;
resultSet[names[i]] = true;
}
} catch (e) {
}
} catch (e) {
}
return resultSet;
}
Expand Down
14 changes: 13 additions & 1 deletion front_end/sources/ScopeChainSidebarPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ WebInspector.ScopeChainSidebarPane.prototype = {
* @param {?WebInspector.DebuggerModel.CallFrame} callFrame
*/
update: function(callFrame)
{
WebInspector.SourceMapNamesResolver.resolveThisObject(callFrame)
.then(this._innerUpdate.bind(this, callFrame));
},

/**
* @param {?WebInspector.DebuggerModel.CallFrame} callFrame
* @param {?WebInspector.RemoteObject} thisObject
*/
_innerUpdate: function(callFrame, thisObject)
{
this.element.removeChildren();

Expand All @@ -65,7 +75,6 @@ WebInspector.ScopeChainSidebarPane.prototype = {
foundLocalScope = true;
title = WebInspector.UIString("Local");
emptyPlaceholder = WebInspector.UIString("No Variables");
var thisObject = callFrame.thisObject();
if (thisObject)
extraProperties.push(new WebInspector.RemoteObjectProperty("this", thisObject));
if (i == 0) {
Expand Down Expand Up @@ -122,7 +131,10 @@ WebInspector.ScopeChainSidebarPane.prototype = {
section.element.classList.add("scope-chain-sidebar-pane-section");
this.element.appendChild(section.element);
}
this._sidebarPaneUpdatedForTest();
},

_sidebarPaneUpdatedForTest: function() { },

__proto__: WebInspector.SidebarPane.prototype
}
Loading

0 comments on commit 47be2d5

Please sign in to comment.