Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/RemoteObject.js

Issue 1845493004: Modify devtools to show passive event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor change Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 if (useCapture)
619 return {"capture": useCapture};
620 else
621 return {};
622 }
623 this.removeEventListener(type, handler, eventListenerOptions ());
608 if (this["on" + type]) 624 if (this["on" + type])
609 this["on" + type] = null; 625 this["on" + type] = null;
610 } 626 }
611 } 627 }
612 628
613 /** 629 /**
614 * @this {!WebInspector.RemoteObject} 630 * @this {!WebInspector.RemoteObject}
615 * @param {!DOMDebuggerAgent.EventListener} payload 631 * @param {!DOMDebuggerAgent.EventListener} payload
616 */ 632 */
617 function createEventListener(payload) 633 function createEventListener(payload)
618 { 634 {
619 return new WebInspector.EventListener(this._target, 635 return new WebInspector.EventListener(this._target,
620 payload.type, 636 payload.type,
621 payload.useCapture, 637 payload.useCapture,
638 payload.passive,
622 payload.handler ? this.tar get().runtimeModel.createRemoteObject(payload.handler) : null, 639 payload.handler ? this.tar get().runtimeModel.createRemoteObject(payload.handler) : null,
623 payload.originalHandler ? this.target().runtimeModel.createRemoteObject(payload.originalHandler) : null, 640 payload.originalHandler ? this.target().runtimeModel.createRemoteObject(payload.originalHandler) : null,
624 WebInspector.DebuggerModel .Location.fromPayload(this._debuggerModel, payload.location), 641 WebInspector.DebuggerModel .Location.fromPayload(this._debuggerModel, payload.location),
625 removeFunction); 642 removeFunction);
626 } 643 }
627 } 644 }
628 }, 645 },
629 646
630 /** 647 /**
631 * @param {!Array.<string>} propertyPath 648 * @param {!Array.<string>} propertyPath
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 { 1646 {
1630 if (!this._cachedDescription) { 1647 if (!this._cachedDescription) {
1631 var children = this._children(); 1648 var children = this._children();
1632 this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}"; 1649 this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}";
1633 } 1650 }
1634 return this._cachedDescription; 1651 return this._cachedDescription;
1635 }, 1652 },
1636 1653
1637 __proto__: WebInspector.LocalJSONObject.prototype 1654 __proto__: WebInspector.LocalJSONObject.prototype
1638 } 1655 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698