Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 if (error) { | 584 if (error) { |
| 585 reject(null); | 585 reject(null); |
| 586 return; | 586 return; |
| 587 } | 587 } |
| 588 fulfill(payloads.map(createEventListener.bind(this))); | 588 fulfill(payloads.map(createEventListener.bind(this))); |
| 589 } | 589 } |
| 590 | 590 |
| 591 /** | 591 /** |
| 592 * @suppressReceiverCheck | 592 * @suppressReceiverCheck |
| 593 * @this {Node} | 593 * @this {Node} |
| 594 * @return {function(this:Node, string, function(), boolean=): undef ined} | 594 * @return {function(this:Node, string, function(), boolean=, boolea n=): undefined} |
| 595 */ | 595 */ |
| 596 function nodeRemoveEventListener() | 596 function nodeRemoveEventListener() |
| 597 { | 597 { |
| 598 return removeEventListenerWrapper.bind(this); | 598 return removeEventListenerWrapper.bind(this); |
| 599 /** | 599 /** |
| 600 * @param {string} type | 600 * @param {string} type |
| 601 * @param {function()} handler | 601 * @param {function()} handler |
| 602 * @param {boolean=} useCapture | 602 * @param {boolean=} useCapture |
| 603 * @param {boolean=} passive | |
| 603 * @this {Node} | 604 * @this {Node} |
| 604 */ | 605 */ |
| 605 function removeEventListenerWrapper(type, handler, useCapture) | 606 function removeEventListenerWrapper(type, handler, useCapture, p assive) |
| 606 { | 607 { |
| 607 this.removeEventListener(type, handler, useCapture); | 608 // TODO(dtapuska): Remove this one closure compiler is updat ed |
|
pfeldman
2016/03/30 21:20:06
We'd have to patch the externs once the spec final
dtapuska
2016/04/08 13:42:37
The spec is finalized; we are shipping in 51.
I'm
| |
| 609 // to handle EventListenerOptions and passive event listener s | |
| 610 // has shipped. Don't JSDoc these otherwise it will fail. | |
| 611 // @return {boolean|undefined|{capture: (boolean|undefined), passive: boolean}} | |
| 612 function eventListenerOptions() | |
| 613 { | |
| 614 if (passive && useCapture) | |
| 615 return {"capture": useCapture, "passive": passive}; | |
| 616 else if (passive) | |
| 617 return {"passive": passive}; | |
| 618 else | |
| 619 return useCapture; | |
| 620 } | |
| 621 this.removeEventListener(type, handler, eventListenerOptions ()); | |
| 608 if (this["on" + type]) | 622 if (this["on" + type]) |
| 609 this["on" + type] = null; | 623 this["on" + type] = null; |
| 610 } | 624 } |
| 611 } | 625 } |
| 612 | 626 |
| 613 /** | 627 /** |
| 614 * @this {!WebInspector.RemoteObject} | 628 * @this {!WebInspector.RemoteObject} |
| 615 * @param {!DOMDebuggerAgent.EventListener} payload | 629 * @param {!DOMDebuggerAgent.EventListener} payload |
| 616 */ | 630 */ |
| 617 function createEventListener(payload) | 631 function createEventListener(payload) |
| 618 { | 632 { |
| 619 return new WebInspector.EventListener(this._target, | 633 return new WebInspector.EventListener(this._target, |
| 620 payload.type, | 634 payload.type, |
| 621 payload.useCapture, | 635 payload.useCapture, |
| 636 payload.passive, | |
| 622 payload.handler ? this.tar get().runtimeModel.createRemoteObject(payload.handler) : null, | 637 payload.handler ? this.tar get().runtimeModel.createRemoteObject(payload.handler) : null, |
| 623 payload.originalHandler ? this.target().runtimeModel.createRemoteObject(payload.originalHandler) : null, | 638 payload.originalHandler ? this.target().runtimeModel.createRemoteObject(payload.originalHandler) : null, |
| 624 WebInspector.DebuggerModel .Location.fromPayload(this._debuggerModel, payload.location), | 639 WebInspector.DebuggerModel .Location.fromPayload(this._debuggerModel, payload.location), |
| 625 removeFunction); | 640 removeFunction); |
| 626 } | 641 } |
| 627 } | 642 } |
| 628 }, | 643 }, |
| 629 | 644 |
| 630 /** | 645 /** |
| 631 * @param {!Array.<string>} propertyPath | 646 * @param {!Array.<string>} propertyPath |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1629 { | 1644 { |
| 1630 if (!this._cachedDescription) { | 1645 if (!this._cachedDescription) { |
| 1631 var children = this._children(); | 1646 var children = this._children(); |
| 1632 this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}"; | 1647 this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}"; |
| 1633 } | 1648 } |
| 1634 return this._cachedDescription; | 1649 return this._cachedDescription; |
| 1635 }, | 1650 }, |
| 1636 | 1651 |
| 1637 __proto__: WebInspector.LocalJSONObject.prototype | 1652 __proto__: WebInspector.LocalJSONObject.prototype |
| 1638 } | 1653 } |
| OLD | NEW |