Skip to content

Commit

Permalink
squash 'resources/unpacked/devtools' changes from 5374413..61e53c7
Browse files Browse the repository at this point in the history
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
  • Loading branch information
darwin committed Apr 13, 2016
1 parent ee62c25 commit e99292e
Show file tree
Hide file tree
Showing 27 changed files with 217 additions and 132 deletions.
23 changes: 16 additions & 7 deletions front_end/components/EventListenersUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/** @typedef {{eventListeners:!Array<!WebInspector.EventListener>, internalHandlers:?WebInspector.RemoteArray}} */
WebInspector.FrameworkEventListenersObject;

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

/**
Expand Down Expand Up @@ -74,6 +74,8 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
var type;
/** @type {boolean} */
var useCapture;
/** @type {boolean} */
var passive;
/** @type {?WebInspector.RemoteObject} */
var handler = null;
/** @type {?WebInspector.RemoteObject} */
Expand All @@ -89,20 +91,21 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
/**
* @suppressReceiverCheck
* @this {WebInspector.EventListenerObjectInInspectedPage}
* @return {!{type:string, useCapture:boolean}}
* @return {!{type:string, useCapture:boolean, passive:boolean}}
*/
function truncatePageEventListener()
{
return {type: this.type, useCapture: this.useCapture};
return {type: this.type, useCapture: this.useCapture, passive: this.passive};
}

/**
* @param {!{type:string, useCapture: boolean}} truncatedListener
* @param {!{type:string, useCapture: boolean, passive: boolean}} truncatedListener
*/
function storeTruncatedListener(truncatedListener)
{
type = truncatedListener.type;
useCapture = truncatedListener.useCapture;
passive = truncatedListener.passive;
}

