Skip to content

Commit e99292e

Browse files
committed
squash 'resources/unpacked/devtools' changes from 5374413..61e53c7
61e53c7 DevTools: fix elements-panel-shadow-selection-on-refresh.html ad2130d [DevTools] Fix triggering browser back action while autocomplete d7cfb89 DevTools: Do not scroll the console to show the prompt when we select the console tab. 24dd832 Devtools: Cut color picker off at bottom instead of the top 0b8e1fe [DevTools] Introduce a setting for console autocomplete from history. f4d226f Devtools: Simplify actions and add debugger commands to command menu 68d7a8f Modify devtools to show passive event listeners. eb3b8d7 [DevTools] Fix to double wrapping IPv6 in square brackets 9dc7ef0 Rename ignore_cache and ignoreCache to bypass* unless it affects API git-subtree-dir: resources/unpacked/devtools git-subtree-split: 61e53c7
1 parent ee62c25 commit e99292e

27 files changed

+217
-132
lines changed

front_end/components/EventListenersUtils.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/** @typedef {{eventListeners:!Array<!WebInspector.EventListener>, internalHandlers:?WebInspector.RemoteArray}} */
66
WebInspector.FrameworkEventListenersObject;
77

8-
/** @typedef {{type: string, useCapture: boolean, handler: function()}} */
8+
/** @typedef {{type: string, useCapture: boolean, passive: boolean, handler: function()}} */
99
WebInspector.EventListenerObjectInInspectedPage;
1010

1111
/**
@@ -74,6 +74,8 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
7474
var type;
7575
/** @type {boolean} */
7676
var useCapture;
77+
/** @type {boolean} */
78+
var passive;
7779
/** @type {?WebInspector.RemoteObject} */
7880
var handler = null;
7981
/** @type {?WebInspector.RemoteObject} */
@@ -89,20 +91,21 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
8991
/**
9092
* @suppressReceiverCheck
9193
* @this {WebInspector.EventListenerObjectInInspectedPage}
92-
* @return {!{type:string, useCapture:boolean}}
94+
* @return {!{type:string, useCapture:boolean, passive:boolean}}
9395
*/
9496
function truncatePageEventListener()
9597
{
96-
return {type: this.type, useCapture: this.useCapture};
98+
return {type: this.type, useCapture: this.useCapture, passive: this.passive};
9799
}
98100

99101
/**
100-
* @param {!{type:string, useCapture: boolean}} truncatedListener
102+
* @param {!{type:string, useCapture: boolean, passive: boolean}} truncatedListener
101103
*/
102104
function storeTruncatedListener(truncatedListener)
103105
{
104106
type = truncatedListener.type;
105107
useCapture = truncatedListener.useCapture;
108+
passive = truncatedListener.passive;
106109
}
107110

