diff --git a/front_end/components/EventListenersUtils.js b/front_end/components/EventListenersUtils.js
index 146a4bd9ad..acd0e066a6 100644
--- a/front_end/components/EventListenersUtils.js
+++ b/front_end/components/EventListenersUtils.js
@@ -5,7 +5,7 @@
/** @typedef {{eventListeners:!Array, internalHandlers:?WebInspector.RemoteArray}} */
WebInspector.FrameworkEventListenersObject;
-/** @typedef {{type: string, useCapture: boolean, handler: function()}} */
+/** @typedef {{type: string, useCapture: boolean, passive: boolean, handler: function()}} */
WebInspector.EventListenerObjectInInspectedPage;
/**
@@ -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} */
@@ -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));
@@ -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");
}
}
}
@@ -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)
},
...
],
@@ -358,6 +362,9 @@ 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, ";
@@ -365,7 +372,7 @@ WebInspector.EventListener.frameworkEventListeners = function(object)
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;
@@ -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);
@@ -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".
diff --git a/front_end/components/EventListenersView.js b/front_end/components/EventListenersView.js
index 17f30a7aaa..bd469c9d9b 100644
--- a/front_end/components/EventListenersView.js
+++ b/front_end/components/EventListenersView.js
@@ -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) {
@@ -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;
}
@@ -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);
diff --git a/front_end/console/ConsoleView.js b/front_end/console/ConsoleView.js
index 851347821a..12985579d0 100644
--- a/front_end/console/ConsoleView.js
+++ b/front_end/console/ConsoleView.js
@@ -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);
@@ -170,6 +174,11 @@ WebInspector.ConsoleView.prototype = {
this._prompt.setHistoryData([]);
},
+ _consoleHistoryAutocompleteChanged: function()
+ {
+ this._prompt.setAddCompletionsFromHistory(this._consoleHistoryAutocompleteSetting.get());
+ },
+
/**
* @param {!WebInspector.Event} event
*/
@@ -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()
diff --git a/front_end/console/module.json b/front_end/console/module.json
index 2cdde5847b..fc1657eb2c 100644
--- a/front_end/console/module.json
+++ b/front_end/console/module.json
@@ -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": [
diff --git a/front_end/elements/ElementsPanel.js b/front_end/elements/ElementsPanel.js
index 62fddf550b..fca8a3437d 100644
--- a/front_end/elements/ElementsPanel.js
+++ b/front_end/elements/ElementsPanel.js
@@ -465,6 +465,7 @@ WebInspector.ElementsPanel.prototype = {
}
var node = nodeId ? domModel.nodeForId(nodeId) : null;
selectNode.call(this, node);
+ this._lastSelectedNodeSelectedForTest();
}
if (this._omitDefaultSelection)
@@ -477,6 +478,8 @@ WebInspector.ElementsPanel.prototype = {
delete this._selectedPathOnReset;
},
+ _lastSelectedNodeSelectedForTest: function() { },
+
/**
* @override
*/
diff --git a/front_end/elements/EventListenersWidget.js b/front_end/elements/EventListenersWidget.js
index efbf6506b8..0ae03f13af 100644
--- a/front_end/elements/EventListenersWidget.js
+++ b/front_end/elements/EventListenersWidget.js
@@ -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}
*/
@@ -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;
}
@@ -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);
},
/**
diff --git a/front_end/elements/spectrum.css b/front_end/elements/spectrum.css
index 47db1a50a0..6036c7b442 100644
--- a/front_end/elements/spectrum.css
+++ b/front_end/elements/spectrum.css
@@ -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) {
diff --git a/front_end/extensions/ExtensionServer.js b/front_end/extensions/ExtensionServer.js
index bfeb759389..9d8161edae 100644
--- a/front_end/extensions/ExtensionServer.js
+++ b/front_end/extensions/ExtensionServer.js
@@ -1087,4 +1087,4 @@ WebInspector.extensionAPI = {};
defineCommonExtensionSymbols(WebInspector.extensionAPI);
/** @type {!WebInspector.ExtensionServer} */
-WebInspector.extensionServer;
\ No newline at end of file
+WebInspector.extensionServer;
diff --git a/front_end/network/NetworkPanel.js b/front_end/network/NetworkPanel.js
index 79e97141c2..64686efb8f 100644
--- a/front_end/network/NetworkPanel.js
+++ b/front_end/network/NetworkPanel.js
@@ -166,7 +166,7 @@ WebInspector.NetworkPanel.prototype = {
function updateAction()
{
- action.setState(setting.get().length ? "active" : "inactive");
+ action.setToggled(!!setting.get().length);
}
},
@@ -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));
diff --git a/front_end/network/module.json b/front_end/network/module.json
index 9f3188f9bf..8e1945e5c1 100644
--- a/front_end/network/module.json
+++ b/front_end/network/module.json
@@ -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",
diff --git a/front_end/profiler/HeapSnapshotView.js b/front_end/profiler/HeapSnapshotView.js
index 420833a219..57afb91463 100644
--- a/front_end/profiler/HeapSnapshotView.js
+++ b/front_end/profiler/HeapSnapshotView.js
@@ -1061,7 +1061,7 @@ WebInspector.HeapSnapshotProfileType.prototype = {
get buttonTooltip()
{
- return WebInspector.UIString("Take heap snapshot.");
+ return WebInspector.UIString("Take heap snapshot");
},
/**
@@ -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");
},
/**
diff --git a/front_end/profiler/ProfilesPanel.js b/front_end/profiler/ProfilesPanel.js
index e8ecd195a2..46bc71b381 100644
--- a/front_end/profiler/ProfilesPanel.js
+++ b/front_end/profiler/ProfilesPanel.js
@@ -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);
@@ -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);
},
diff --git a/front_end/sdk/NetworkRequest.js b/front_end/sdk/NetworkRequest.js
index 1cd8eadd50..47956d3318 100644
--- a/front_end/sdk/NetworkRequest.js
+++ b/front_end/sdk/NetworkRequest.js
@@ -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);
},
diff --git a/front_end/sdk/RemoteObject.js b/front_end/sdk/RemoteObject.js
index ee63ffe509..bba2c6e5f6 100644
--- a/front_end/sdk/RemoteObject.js
+++ b/front_end/sdk/RemoteObject.js
@@ -591,7 +591,7 @@ WebInspector.RemoteObjectImpl.prototype = {
/**
* @suppressReceiverCheck
* @this {Node}
- * @return {function(this:Node, string, function(), boolean=): undefined}
+ * @return {function(this:Node, string, function(), boolean=, boolean=): undefined}
*/
function nodeRemoveEventListener()
{
@@ -600,11 +600,27 @@ WebInspector.RemoteObjectImpl.prototype = {
* @param {string} type
* @param {function()} handler
* @param {boolean=} useCapture
+ * @param {boolean=} passive
* @this {Node}
*/
- function removeEventListenerWrapper(type, handler, useCapture)
+ function removeEventListenerWrapper(type, handler, useCapture, passive)
{
- this.removeEventListener(type, handler, useCapture);
+ // TODO(dtapuska): Remove this one closure compiler is updated
+ // to handle EventListenerOptions and passive event listeners
+ // has shipped. Don't JSDoc these otherwise it will fail.
+ // @return {boolean|undefined|{capture: (boolean|undefined), passive: boolean}}
+ function eventListenerOptions()
+ {
+ if (passive && useCapture)
+ return {"capture": useCapture, "passive": passive};
+ else if (passive)
+ return {"passive": passive};
+ else if (useCapture)
+ return {"capture": useCapture};
+ else
+ return {};
+ }
+ this.removeEventListener(type, handler, eventListenerOptions());
if (this["on" + type])
this["on" + type] = null;
}
@@ -619,6 +635,7 @@ WebInspector.RemoteObjectImpl.prototype = {
return new WebInspector.EventListener(this._target,
payload.type,
payload.useCapture,
+ payload.passive,
payload.handler ? this.target().runtimeModel.createRemoteObject(payload.handler) : null,
payload.originalHandler ? this.target().runtimeModel.createRemoteObject(payload.originalHandler) : null,
WebInspector.DebuggerModel.Location.fromPayload(this._debuggerModel, payload.location),
diff --git a/front_end/sdk/ResourceTreeModel.js b/front_end/sdk/ResourceTreeModel.js
index 639981f2e7..d6f98629ef 100644
--- a/front_end/sdk/ResourceTreeModel.js
+++ b/front_end/sdk/ResourceTreeModel.js
@@ -444,21 +444,21 @@ WebInspector.ResourceTreeModel.prototype = {
},
/**
- * @param {boolean=} ignoreCache
+ * @param {boolean=} bypassCache
* @param {string=} scriptToEvaluateOnLoad
*/
- reloadPage: function(ignoreCache, scriptToEvaluateOnLoad)
+ reloadPage: function(bypassCache, scriptToEvaluateOnLoad)
{
// Only dispatch PageReloadRequested upon first reload request to simplify client logic.
if (!this._pendingReloadOptions)
this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.PageReloadRequested);
if (this._reloadSuspensionCount) {
- this._pendingReloadOptions = [ignoreCache, scriptToEvaluateOnLoad];
+ this._pendingReloadOptions = [bypassCache, scriptToEvaluateOnLoad];
return;
}
this._pendingReloadOptions = null;
this.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.WillReloadPage);
- this._agent.reload(ignoreCache, scriptToEvaluateOnLoad);
+ this._agent.reload(bypassCache, scriptToEvaluateOnLoad);
},
__proto__: WebInspector.SDKModel.prototype
diff --git a/front_end/sdk/RuntimeModel.js b/front_end/sdk/RuntimeModel.js
index 5d3a91ffa1..bd8c6cb9f3 100644
--- a/front_end/sdk/RuntimeModel.js
+++ b/front_end/sdk/RuntimeModel.js
@@ -613,17 +613,19 @@ WebInspector.ExecutionContext.prototype = {
* @param {!WebInspector.Target} target
* @param {string} type
* @param {boolean} useCapture
+ * @param {boolean} passive
* @param {?WebInspector.RemoteObject} handler
* @param {?WebInspector.RemoteObject} originalHandler
* @param {!WebInspector.DebuggerModel.Location} location
* @param {?WebInspector.RemoteObject} removeFunction
* @param {string=} listenerType
*/
-WebInspector.EventListener = function(target, type, useCapture, handler, originalHandler, location, removeFunction, listenerType)
+WebInspector.EventListener = function(target, type, useCapture, passive, handler, originalHandler, location, removeFunction, listenerType)
{
WebInspector.SDKObject.call(this, target);
this._type = type;
this._useCapture = useCapture;
+ this._passive = passive;
this._handler = handler;
this._originalHandler = originalHandler || handler;
this._location = location;
@@ -650,6 +652,14 @@ WebInspector.EventListener.prototype = {
return this._useCapture;
},
+ /**
+ * @return {boolean}
+ */
+ passive: function()
+ {
+ return this._passive;
+ },
+
/**
* @return {?WebInspector.RemoteObject}
*/
@@ -709,18 +719,20 @@ WebInspector.EventListener.prototype = {
WebInspector.RemoteObject.toCallArgument(this._removeFunction),
WebInspector.RemoteObject.toCallArgument(this._type),
WebInspector.RemoteObject.toCallArgument(this._originalHandler),
- WebInspector.RemoteObject.toCallArgument(this._useCapture)
+ WebInspector.RemoteObject.toCallArgument(this._useCapture),
+ WebInspector.RemoteObject.toCallArgument(this._passive),
], success);
/**
- * @param {function(string, function(), boolean)} func
+ * @param {function(string, function(), boolean, boolean)} func
* @param {string} type
* @param {function()} listener
* @param {boolean} useCapture
+ * @param {boolean} passive
*/
- function callCustomRemove(func, type, listener, useCapture)
+ function callCustomRemove(func, type, listener, useCapture, passive)
{
- func.call(null, type, listener, useCapture);
+ func.call(null, type, listener, useCapture, passive);
}
}
},
diff --git a/front_end/sdk/TargetManager.js b/front_end/sdk/TargetManager.js
index 793109e805..51994bd458 100644
--- a/front_end/sdk/TargetManager.js
+++ b/front_end/sdk/TargetManager.js
@@ -108,13 +108,13 @@ WebInspector.TargetManager.prototype = {
},
/**
- * @param {boolean=} ignoreCache
+ * @param {boolean=} bypassCache
* @param {string=} injectedScript
*/
- reloadPage: function(ignoreCache, injectedScript)
+ reloadPage: function(bypassCache, injectedScript)
{
if (this._targets.length)
- this._targets[0].resourceTreeModel.reloadPage(ignoreCache, injectedScript);
+ this._targets[0].resourceTreeModel.reloadPage(bypassCache, injectedScript);
},
/**
diff --git a/front_end/sdk/module.json b/front_end/sdk/module.json
index 6554e9c50b..dd2f07ec6b 100644
--- a/front_end/sdk/module.json
+++ b/front_end/sdk/module.json
@@ -25,9 +25,14 @@
},
{
"type": "setting",
+ "category": "Debugger",
"settingName": "pauseOnExceptionEnabled",
"settingType": "boolean",
- "defaultValue": false
+ "defaultValue": false,
+ "options": [
+ { "value": true, "title": "Pause on exceptions" },
+ { "value": false, "title": "Do not pause on exceptions" }
+ ]
},
{
"type": "setting",
@@ -37,9 +42,14 @@
},
{
"type": "setting",
+ "category": "Debugger",
"settingName": "enableAsyncStackTraces",
"settingType": "boolean",
- "defaultValue": false
+ "defaultValue": false,
+ "options": [
+ { "value": true, "title": "Capture async stack traces" },
+ { "value": false, "title": "Do not capture async stack traces" }
+ ]
},
{
"type": "setting",
diff --git a/front_end/sources/SourcesPanel.js b/front_end/sources/SourcesPanel.js
index 396c95fb9c..75a6afd448 100644
--- a/front_end/sources/SourcesPanel.js
+++ b/front_end/sources/SourcesPanel.js
@@ -45,8 +45,6 @@ WebInspector.SourcesPanel = function(workspaceForTest)
this._stepIntoAction = WebInspector.actionRegistry.action("debugger.step-into");
this._stepOutAction = WebInspector.actionRegistry.action("debugger.step-out");
this._toggleBreakpointsActiveAction = WebInspector.actionRegistry.action("debugger.toggle-breakpoints-active");
- this._toggleBreakpointsActiveAction.setToggled(false);
- this._toggleBreakpointsActiveAction.setTitle(WebInspector.UIString("Deactivate breakpoints"));
this._debugToolbar = this._createDebugToolbar();
this._debugToolbarDrawer = this._createDebugToolbarDrawer();
@@ -466,14 +464,12 @@ WebInspector.SourcesPanel.prototype = {
this._stepIntoAction.setEnabled(false);
this._stepOutAction.setEnabled(false);
} else if (this._paused) {
- this._togglePauseAction.setTitle(WebInspector.UIString("Resume script execution"));
this._togglePauseAction.setToggled(true);
this._togglePauseAction.setEnabled(true);
this._stepOverAction.setEnabled(true);
this._stepIntoAction.setEnabled(true);
this._stepOutAction.setEnabled(true);
} else {
- this._togglePauseAction.setTitle(WebInspector.UIString("Pause script execution"));
this._togglePauseAction.setToggled(false);
this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing());
this._stepOverAction.setEnabled(false);
@@ -703,10 +699,6 @@ WebInspector.SourcesPanel.prototype = {
this._toggleBreakpointsActiveAction.setToggled(!active);
this.sidebarPanes.jsBreakpoints.listElement.classList.toggle("breakpoints-list-deactivated", !active);
this._sourcesView.toggleBreakpointsActiveState(active);
- if (active)
- this._toggleBreakpointsActiveAction.setTitle(WebInspector.UIString("Deactivate breakpoints"));
- else
- this._toggleBreakpointsActiveAction.setTitle(WebInspector.UIString("Activate breakpoints"));
},
/**
diff --git a/front_end/sources/module.json b/front_end/sources/module.json
index c5095fa3bd..44007b4f92 100644
--- a/front_end/sources/module.json
+++ b/front_end/sources/module.json
@@ -14,11 +14,15 @@
},
{
"type": "@WebInspector.ActionDelegate",
+ "category": "Debugger",
"actionId": "debugger.toggle-pause",
"iconClass": "pause-toolbar-item",
"className": "WebInspector.SourcesPanel.RevealingActionDelegate",
"contextTypes": ["WebInspector.SourcesPanel", "WebInspector.ShortcutRegistry.ForwardedShortcut"],
- "title": "Toggle paused",
+ "options": [
+ { "value": true, "title": "Pause script execution" },
+ { "value": false, "title": "Resume script execution" }
+ ],
"bindings": [
{
"platform": "windows,linux",
@@ -121,10 +125,15 @@
},
{
"type": "@WebInspector.ActionDelegate",
+ "category": "Debugger",
"actionId": "debugger.toggle-breakpoints-active",
"iconClass": "breakpoint-toolbar-item",
"className": "WebInspector.SourcesPanel.DebuggingActionDelegate",
"contextTypes": ["WebInspector.SourcesPanel"],
+ "options": [
+ { "value": true, "title": "Deactivate breakpoints" },
+ { "value": false, "title": "Activate breakpoints" }
+ ],
"bindings": [
{
"platform": "windows,linux",
diff --git a/front_end/timeline/TimelinePanel.js b/front_end/timeline/TimelinePanel.js
index fcd5f5b543..2cbb7b2e31 100644
--- a/front_end/timeline/TimelinePanel.js
+++ b/front_end/timeline/TimelinePanel.js
@@ -653,10 +653,6 @@ WebInspector.TimelinePanel.prototype = {
_updateTimelineControls: function()
{
var state = WebInspector.TimelinePanel.State;
- var title =
- this._state === state.Idle ? WebInspector.UIString("Record") :
- this._state === state.Recording ? WebInspector.UIString("Stop") : "";
- this._toggleRecordAction.setTitle(title);
this._toggleRecordAction.setToggled(this._state === state.Recording);
this._toggleRecordAction.setEnabled(this._state === state.Recording || this._state === state.Idle);
this._panelToolbar.setEnabled(this._state !== state.Loading);
diff --git a/front_end/timeline/module.json b/front_end/timeline/module.json
index 95d02032de..1692e0c73b 100644
--- a/front_end/timeline/module.json
+++ b/front_end/timeline/module.json
@@ -31,6 +31,10 @@
"iconClass": "record-toolbar-item",
"contextTypes": ["WebInspector.TimelinePanel"],
"className": "WebInspector.TimelinePanel.ActionDelegate",
+ "options": [
+ { "value": true, "title": "Record" },
+ { "value": false, "title": "Stop" }
+ ],
"bindings": [
{
"platform": "windows,linux",
diff --git a/front_end/ui/ActionRegistry.js b/front_end/ui/ActionRegistry.js
index 5d59aa8cf1..91318b1a61 100644
--- a/front_end/ui/ActionRegistry.js
+++ b/front_end/ui/ActionRegistry.js
@@ -87,36 +87,14 @@ WebInspector.Action = function(extension)
this._extension = extension;
this._enabled = true;
this._toggled = false;
- this._title = this._extension.descriptor()["title"] || "";
-
- this._statesCount = this._extension.descriptor()["states"] || 2;
- if (this._statesCount == 2)
- this._state = WebInspector.Action._ToggleState.Off;
- else
- this._state = "0";
-}
-
-WebInspector.Action._ToggleState = {
- On: "on",
- Off: "off"
}
WebInspector.Action.Events = {
Enabled: "Enabled",
- StateChanged: "StateChanged",
- TitleChanged: "TitleChanged",
+ Toggled: "Toggled"
}
WebInspector.Action.prototype = {
-
- /**
- * @return {number}
- */
- statesCount: function()
- {
- return this._statesCount;
- },
-
/**
* @return {string}
*/
@@ -173,18 +151,6 @@ WebInspector.Action.prototype = {
return this._enabled;
},
- /**
- * @param {string} title
- */
- setTitle: function(title)
- {
- if (this._title === title)
- return;
-
- this._title = title;
- this.dispatchEventToListeners(WebInspector.Action.Events.TitleChanged, this._title);
- },
-
/**
* @return {string}
*/
@@ -206,28 +172,15 @@ WebInspector.Action.prototype = {
*/
title: function()
{
- return this._title;
- },
-
- /**
- * @return {string}
- */
- state: function()
- {
- return this._state;
- },
-
- /**
- * @param {string} newState
- */
- setState: function(newState)
- {
- if (this._state === newState)
- return;
-
- var oldState = this._state;
- this._state = newState;
- this.dispatchEventToListeners(WebInspector.Action.Events.StateChanged, {oldState: oldState, newState: newState})
+ var title = this._extension.title(WebInspector.platform());
+ var options = this._extension.descriptor()["options"];
+ if (options) {
+ for (var pair of options) {
+ if (pair["value"] !== this._toggled)
+ title = pair["title"];
+ }
+ }
+ return title;
},
/**
@@ -235,9 +188,7 @@ WebInspector.Action.prototype = {
*/
toggled: function()
{
- if (this._statesCount !== 2)
- throw("Only used toggled when there are 2 states, otherwise, use state");
- return this.state() === WebInspector.Action._ToggleState.On;
+ return this._toggled;
},
/**
@@ -245,9 +196,11 @@ WebInspector.Action.prototype = {
*/
setToggled: function(toggled)
{
- if (this._statesCount !== 2)
- throw("Only used toggled when there are 2 states, otherwise, use state");
- this.setState(toggled ? WebInspector.Action._ToggleState.On : WebInspector.Action._ToggleState.Off);
+ if (this._toggled === toggled)
+ return;
+
+ this._toggled = toggled;
+ this.dispatchEventToListeners(WebInspector.Action.Events.Toggled, toggled);
},
__proto__: WebInspector.Object.prototype
diff --git a/front_end/ui/Popover.js b/front_end/ui/Popover.js
index c17ef693ca..5b13ba50d0 100644
--- a/front_end/ui/Popover.js
+++ b/front_end/ui/Popover.js
@@ -243,7 +243,7 @@ WebInspector.Popover.prototype = {
}
this.element.className = WebInspector.Popover._classNamePrefix + " " + verticalAlignment + "-" + horizontalAlignment + "-arrow";
- this.element.positionAt(newElementPosition.x, newElementPosition.y - borderWidth, container);
+ this.element.positionAt(newElementPosition.x, Math.max(0, newElementPosition.y - borderWidth), container);
this.element.style.width = newElementPosition.width + borderWidth * 2 + "px";
this.element.style.height = newElementPosition.height + borderWidth * 2 + "px";
},
diff --git a/front_end/ui/TextPrompt.js b/front_end/ui/TextPrompt.js
index 79952d3939..4b7917c161 100644
--- a/front_end/ui/TextPrompt.js
+++ b/front_end/ui/TextPrompt.js
@@ -586,6 +586,11 @@ WebInspector.TextPrompt.prototype = {
*/
_applySuggestion: function(completionText, isIntermediateSuggestion)
{
+ if (!this._userEnteredRange) {
+ // We could have already cleared autocompletion range by the time this is called. (crbug.com/587683)
+ return;
+ }
+
var wordPrefixLength = this._userEnteredText ? this._userEnteredText.length : 0;
this._userEnteredRange.deleteContents();
@@ -814,6 +819,8 @@ WebInspector.TextPromptWithHistory = function(completions, stopCharacters)
* @type {number}
*/
this._historyOffset = 1;
+
+ this._addCompletionsFromHistory = true;
}
WebInspector.TextPromptWithHistory.prototype = {
@@ -833,7 +840,7 @@ WebInspector.TextPromptWithHistory.prototype = {
*/
additionalCompletions: function(prefix)
{
- if (!this.isCaretAtEndOfPrompt())
+ if (!this._addCompletionsFromHistory || !this.isCaretAtEndOfPrompt())
return [];
var result = [];
var text = this.text();
@@ -859,6 +866,14 @@ WebInspector.TextPromptWithHistory.prototype = {
this._historyOffset = 1;
},
+ /**
+ * @param {boolean} value
+ */
+ setAddCompletionsFromHistory: function(value)
+ {
+ this._addCompletionsFromHistory = value;
+ },
+
/**
* Pushes a committed text into the history.
* @param {string} text
diff --git a/front_end/ui/Toolbar.js b/front_end/ui/Toolbar.js
index c57e0cf7b4..a2e3af24b7 100644
--- a/front_end/ui/Toolbar.js
+++ b/front_end/ui/Toolbar.js
@@ -485,26 +485,19 @@ WebInspector.ToolbarToggle.prototype = {
*/
WebInspector.Toolbar.createActionButton = function(action, toggledOptions, untoggledOptions)
{
- var button = new WebInspector.ToolbarButton(action.title(), action.icon());
+ var button = new WebInspector.ToolbarToggle(action.title(), action.icon());
button.addEventListener("click", action.execute, action);
action.addEventListener(WebInspector.Action.Events.Enabled, enabledChanged);
- action.addEventListener(WebInspector.Action.Events.StateChanged, stateChanged);
- action.addEventListener(WebInspector.Action.Events.TitleChanged, titleChanged);
+ action.addEventListener(WebInspector.Action.Events.Toggled, toggled);
/** @type {?WebInspector.LongClickController} */
var longClickController = null;
/** @type {?Array} */
var longClickButtons = null;
/** @type {?Element} */
var longClickGlyph = null;
- titleChanged();
- stateChanged();
+ toggled();
return button;
- function titleChanged()
- {
- WebInspector.Tooltip.install(button.element, action.title(), action.id());
- }
-
/**
* @param {!WebInspector.Event} event
*/
@@ -513,17 +506,16 @@ WebInspector.Toolbar.createActionButton = function(action, toggledOptions, untog
button.setEnabled(/** @type {boolean} */ (event.data));
}
- function stateChanged()
+ function toggled()
{
- button.setState(action.state());
+ button.setToggled(action.toggled());
+ if (action.title())
+ WebInspector.Tooltip.install(button.element, action.title(), action.id());
updateOptions();
}
function updateOptions()
{
- if (action.statesCount() !== 2)
- return;
-
var buttons = action.toggled() ? (toggledOptions || null) : (untoggledOptions || null);
if (buttons && buttons.length) {
@@ -546,7 +538,7 @@ WebInspector.Toolbar.createActionButton = function(action, toggledOptions, untog
function showOptions()
{
var buttons = longClickButtons.slice();
- var mainButtonClone = new WebInspector.ToolbarButton(action.title(), action.icon());
+ var mainButtonClone = new WebInspector.ToolbarToggle(action.title(), action.icon());
mainButtonClone.addEventListener("click", clicked);
/**
@@ -557,7 +549,7 @@ WebInspector.Toolbar.createActionButton = function(action, toggledOptions, untog
button._clicked(/** @type {!Event} */ (event.data));
}
- mainButtonClone.setState(action.state());
+ mainButtonClone.setToggled(action.toggled());
buttons.push(mainButtonClone);
var document = button.element.ownerDocument;
diff --git a/protocol.json b/protocol.json
index e069b4d511..211e420f16 100644
--- a/protocol.json
+++ b/protocol.json
@@ -3786,6 +3786,7 @@
"properties": [
{ "name": "type", "type": "string", "description": "EventListener
's type." },
{ "name": "useCapture", "type": "boolean", "description": "EventListener
's useCapture." },
+ { "name": "passive", "type": "boolean", "description": "EventListener
's passive flag." },
{ "name": "location", "$ref": "Debugger.Location", "description": "Handler code location." },
{ "name": "handler", "$ref": "Runtime.RemoteObject", "optional": true, "description": "Event handler function value." },
{ "name": "originalHandler", "$ref": "Runtime.RemoteObject", "optional": true, "description": "Event original handler function value." }