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

Unified Diff: third_party/WebKit/Source/devtools/front_end/common/Object.js

Issue 2261933002: DevTools: Use JS symbols instead of strings for eligible events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/common/Object.js
diff --git a/third_party/WebKit/Source/devtools/front_end/common/Object.js b/third_party/WebKit/Source/devtools/front_end/common/Object.js
index 821b436c39b98562d18a90ccde85e417bc8328bd..bba17b44d10ec931a83ad3387f2394d93be800ab 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/Object.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/Object.js
@@ -33,7 +33,7 @@ WebInspector.Object = function() {
WebInspector.Object.prototype = {
/**
* @override
- * @param {string} eventType
+ * @param {string|symbol} eventType
* @param {function(!WebInspector.Event)} listener
* @param {!Object=} thisObject
* @return {!WebInspector.EventTarget.EventDescriptor}
@@ -53,7 +53,7 @@ WebInspector.Object.prototype = {
/**
* @override
- * @param {string} eventType
+ * @param {string|symbol} eventType
* @param {function(!WebInspector.Event)} listener
* @param {!Object=} thisObject
*/
@@ -83,19 +83,17 @@ WebInspector.Object.prototype = {
/**
* @override
- * @param {string} eventType
+ * @param {string|symbol} eventType
* @return {boolean}
*/
hasEventListeners: function(eventType)
{
- if (!this._listeners || !this._listeners.has(eventType))
- return false;
- return true;
+ return this._listeners && this._listeners.has(eventType);
},
/**
* @override
- * @param {string} eventType
+ * @param {string|symbol} eventType
* @param {*=} eventData
* @return {boolean}
*/
@@ -119,7 +117,7 @@ WebInspector.Object.prototype = {
/**
* @constructor
* @param {!WebInspector.EventTarget} target
- * @param {string} type
+ * @param {string|symbol} type
* @param {*=} data
*/
WebInspector.Event = function(target, type, data)
@@ -173,7 +171,7 @@ WebInspector.EventTarget.removeEventListeners = function(eventList)
WebInspector.EventTarget.prototype = {
/**
- * @param {string} eventType
+ * @param {string|symbol} eventType
* @param {function(!WebInspector.Event)} listener
* @param {!Object=} thisObject
* @return {!WebInspector.EventTarget.EventDescriptor}
@@ -181,7 +179,7 @@ WebInspector.EventTarget.prototype = {
addEventListener: function(eventType, listener, thisObject) { },
/**
- * @param {string} eventType
+ * @param {string|symbol} eventType
* @param {function(!WebInspector.Event)} listener
* @param {!Object=} thisObject
*/
@@ -190,13 +188,13 @@ WebInspector.EventTarget.prototype = {
removeAllListeners: function() { },
/**
- * @param {string} eventType
+ * @param {string|symbol} eventType
* @return {boolean}
*/
hasEventListeners: function(eventType) { },
/**
- * @param {string} eventType
+ * @param {string|symbol} eventType
* @param {*=} eventData
* @return {boolean}
*/
@@ -206,7 +204,7 @@ WebInspector.EventTarget.prototype = {
/**
* @constructor
* @param {!WebInspector.EventTarget} eventTarget
- * @param {string} eventType
+ * @param {string|symbol} eventType
* @param {(!Object|undefined)} receiver
* @param {function(?):?} method
*/

Powered by Google App Engine
This is Rietveld 408576698