108111
promises.push(listenerObject.callFunctionPromise(handlerFunction).then(assertCallFunctionResult).then(storeOriginalHandler).then(toTargetFunction).then(storeFunctionWithDetails));
@@ -176,7 +179,7 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
176179
{
177180
if (!location)
178181
throw new Error("Empty event listener's location");
179-
return new WebInspector.EventListener(handler._target, type, useCapture, handler, originalHandler, location, removeFunctionObject, "frameworkUser");
182+
return new WebInspector.EventListener(handler._target, type, useCapture, passive, handler, originalHandler, location, removeFunctionObject, "frameworkUser");
180183
}
181184
}
182185
}
@@ -271,8 +274,9 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
271274
{
272275
"handler": function(),
273276
"useCapture": true,
277+
"passive": false,
274278
"type": "change",
275-
"remove": function(type, handler, useCapture)
279+
"remove": function(type, handler, useCapture, passive)
276280
},
277281
...
278282
],
@@ -358,14 +362,17 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
358362
var useCapture = eventListener.useCapture;
359363
if (typeof useCapture !== "boolean")
360364
errorString += "event listener's useCapture isn't boolean or undefined, ";
365+
var passive = eventListener.passive;
366+
if (typeof passive !== "boolean")
367+
errorString += "event listener's passive isn't boolean or undefined, ";
361368
var handler = eventListener.handler;
362369
if (!handler || (typeof handler !== "function"))
363370
errorString += "event listener's handler isn't a function or empty, ";
364371
var remove = eventListener.remove;
365372
if (remove && (typeof remove !== "function"))
366373
errorString += "event listener's remove isn't a function, ";
367374
if (!errorString){
368-
return {type: type, useCapture: useCapture, handler: handler, remove: remove};
375+
return {type: type, useCapture: useCapture, passive: passive, handler: handler, remove: remove};
369376
} else {
370377
errorLines.push(errorString.substr(0, errorString.length - 2));
371378
return null;
@@ -433,6 +440,7 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
433440
var listener = {
434441
handler: frameworkListener.handler || frameworkListener,
435442
useCapture: true,
443+
passive: false,
436444
type: type
437445
};
438446
listener.remove = jQueryRemove.bind(node, frameworkListener.selector);
@@ -454,6 +462,7 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
454462
var listener = {
455463
handler: events[key],
456464
useCapture: true,
465+
passive: false,
457466
type: type
458467
};
459468
// We don't support removing for old version < 1.4 of jQuery because it doesn't provide API for getting "selector".

front_end/components/EventListenersView.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ WebInspector.EventListenersView.prototype = {
144144

145145
/**
146146
* @param {boolean} showFramework
147+
* @param {boolean} showPassive
148+
* @param {boolean} showBlocking
147149
*/
148-
showFrameworkListeners: function(showFramework)
150+
showFrameworkListeners: function(showFramework, showPassive, showBlocking)
149151
{
150152
var eventTypes = this._treeOutline.rootElement().children();
151153
for (var eventType of eventTypes) {
@@ -157,6 +159,10 @@ WebInspector.EventListenersView.prototype = {
157159
hidden = true;
158160
if (listenerType === "frameworkInternal" && showFramework)
159161
hidden = true;
162+
if (!showPassive && listenerElement.eventListener().passive())
163+
hidden = true;
164+
if (!showBlocking && !listenerElement.eventListener().passive())
165+
hidden = true;
160166
listenerElement.hidden = hidden;
161167
hiddenEventType = hiddenEventType && hidden;
162168
}
@@ -267,6 +273,7 @@ WebInspector.ObjectEventListenerBar.prototype = {
267273
var eventListener = this._eventListener;
268274
var runtimeModel = eventListener.target().runtimeModel;
269275
properties.push(runtimeModel.createRemotePropertyFromPrimitiveValue("useCapture", eventListener.useCapture()));
276+
properties.push(runtimeModel.createRemotePropertyFromPrimitiveValue("passive", eventListener.passive()));
270277
if (typeof eventListener.handler() !== "undefined")
271278
properties.push(new WebInspector.RemoteObjectProperty("handler", eventListener.handler()));
272279
WebInspector.ObjectPropertyTreeElement.populateWithProperties(this, properties, [], true, null);

front_end/console/ConsoleView.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ WebInspector.ConsoleView = function()
141141
var historyData = this._consoleHistorySetting.get();
142142
this._prompt.setHistoryData(historyData);
143143

144+
this._consoleHistoryAutocompleteSetting = WebInspector.moduleSetting("consoleHistoryAutocomplete");
145+
this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHistoryAutocompleteChanged, this);
146+
this._consoleHistoryAutocompleteChanged();
147+
144148
this._updateFilterStatus();
145149
WebInspector.moduleSetting("consoleTimestampsEnabled").addChangeListener(this._consoleTimestampsSettingChanged, this);
146150

@@ -170,6 +174,11 @@ WebInspector.ConsoleView.prototype = {
170174
this._prompt.setHistoryData([]);
171175
},
172176

177+
_consoleHistoryAutocompleteChanged: function()
178+
{
179+
this._prompt.setAddCompletionsFromHistory(this._consoleHistoryAutocompleteSetting.get());
180+
},
181+
173182
/**
174183
* @param {!WebInspector.Event} event
175184
*/
@@ -346,8 +355,10 @@ WebInspector.ConsoleView.prototype = {
346355
{
347356
if (this._promptElement === WebInspector.currentFocusElement())
348357
return;
349-
WebInspector.setCurrentFocusElement(this._promptElement);
358+
// Set caret position before setting focus in order to avoid scrolling
359+
// by focus().
350360
this._prompt.moveCaretToEndOfPrompt();
361+
WebInspector.setCurrentFocusElement(this._promptElement);
351362
},
352363

353364
restoreScrollPositions: function()

front_end/console/module.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@
9898
{ "value": true, "title": "Show timestamps" },
9999
{ "value": false, "title": "Hide timestamps" }
100100
]
101+
},
102+
{
103+
"type": "setting",
104+
"category": "Console",
105+
"title": "Autocomplete from history",
106+
"settingName": "consoleHistoryAutocomplete",
107+
"settingType": "boolean",
108+
"defaultValue": true,
109+
"options": [
110+
{ "value": true, "title": "Autocomplete from history" },
111+
{ "value": false, "title": "Do not autocomplete from history" }
112+
]
101113
}
102114
],
103115
"dependencies": [

front_end/elements/ElementsPanel.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ WebInspector.ElementsPanel.prototype = {
465465
}
466466
var node = nodeId ? domModel.nodeForId(nodeId) : null;
467467
selectNode.call(this, node);
468+
this._lastSelectedNodeSelectedForTest();
468469
}
469470

470471
if (this._omitDefaultSelection)
@@ -477,6 +478,8 @@ WebInspector.ElementsPanel.prototype = {
477478
delete this._selectedPathOnReset;
478479
},
479480

481+
_lastSelectedNodeSelectedForTest: function() { },
482+
480483
/**
481484
* @override
482485
*/

front_end/elements/EventListenersWidget.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,22 @@ WebInspector.EventListenersWidget = function()
3838

3939
this._showForAncestorsSetting = WebInspector.settings.createSetting("showEventListenersForAncestors", true);
4040
this._showForAncestorsSetting.addChangeListener(this.update.bind(this));
41+
42+
this._dispatchFilterBySetting = WebInspector.settings.createSetting("eventListenerDispatchFilterType", WebInspector.EventListenersWidget.DispatchFilterBy.All);
43+
this._dispatchFilterBySetting.addChangeListener(this.update.bind(this));
44+
4145
this._showFrameworkListenersSetting = WebInspector.settings.createSetting("showFrameowkrListeners", true);
4246
this._showFrameworkListenersSetting.addChangeListener(this._showFrameworkListenersChanged.bind(this));
4347
this._eventListenersView = new WebInspector.EventListenersView(this.element);
4448
WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.update, this);
4549
}
4650