promises.push(listenerObject.callFunctionPromise(handlerFunction).then(assertCallFunctionResult).then(storeOriginalHandler).then(toTargetFunction).then(storeFunctionWithDetails));
Expand Down Expand Up @@ -176,7 +179,7 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
{
if (!location)
throw new Error("Empty event listener's location");
return new WebInspector.EventListener(handler._target, type, useCapture, handler, originalHandler, location, removeFunctionObject, "frameworkUser");
return new WebInspector.EventListener(handler._target, type, useCapture, passive, handler, originalHandler, location, removeFunctionObject, "frameworkUser");
}
}
}
Expand Down Expand Up @@ -271,8 +274,9 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
{
"handler": function(),
"useCapture": true,
"passive": false,
"type": "change",
"remove": function(type, handler, useCapture)
"remove": function(type, handler, useCapture, passive)
},
...
],
Expand Down Expand Up @@ -358,14 +362,17 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
var useCapture = eventListener.useCapture;
if (typeof useCapture !== "boolean")
errorString += "event listener's useCapture isn't boolean or undefined, ";
var passive = eventListener.passive;
if (typeof passive !== "boolean")
errorString += "event listener's passive isn't boolean or undefined, ";
var handler = eventListener.handler;
if (!handler || (typeof handler !== "function"))
errorString += "event listener's handler isn't a function or empty, ";
var remove = eventListener.remove;
if (remove && (typeof remove !== "function"))
errorString += "event listener's remove isn't a function, ";
if (!errorString){
return {type: type, useCapture: useCapture, handler: handler, remove: remove};
return {type: type, useCapture: useCapture, passive: passive, handler: handler, remove: remove};
} else {
errorLines.push(errorString.substr(0, errorString.length - 2));
return null;
Expand Down Expand Up @@ -433,6 +440,7 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
var listener = {
handler: frameworkListener.handler || frameworkListener,
useCapture: true,
passive: false,
type: type
};
listener.remove = jQueryRemove.bind(node, frameworkListener.selector);
Expand All @@ -454,6 +462,7 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
var listener = {
handler: events[key],
useCapture: true,
passive: false,
type: type
};
// We don't support removing for old version < 1.4 of jQuery because it doesn't provide API for getting "selector".
Expand Down
9 changes: 8 additions & 1 deletion front_end/components/EventListenersView.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ WebInspector.EventListenersView.prototype = {

/**
* @param {boolean} showFramework
* @param {boolean} showPassive
* @param {boolean} showBlocking
*/
showFrameworkListeners: function(showFramework)
showFrameworkListeners: function(showFramework, showPassive, showBlocking)
{
var eventTypes = this._treeOutline.rootElement().children();
for (var eventType of eventTypes) {
Expand All @@ -157,6 +159,10 @@ WebInspector.EventListenersView.prototype = {
hidden = true;
if (listenerType === "frameworkInternal" && showFramework)
hidden = true;
if (!showPassive && listenerElement.eventListener().passive())
hidden = true;
if (!showBlocking && !listenerElement.eventListener().passive())
hidden = true;
listenerElement.hidden = hidden;
hiddenEventType = hiddenEventType && hidden;
}
Expand Down Expand Up @@ -267,6 +273,7 @@ WebInspector.ObjectEventListenerBar.prototype = {
var eventListener = this._eventListener;
var runtimeModel = eventListener.target().runtimeModel;
properties.push(runtimeModel.createRemotePropertyFromPrimitiveValue("useCapture", eventListener.useCapture()));
properties.push(runtimeModel.createRemotePropertyFromPrimitiveValue("passive", eventListener.passive()));
if (typeof eventListener.handler() !== "undefined")
properties.push(new WebInspector.RemoteObjectProperty("handler", eventListener.handler()));
WebInspector.ObjectPropertyTreeElement.populateWithProperties(this, properties, [], true, null);
Expand Down
13 changes: 12 additions & 1 deletion front_end/console/ConsoleView.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ WebInspector.ConsoleView = function()
var historyData = this._consoleHistorySetting.get();
this._prompt.setHistoryData(historyData);

this._consoleHistoryAutocompleteSetting = WebInspector.moduleSetting("consoleHistoryAutocomplete");
this._consoleHistoryAutocompleteSetting.addChangeListener(this._consoleHistoryAutocompleteChanged, this);
this._consoleHistoryAutocompleteChanged();

this._updateFilterStatus();
WebInspector.moduleSetting("consoleTimestampsEnabled").addChangeListener(this._consoleTimestampsSettingChanged, this);

Expand Down Expand Up @@ -170,6 +174,11 @@ WebInspector.ConsoleView.prototype = {
this._prompt.setHistoryData([]);
},

_consoleHistoryAutocompleteChanged: function()
{
this._prompt.setAddCompletionsFromHistory(this._consoleHistoryAutocompleteSetting.get());
},

/**
* @param {!WebInspector.Event} event
*/
Expand Down Expand Up @@ -346,8 +355,10 @@ WebInspector.ConsoleView.prototype = {
{
if (this._promptElement === WebInspector.currentFocusElement())
return;
WebInspector.setCurrentFocusElement(this._promptElement);
// Set caret position before setting focus in order to avoid scrolling
// by focus().
this._prompt.moveCaretToEndOfPrompt();
WebInspector.setCurrentFocusElement(this._promptElement);
},

restoreScrollPositions: function()
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 @@ -98,6 +98,18 @@
{ "value": true, "title": "Show timestamps" },
{ "value": false, "title": "Hide timestamps" }
]
},
{
"type": "setting",
"category": "Console",
"title": "Autocomplete from history",
"settingName": "consoleHistoryAutocomplete",
"settingType": "boolean",
"defaultValue": true,
"options": [
{ "value": true, "title": "Autocomplete from history" },
{ "value": false, "title": "Do not autocomplete from history" }
]
}
],
"dependencies": [
Expand Down
3 changes: 3 additions & 0 deletions front_end/elements/ElementsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ WebInspector.ElementsPanel.prototype = {
}
var node = nodeId ? domModel.nodeForId(nodeId) : null;
selectNode.call(this, node);
this._lastSelectedNodeSelectedForTest();
}

if (this._omitDefaultSelection)
Expand All @@ -477,6 +478,8 @@ WebInspector.ElementsPanel.prototype = {
delete this._selectedPathOnReset;
},

_lastSelectedNodeSelectedForTest: function() { },

/**
* @override
*/
Expand Down
40 changes: 39 additions & 1 deletion front_end/elements/EventListenersWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,22 @@ WebInspector.EventListenersWidget = function()

this._showForAncestorsSetting = WebInspector.settings.createSetting("showEventListenersForAncestors", true);
this._showForAncestorsSetting.addChangeListener(this.update.bind(this));

this._dispatchFilterBySetting = WebInspector.settings.createSetting("eventListenerDispatchFilterType", WebInspector.EventListenersWidget.DispatchFilterBy.All);
this._dispatchFilterBySetting.addChangeListener(this.update.bind(this));

this._showFrameworkListenersSetting = WebInspector.settings.createSetting("showFrameowkrListeners", true);
this._showFrameworkListenersSetting.addChangeListener(this._showFrameworkListenersChanged.bind(this));
this._eventListenersView = new WebInspector.EventListenersView(this.element);
WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this.update, this);
}

WebInspector.EventListenersWidget.DispatchFilterBy = {
All : "All",
Blocking : "Blocking",
Passive : "Passive"
}

/**
* @return {!WebInspector.ElementsSidebarViewWrapperPane}
*/
Expand All @@ -55,6 +65,24 @@ WebInspector.EventListenersWidget.createSidebarWrapper = function()
refreshButton.addEventListener("click", widget.update.bind(widget));
result.toolbar().appendToolbarItem(refreshButton);
result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Ancestors"), WebInspector.UIString("Show listeners on the ancestors"), widget._showForAncestorsSetting));
var dispatchFilter = new WebInspector.ToolbarComboBox(widget._onDispatchFilterTypeChanged.bind(widget));

/**
* @param {string} name
* @param {string} value
*/
function addDispatchFilterOption(name, value)
{
var option = dispatchFilter.createOption(name, "", value);
if (value === widget._dispatchFilterBySetting.get())
dispatchFilter.select(option);
}
addDispatchFilterOption(WebInspector.UIString("All"), WebInspector.EventListenersWidget.DispatchFilterBy.All);
addDispatchFilterOption(WebInspector.UIString("Passive"), WebInspector.EventListenersWidget.DispatchFilterBy.Passive);
addDispatchFilterOption(WebInspector.UIString("Blocking"), WebInspector.EventListenersWidget.DispatchFilterBy.Blocking);
dispatchFilter.setMaxWidth(200);
result.toolbar().appendToolbarItem(dispatchFilter);

result.toolbar().appendToolbarItem(new WebInspector.ToolbarCheckbox(WebInspector.UIString("Framework listeners"), WebInspector.UIString("Resolve event listeners bound with framework"), widget._showFrameworkListenersSetting));
return result;
}
Expand Down Expand Up @@ -95,10 +123,20 @@ WebInspector.EventListenersWidget.prototype = {
return Promise.all(promises).then(this._eventListenersView.addObjects.bind(this._eventListenersView)).then(this._showFrameworkListenersChanged.bind(this));
},

