Skip to content

Commit

Permalink
squash 'resources/unpacked/devtools' changes from 902dfb7..64149c4
Browse files Browse the repository at this point in the history
64149c4 [DevTools] Prepare BreakpointManager for column level breakpoints
370750e DevTools: Clear gutter markers when uninstalling CodeMirror gutter
d81ab97 DevTools: Only give completions for expressions ending in . or [
0bfff2a DevTools: add the logging aspect into the PerformanceMonitor, plumb it over the remote debugging protocol, surface it in DevTools. Also adds proof of concept violation reporting for layout thrashing and long running tasks.
1ba980e [Devtools] Move canvas timeline out of experiments

git-subtree-dir: resources/unpacked/devtools
git-subtree-split: 64149c4
  • Loading branch information
darwin committed Nov 8, 2016
1 parent 87aed61 commit c7d2b97
Show file tree
Hide file tree
Showing 22 changed files with 198 additions and 934 deletions.
2 changes: 0 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -821,8 +821,6 @@ devtools_image_files = [
"front_end/Images/fileSystem.png",
"front_end/Images/forward.png",
"front_end/Images/frame.png",
"front_end/Images/graphLabelCalloutLeft.png",
"front_end/Images/graphLabelCalloutRight.png",
"front_end/Images/ic_info_black_18dp.svg",
"front_end/Images/ic_warning_black_18dp.svg",
"front_end/Images/navigationControls.png",
Expand Down
Binary file removed front_end/Images/graphLabelCalloutLeft.png
Binary file not shown.
Binary file removed front_end/Images/graphLabelCalloutRight.png
Binary file not shown.
18 changes: 13 additions & 5 deletions front_end/Tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,21 +517,29 @@
};

TestSuite.prototype.testConsoleOnNavigateBack = function() {
if (WebInspector.multitargetConsoleModel.messages().length === 1)
firstConsoleMessageReceived.call(this);

function filteredMessages() {
return WebInspector.multitargetConsoleModel.messages().filter(
a => a.source !== WebInspector.ConsoleMessage.MessageSource.Violation);
}

if (filteredMessages().length === 1)
firstConsoleMessageReceived.call(this, null);
else
WebInspector.multitargetConsoleModel.addEventListener(
WebInspector.ConsoleModel.Events.MessageAdded, firstConsoleMessageReceived, this);

function firstConsoleMessageReceived() {
function firstConsoleMessageReceived(event) {
if (event && event.data.source === WebInspector.ConsoleMessage.MessageSource.Violation)
return;
WebInspector.multitargetConsoleModel.removeEventListener(
WebInspector.ConsoleModel.Events.MessageAdded, firstConsoleMessageReceived, this);
this.evaluateInConsole_('clickLink();', didClickLink.bind(this));
}

function didClickLink() {
// Check that there are no new messages(command is not a message).
this.assertEquals(3, WebInspector.multitargetConsoleModel.messages().length);
this.assertEquals(3, filteredMessages().length);
this.evaluateInConsole_('history.back();', didNavigateBack.bind(this));
}

Expand All @@ -541,7 +549,7 @@
}

function didCompleteNavigation() {
this.assertEquals(7, WebInspector.multitargetConsoleModel.messages().length);
this.assertEquals(7, filteredMessages().length);
this.releaseControl();
}

Expand Down
39 changes: 21 additions & 18 deletions front_end/bindings/BreakpointManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ WebInspector.BreakpointManager = class extends WebInspector.Object {
this._debuggerWorkspaceBinding = debuggerWorkspaceBinding;

this._breakpointsActive = true;
/** @type {!Map<!WebInspector.UISourceCode, !Map<number, !Map<number, !Array<!WebInspector.BreakpointManager.Breakpoint>>>>} */
this._breakpointsForUISourceCode = new Map();
/** @type {!Map<!WebInspector.UISourceCode, !Array<!WebInspector.BreakpointManager.Breakpoint>>} */
this._breakpointsForPrimaryUISourceCode = new Map();
/** @type {!Multimap.<string, !WebInspector.BreakpointManager.Breakpoint>} */
this._provisionalBreakpoints = new Multimap();
Expand Down Expand Up @@ -151,9 +153,10 @@ WebInspector.BreakpointManager = class extends WebInspector.Object {
_uiSourceCodeAdded(event) {
var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data);
this._restoreBreakpoints(uiSourceCode);
if (uiSourceCode.contentType().hasScripts())
if (uiSourceCode.contentType().hasScripts()) {
uiSourceCode.addEventListener(
WebInspector.UISourceCode.Events.SourceMappingChanged, this._uiSourceCodeMappingChanged, this);
}
}

/**
Expand Down Expand Up @@ -242,25 +245,25 @@ WebInspector.BreakpointManager = class extends WebInspector.Object {
/**
* @param {!WebInspector.UISourceCode} uiSourceCode
* @param {number} lineNumber
* @param {number} columnNumber
* @return {?WebInspector.BreakpointManager.Breakpoint}
* @return {!Array<!WebInspector.BreakpointManager.Breakpoint>}
*/
findBreakpoint(uiSourceCode, lineNumber, columnNumber) {
findBreakpoints(uiSourceCode, lineNumber) {
var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode);
var lineBreakpoints = breakpoints ? breakpoints.get(String(lineNumber)) : null;
var columnBreakpoints = lineBreakpoints ? lineBreakpoints.get(String(columnNumber)) : null;
return columnBreakpoints ? columnBreakpoints[0] : null;
var lineBreakpoints = breakpoints ? breakpoints.get(lineNumber) : null;
return lineBreakpoints ? lineBreakpoints.valuesArray()[0] : [];
}

/**
* @param {!WebInspector.UISourceCode} uiSourceCode
* @param {number} lineNumber
* @param {number} columnNumber
* @return {?WebInspector.BreakpointManager.Breakpoint}
*/
findBreakpointOnLine(uiSourceCode, lineNumber) {
findBreakpoint(uiSourceCode, lineNumber, columnNumber) {
var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode);
var lineBreakpoints = breakpoints ? breakpoints.get(String(lineNumber)) : null;
return lineBreakpoints ? lineBreakpoints.valuesArray()[0][0] : null;
var lineBreakpoints = breakpoints ? breakpoints.get(lineNumber) : null;
var columnBreakpoints = lineBreakpoints ? lineBreakpoints.get(columnNumber) : null;
return columnBreakpoints ? columnBreakpoints[0] : null;
}

/**
Expand Down Expand Up @@ -371,15 +374,15 @@ WebInspector.BreakpointManager = class extends WebInspector.Object {
breakpoints = new Map();
this._breakpointsForUISourceCode.set(uiLocation.uiSourceCode, breakpoints);
}
var lineBreakpoints = breakpoints.get(String(uiLocation.lineNumber));
var lineBreakpoints = breakpoints.get(uiLocation.lineNumber);
if (!lineBreakpoints) {
lineBreakpoints = new Map();
breakpoints.set(String(uiLocation.lineNumber), lineBreakpoints);
breakpoints.set(uiLocation.lineNumber, lineBreakpoints);
}
var columnBreakpoints = lineBreakpoints.get(String(uiLocation.columnNumber));
var columnBreakpoints = lineBreakpoints.get(uiLocation.columnNumber);
if (!columnBreakpoints) {
columnBreakpoints = [];
lineBreakpoints.set(String(uiLocation.columnNumber), columnBreakpoints);
lineBreakpoints.set(uiLocation.columnNumber, columnBreakpoints);
}
columnBreakpoints.push(breakpoint);
this.dispatchEventToListeners(
Expand All @@ -395,17 +398,17 @@ WebInspector.BreakpointManager = class extends WebInspector.Object {
if (!breakpoints)
return;

var lineBreakpoints = breakpoints.get(String(uiLocation.lineNumber));
var lineBreakpoints = breakpoints.get(uiLocation.lineNumber);
if (!lineBreakpoints)
return;
var columnBreakpoints = lineBreakpoints.get(String(uiLocation.columnNumber));
var columnBreakpoints = lineBreakpoints.get(uiLocation.columnNumber);
if (!columnBreakpoints)
return;
columnBreakpoints.remove(breakpoint);
if (!columnBreakpoints.length)
lineBreakpoints.remove(String(uiLocation.columnNumber));
lineBreakpoints.remove(uiLocation.columnNumber);
if (!lineBreakpoints.size)
breakpoints.remove(String(uiLocation.lineNumber));
breakpoints.remove(uiLocation.lineNumber);
if (!breakpoints.size)
this._breakpointsForUISourceCode.remove(uiLocation.uiSourceCode);
this.dispatchEventToListeners(
Expand Down
2 changes: 2 additions & 0 deletions front_end/components/JavaScriptAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ WebInspector.JavaScriptAutocomplete.completionsForExpression = function(expressi

if (dotNotation || bracketNotation)
expressionString = expressionString.substr(0, lastIndex);
else
expressionString = '';

// User is entering float value, do not suggest anything.
if ((expressionString && !isNaN(expressionString)) || (!expressionString && query && !isNaN(query)))
Expand Down
26 changes: 22 additions & 4 deletions front_end/console/ConsoleView.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ WebInspector.ConsoleView = class extends WebInspector.VBox {
*/
_appendMessageToEnd(viewMessage) {
if (!this._filter.shouldBeVisible(viewMessage)) {
this._hiddenByFilterCount++;
if (this._filter.shouldBeVisibleByDefault(viewMessage))
this._hiddenByFilterCount++;
return;
}

Expand Down Expand Up @@ -1070,11 +1071,15 @@ WebInspector.ConsoleViewFilter = class extends WebInspector.Object {
filterBar.addFilter(this._textFilterUI);

this._hideNetworkMessagesCheckbox = new WebInspector.CheckboxFilterUI(
'hide-network-messages', WebInspector.UIString('Hide network messages'), true,
'', WebInspector.UIString('Hide network'), true,
WebInspector.moduleSetting('hideNetworkMessages'));
this._hideNetworkMessagesCheckbox.addEventListener(
WebInspector.FilterUI.Events.FilterChanged, this._filterChanged.bind(this), this);
this._hideViolationMessagesCheckbox = new WebInspector.CheckboxFilterUI(
'', WebInspector.UIString('Hide violations'), false,
WebInspector.moduleSetting('hideViolationMessages'));
WebInspector.moduleSetting('hideNetworkMessages').addChangeListener(this._filterChanged, this);
WebInspector.moduleSetting('hideViolationMessages').addChangeListener(this._filterChanged, this);
filterBar.addFilter(this._hideNetworkMessagesCheckbox);
filterBar.addFilter(this._hideViolationMessagesCheckbox);

var levels = [
{name: WebInspector.ConsoleMessage.MessageLevel.Error, label: WebInspector.UIString('Errors')},
Expand Down Expand Up @@ -1146,6 +1151,10 @@ WebInspector.ConsoleViewFilter = class extends WebInspector.Object {
viewMessage.consoleMessage().source === WebInspector.ConsoleMessage.MessageSource.Network)
return false;

if (WebInspector.moduleSetting('hideViolationMessages').get() &&
viewMessage.consoleMessage().source === WebInspector.ConsoleMessage.MessageSource.Violation)
return false;

if (viewMessage.consoleMessage().isGroupMessage())
return true;

Expand All @@ -1168,12 +1177,21 @@ WebInspector.ConsoleViewFilter = class extends WebInspector.Object {
return true;
}

/**
* @return {boolean}
*/
shouldBeVisibleByDefault(viewMessage) {
return viewMessage.consoleMessage().source !==
WebInspector.ConsoleMessage.MessageSource.Violation;
}

reset() {
this._messageURLFilters = {};
this._messageURLFiltersSetting.set(this._messageURLFilters);
this._messageLevelFiltersSetting.set({});
this._view._showAllMessagesCheckbox.inputElement.checked = true;
WebInspector.moduleSetting('hideNetworkMessages').set(false);
WebInspector.moduleSetting('hideViolationMessages').set(true);
this._textFilterUI.setValue('');
this._filterChanged();
}
Expand Down
13 changes: 8 additions & 5 deletions front_end/console/ConsoleViewMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ WebInspector.ConsoleViewMessage = class {
*/
_buildMessage(consoleMessage) {
var messageElement;
var messageText = consoleMessage.messageText;
if (consoleMessage.source === WebInspector.ConsoleMessage.MessageSource.ConsoleAPI) {
switch (consoleMessage.type) {
case WebInspector.ConsoleMessage.MessageType.Trace:
Expand All @@ -213,13 +214,13 @@ WebInspector.ConsoleViewMessage = class {
break;
case WebInspector.ConsoleMessage.MessageType.Profile:
case WebInspector.ConsoleMessage.MessageType.ProfileEnd:
messageElement = this._format([consoleMessage.messageText]);
messageElement = this._format([messageText]);
break;
default:
if (consoleMessage.parameters && consoleMessage.parameters.length === 1 &&
consoleMessage.parameters[0].type === 'string')
messageElement = this._tryFormatAsError(/** @type {string} */ (consoleMessage.parameters[0].value));
var args = consoleMessage.parameters || [consoleMessage.messageText];
var args = consoleMessage.parameters || [messageText];
messageElement = messageElement || this._format(args);
}
} else if (consoleMessage.source === WebInspector.ConsoleMessage.MessageSource.Network) {
Expand All @@ -237,14 +238,16 @@ WebInspector.ConsoleViewMessage = class {
' ', String(consoleMessage.request.statusCode), ' (', consoleMessage.request.statusText, ')');
} else {
var fragment = WebInspector.linkifyStringAsFragmentWithCustomLinkifier(
consoleMessage.messageText, linkifyRequest.bind(consoleMessage));
messageText, linkifyRequest.bind(consoleMessage));
messageElement.appendChild(fragment);
}
} else {
messageElement = this._format([consoleMessage.messageText]);
messageElement = this._format([messageText]);
}
} else {
var args = consoleMessage.parameters || [consoleMessage.messageText];
if (consoleMessage.source === WebInspector.ConsoleMessage.MessageSource.Violation)
messageText = WebInspector.UIString('[Violation] %s', messageText);
var args = consoleMessage.parameters || [messageText];
messageElement = this._format(args);
}
messageElement.classList.add('console-message-text');
Expand Down
2 changes: 1 addition & 1 deletion front_end/console/consoleView.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@
flex: 1;
}

.console-warning-level .repeated-message,
.console-error-level .repeated-message,
.console-revokedError-level .repeated-message,
.console-log-level .repeated-message,
.console-warning-level .repeated-message,
.console-debug-level .repeated-message,
.console-info-level .repeated-message {
display: flex;
Expand Down
12 changes: 12 additions & 0 deletions front_end/console/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@
{ "value": false, "title": "Show network messages" }
]
},
{
"type": "setting",
"category": "Console",
"title": "Hide violations",
"settingName": "hideViolationMessages",
"settingType": "boolean",
"defaultValue": true,
"options": [
{ "value": true, "title": "Hide violations" },
{ "value": false, "title": "Show violations" }
]
},
{
"type": "setting",
"category": "Console",
Expand Down
6 changes: 0 additions & 6 deletions front_end/main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ WebInspector.Main = class {
Runtime.experiments.register('audits2', 'Audits 2.0', true);
Runtime.experiments.register('autoAttachToCrossProcessSubframes', 'Auto-attach to cross-process subframes', true);
Runtime.experiments.register('blackboxJSFramesOnTimeline', 'Blackbox JavaScript frames on Timeline', true);
Runtime.experiments.register('canvasNetworkTimeline', 'Canvas based timeline in Network panel', true);
Runtime.experiments.register('colorContrastRatio', 'Contrast ratio line in color picker', true);
Runtime.experiments.register('continueToFirstInvocation', 'Continue to first invocation', true);
Runtime.experiments.register('emptySourceMapAutoStepping', 'Empty sourcemap auto-stepping');
Expand Down Expand Up @@ -1013,18 +1012,13 @@ WebInspector.BackendSettingsSync = class {
this._autoAttachSetting.addChangeListener(this._update, this);
this._disableJavascriptSetting = WebInspector.settings.moduleSetting('javaScriptDisabled');
this._disableJavascriptSetting.addChangeListener(this._update, this);
this._blockedEventsWarningSetting = WebInspector.settings.moduleSetting('blockedEventsWarningEnabled');
this._blockedEventsWarningSetting.addChangeListener(this._update, this);
WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capability.Browser);
}

/**
* @param {!WebInspector.Target} target
*/
_updateTarget(target) {
var blockedEventsWarningThresholdSeconds = 0.1;
target.pageAgent().setBlockedEventsWarningThreshold(
this._blockedEventsWarningSetting.get() ? blockedEventsWarningThresholdSeconds : 0);
target.pageAgent().setAutoAttachToCreatedPages(this._autoAttachSetting.get());
target.emulationAgent().setScriptExecutionDisabled(this._disableJavascriptSetting.get());
}
Expand Down
8 changes: 0 additions & 8 deletions front_end/main/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,6 @@
"settingType": "boolean",
"defaultValue": false
},
{
"type": "setting",
"category": "Console",
"title": "Report input events blocked for too long",
"settingName": "blockedEventsWarningEnabled",
"settingType": "boolean",
"defaultValue": true
},
{
"type": "@WebInspector.SettingUI",
"category": "Extensions",
Expand Down
Loading

0 comments on commit c7d2b97

Please sign in to comment.