51+
WebInspector.EventListenersWidget.DispatchFilterBy = {
52+
All : "All",
53+
Blocking : "Blocking",
54+
Passive : "Passive"
55+
}
56+
4757
/**
4858
* @return {!WebInspector.ElementsSidebarViewWrapperPane}
4959
*/
@@ -55,6 +65,24 @@ WebInspector.EventListenersWidget.createSidebarWrapper = function()
5565
refreshButton.addEventListener("click", widget.update.bind(widget));
5666
result.toolbar().appendToolbarItem(refreshButton);
5767
result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancestors"), widget._showForAncestorsSetting));
68+
var dispatchFilter = new WebInspector.ToolbarComboBox(widget._onDispatchFilterTypeChanged.bind(widget));
69+
70+
/**
71+
* @param {string} name
72+
* @param {string} value
73+
*/
74+
function addDispatchFilterOption(name, value)
75+
{
76+
var option = dispatchFilter.createOption(name, "", value);
77+
if (value === widget._dispatchFilterBySetting.get())
78+
dispatchFilter.select(option);
79+
}
80+
addDispatchFilterOption(WebInspector.UIString("All"), WebInspector.EventListenersWidget.DispatchFilterBy.All);
81+
addDispatchFilterOption(WebInspector.UIString("Passive"), WebInspector.EventListenersWidget.DispatchFilterBy.Passive);
82+
addDispatchFilterOption(WebInspector.UIString("Blocking"), WebInspector.EventListenersWidget.DispatchFilterBy.Blocking);
83+
dispatchFilter.setMaxWidth(200);
84+
result.toolbar().appendToolbarItem(dispatchFilter);
85+
5886
result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Framework listeners"), WebInspector.UIString("Resolve event listeners bound with framework"), widget._showFrameworkListenersSetting));
5987
return result;
6088
}
@@ -95,10 +123,20 @@ WebInspector.EventListenersWidget.prototype = {
95123
return Promise.all(promises).then(this._eventListenersView.addObjects.bind(this._eventListenersView)).then(this._showFrameworkListenersChanged.bind(this));
96124
},
97125

126+
/**
127+
* @param {!Event} event
128+
*/
129+
_onDispatchFilterTypeChanged: function(event)
130+
{
131+
this._dispatchFilterBySetting.set(event.target.value);
132+
},
98133

99134
_showFrameworkListenersChanged: function()
100135
{
101-
this._eventListenersView.showFrameworkListeners(this._showFrameworkListenersSetting.get());
136+
var dispatchFilter = this._dispatchFilterBySetting.get();
137+
var showPassive = dispatchFilter == WebInspector.EventListenersWidget.DispatchFilterBy.All || dispatchFilter == WebInspector.EventListenersWidget.DispatchFilterBy.Passive;
138+
var showBlocking = dispatchFilter == WebInspector.EventListenersWidget.DispatchFilterBy.All || dispatchFilter == WebInspector.EventListenersWidget.DispatchFilterBy.Blocking;
139+
this._eventListenersView.showFrameworkListeners(this._showFrameworkListenersSetting.get(), showPassive, showBlocking);
102140
},
103141

104142
/**

front_end/elements/spectrum.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
width: 232px;
44
height: 240px;
55
-webkit-user-select: none;
6+
/* Prevents the popover from jumping when focus() is called */
7+
display: block !important;
68
}
79