/**
* @param {!Event} event
*/
_onDispatchFilterTypeChanged: function(event)
{
this._dispatchFilterBySetting.set(event.target.value);
},

_showFrameworkListenersChanged: function()
{
this._eventListenersView.showFrameworkListeners(this._showFrameworkListenersSetting.get());
var dispatchFilter = this._dispatchFilterBySetting.get();
var showPassive = dispatchFilter == WebInspector.EventListenersWidget.DispatchFilterBy.All || dispatchFilter == WebInspector.EventListenersWidget.DispatchFilterBy.Passive;
var showBlocking = dispatchFilter == WebInspector.EventListenersWidget.DispatchFilterBy.All || dispatchFilter == WebInspector.EventListenersWidget.DispatchFilterBy.Blocking;
this._eventListenersView.showFrameworkListeners(this._showFrameworkListenersSetting.get(), showPassive, showBlocking);
},

/**
Expand Down
2 changes: 2 additions & 0 deletions front_end/elements/spectrum.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
width: 232px;
height: 240px;
-webkit-user-select: none;
/* Prevents the popover from jumping when focus() is called */
display: block !important;
}

:host(.palettes-enabled) {
Expand Down
2 changes: 1 addition & 1 deletion front_end/extensions/ExtensionServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1087,4 +1087,4 @@ WebInspector.extensionAPI = {};
defineCommonExtensionSymbols(WebInspector.extensionAPI);

/** @type {!WebInspector.ExtensionServer} */
WebInspector.extensionServer;
WebInspector.extensionServer;
3 changes: 1 addition & 2 deletions front_end/network/NetworkPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ WebInspector.NetworkPanel.prototype = {

function updateAction()
{
action.setState(setting.get().length ? "active" : "inactive");
action.setToggled(!!setting.get().length);
}
},

Expand Down Expand Up @@ -194,7 +194,6 @@ WebInspector.NetworkPanel.prototype = {
_toggleRecord: function(toggled)
{
this._toggleRecordAction.setToggled(toggled);
this._toggleRecordAction.setTitle(toggled ? WebInspector.UIString("Stop recording network log") : WebInspector.UIString("Record network log"));
this._networkLogView.setRecording(toggled);
if (!toggled && this._filmStripRecorder)
this._filmStripRecorder.stopRecording(this._filmStripAvailable.bind(this));
Expand Down
4 changes: 4 additions & 0 deletions front_end/network/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
"iconClass": "record-toolbar-item",
"contextTypes": ["WebInspector.NetworkPanel"],
"className": "WebInspector.NetworkPanel.RecordActionDelegate",
"options": [
{ "value": true, "title": "Record network log" },
{ "value": false, "title": "Stop recording network log" }
],
"bindings": [
{
"platform": "windows,linux",
Expand Down
4 changes: 2 additions & 2 deletions front_end/profiler/HeapSnapshotView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ WebInspector.HeapSnapshotProfileType.prototype = {

get buttonTooltip()
{
return WebInspector.UIString("Take heap snapshot.");
return WebInspector.UIString("Take heap snapshot");
},

/**
Expand Down Expand Up @@ -1279,7 +1279,7 @@ WebInspector.TrackingHeapSnapshotProfileType.prototype = {

get buttonTooltip()
{
return this._recording ? WebInspector.UIString("Stop recording heap profile.") : WebInspector.UIString("Start recording heap profile.");
return this._recording ? WebInspector.UIString("Stop recording heap profile") : WebInspector.UIString("Start recording heap profile");
},

/**
Expand Down
7 changes: 4 additions & 3 deletions front_end/profiler/ProfilesPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ WebInspector.ProfilesPanel = function()
var toolbar = new WebInspector.Toolbar("", toolbarContainerLeft);

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

this.clearResultsButton = new WebInspector.ToolbarButton(WebInspector.UIString("Clear all profiles"), "clear-toolbar-item");
this.clearResultsButton.addEventListener("click", this._reset, this);
Expand Down Expand Up @@ -598,9 +599,9 @@ WebInspector.ProfilesPanel.prototype = {
this._toggleRecordAction.setEnabled(enable);
this._toggleRecordAction.setToggled(toggled);
if (enable)
this._toggleRecordAction.setTitle(this._selectedProfileType ? this._selectedProfileType.buttonTooltip : "");
this._toggleRecordButton.setTitle(this._selectedProfileType ? this._selectedProfileType.buttonTooltip : "");
else
this._toggleRecordAction.setTitle(WebInspector.anotherProfilerActiveLabel());
this._toggleRecordButton.setTitle(WebInspector.anotherProfilerActiveLabel());
if (this._selectedProfileType)
this._launcherView.updateProfileType(this._selectedProfileType, enable);
},
Expand Down
2 changes: 0 additions & 2 deletions front_end/sdk/NetworkRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ WebInspector.NetworkRequest.prototype = {
*/
setRemoteAddress: function(ip, port)
{
if (ip.indexOf(":") !== -1)
ip = "[" + ip + "]";
this._remoteAddress = ip + ":" + port;
this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.RemoteAddressChanged, this);
},
Expand Down
Loading

0 comments on commit e99292e

Please sign in to comment.