Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| index db5021ec290bf34878827f1fb7c43ee639d19fb8..69c190cebbf092d89ef5d361b34203a5886536d3 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js |
| @@ -562,6 +562,9 @@ WebInspector.RemoteObjectImpl.prototype = { |
| /** @type {?WebInspector.RemoteObject} */ |
| var removeFunction = null; |
| + /** @type {?WebInspector.RemoteObject} */ |
| + var togglePassiveFunction = null; |
| + |
| this.callFunctionPromise(nodeRemoveEventListener).then(storeRemoveFunction.bind(this)); |
| /** |
| @@ -572,6 +575,19 @@ WebInspector.RemoteObjectImpl.prototype = { |
| { |
| if (!result.wasThrown && result.object) |
| removeFunction = result.object; |
| + |
| + this.callFunctionPromise(nodeTogglePassiveEventListener).then(storeTogglePassiveFunction.bind(this)); |
|
caseq
2016/06/01 17:48:11
I think this is getting a bit too complicated. Act
dtapuska
2016/06/01 17:54:37
I completely agree. I tried passing back an array
kozy
2016/06/01 19:05:01
It was added here to align implementation for nati
dtapuska
2016/06/01 20:22:58
Do you mean just calling this from EventListenersV
|
| + } |
| + |
| + /** |
| + * @param {!WebInspector.CallFunctionResult} result |
| + * @this {WebInspector.RemoteObject} |
| + */ |
| + function storeTogglePassiveFunction(result) |
| + { |
| + if (!result.wasThrown && result.object) |
| + togglePassiveFunction = result.object; |
| + |
| this.target().domdebuggerAgent().getEventListeners(this._objectId, mycallback.bind(this)); |
| } |
| @@ -628,6 +644,39 @@ WebInspector.RemoteObjectImpl.prototype = { |
| } |
| /** |
| + * @suppressReceiverCheck |
| + * @this {Node} |
| + * @return {function(this:Node, string, function(), boolean, boolean): undefined} |
| + */ |
| + function nodeTogglePassiveEventListener() |
| + { |
| + return togglePassiveListenerWrapper.bind(this); |
| + /** |
| + * @param {string} type |
| + * @param {function()} handler |
| + * @param {boolean} useCapture |
| + * @param {boolean} passive |
| + * @this {Node} |
| + */ |
| + function togglePassiveListenerWrapper(type, handler, useCapture, passive) |
| + { |
| + // 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 {{capture: boolean, passive: boolean}} |
| + function eventListenerOptions() |
| + { |
| + return {"capture": useCapture, "passive": passive}; |
| + } |
| + this.removeEventListener(type, handler, eventListenerOptions()); |
| + passive = !passive; |
| + this.addEventListener(type, handler, eventListenerOptions()); |
| + if (this["on" + type]) |
| + this["on" + type] = null; |
|
caseq
2016/06/01 17:48:11
Not sure if this is something you want to do on to
dtapuska
2016/06/02 16:02:11
Acknowledged.
|
| + } |
| + } |
| + |
| + /** |
| * @this {!WebInspector.RemoteObject} |
| * @param {!DOMDebuggerAgent.EventListener} payload |
| */ |
| @@ -640,7 +689,8 @@ WebInspector.RemoteObjectImpl.prototype = { |
| 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), |
| - removeFunction); |
| + removeFunction, |
| + togglePassiveFunction); |
| } |
| } |
| }, |