810
:host(.palettes-enabled) {

front_end/extensions/ExtensionServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,4 +1087,4 @@ WebInspector.extensionAPI = {};
10871087
defineCommonExtensionSymbols(WebInspector.extensionAPI);
10881088

10891089
/** @type {!WebInspector.ExtensionServer} */
1090-
WebInspector.extensionServer;
1090+
WebInspector.extensionServer;

front_end/network/NetworkPanel.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ WebInspector.NetworkPanel.prototype = {
166166

167167
function updateAction()
168168
{
169-
action.setState(setting.get().length ? "active" : "inactive");
169+
action.setToggled(!!setting.get().length);
170170
}
171171
},
172172

@@ -194,7 +194,6 @@ WebInspector.NetworkPanel.prototype = {
194194
_toggleRecord: function(toggled)
195195
{
196196
this._toggleRecordAction.setToggled(toggled);
197-
this._toggleRecordAction.setTitle(toggled ? WebInspector.UIString("Stop recording network log") : WebInspector.UIString("Record network log"));
198197
this._networkLogView.setRecording(toggled);
199198
if (!toggled && this._filmStripRecorder)
200199
this._filmStripRecorder.stopRecording(this._filmStripAvailable.bind(this));

front_end/network/module.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
"iconClass": "record-toolbar-item",
4444
"contextTypes": ["WebInspector.NetworkPanel"],
4545
"className": "WebInspector.NetworkPanel.RecordActionDelegate",
46+
"options": [
47+
{ "value": true, "title": "Record network log" },
48+
{ "value": false, "title": "Stop recording network log" }
49+
],
4650
"bindings": [
4751
{
4852
"platform": "windows,linux",

front_end/profiler/HeapSnapshotView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ WebInspector.HeapSnapshotProfileType.prototype = {
10611061

10621062
get buttonTooltip()
10631063
{
1064-
return WebInspector.UIString("Take heap snapshot.");
1064+
return WebInspector.UIString("Take heap snapshot");
10651065
},
10661066

10671067
/**
@@ -1279,7 +1279,7 @@ WebInspector.TrackingHeapSnapshotProfileType.prototype = {
12791279

12801280
get buttonTooltip()
12811281
{
1282-
return this._recording ? WebInspector.UIString("Stop recording heap profile.") : WebInspector.UIString("Start recording heap profile.");
1282+
return this._recording ? WebInspector.UIString("Stop recording heap profile") : WebInspector.UIString("Start recording heap profile");
12831283
},
12841284

12851285
/**

front_end/profiler/ProfilesPanel.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,8 @@ WebInspector.ProfilesPanel = function()
459459
var toolbar = new WebInspector.Toolbar("", toolbarContainerLeft);
460460

461461
this._toggleRecordAction = WebInspector.actionRegistry.action("profiler.toggle-recording");
462-
toolbar.appendToolbarItem(WebInspector.Toolbar.createActionButton(this._toggleRecordAction));
462+
this._toggleRecordButton = WebInspector.Toolbar.createActionButton(this._toggleRecordAction);
463+
toolbar.appendToolbarItem(this._toggleRecordButton);
463464

464465
this.clearResultsButton = new WebInspector.ToolbarButton(WebInspector.UIString("Clear all profiles"), "clear-toolbar-item");
465466
this.clearResultsButton.addEventListener("click", this._reset, this);
@@ -598,9 +599,9 @@ WebInspector.ProfilesPanel.prototype = {
598599
this._toggleRecordAction.setEnabled(enable);
599600
this._toggleRecordAction.setToggled(toggled);
600601
if (enable)
601-
this._toggleRecordAction.setTitle(this._selectedProfileType ? this._selectedProfileType.buttonTooltip : "");
602+
this._toggleRecordButton.setTitle(this._selectedProfileType ? this._selectedProfileType.buttonTooltip : "");
602603
else
603-
this._toggleRecordAction.setTitle(WebInspector.anotherProfilerActiveLabel());
604+
this._toggleRecordButton.setTitle(WebInspector.anotherProfilerActiveLabel());
604605
if (this._selectedProfileType)
605606
this._launcherView.updateProfileType(this._selectedProfileType, enable);
606607
},

front_end/sdk/NetworkRequest.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ WebInspector.NetworkRequest.prototype = {
207207
*/
208208
setRemoteAddress: function(ip, port)
209209
{
210-
if (ip.indexOf(":") !== -1)
211-
ip = "[" + ip + "]";
212210
this._remoteAddress = ip + ":" + port;
213211
this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.RemoteAddressChanged, this);
214212
},

0 commit comments

Comments
 (0)