| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 /** | 161 /** |
| 162 * @param {!Array<!WebInspector.EventTarget.EventDescriptor>} eventList | 162 * @param {!Array<!WebInspector.EventTarget.EventDescriptor>} eventList |
| 163 */ | 163 */ |
| 164 WebInspector.EventTarget.removeEventListeners = function(eventList) | 164 WebInspector.EventTarget.removeEventListeners = function(eventList) |
| 165 { | 165 { |
| 166 for (var i = 0; i < eventList.length; ++i) { | 166 for (var i = 0; i < eventList.length; ++i) { |
| 167 var eventInfo = eventList[i]; | 167 var eventInfo = eventList[i]; |
| 168 eventInfo.eventTarget.removeEventListener(eventInfo.eventType, eventInfo
.method, eventInfo.receiver); | 168 eventInfo.eventTarget.removeEventListener(eventInfo.eventType, eventInfo
.method, eventInfo.receiver); |
| 169 } | 169 } |
| 170 // Do not hold references on unused event descriptors. |
| 171 eventList.splice(0, eventList.length); |
| 170 } | 172 } |
| 171 | 173 |
| 172 WebInspector.EventTarget.prototype = { | 174 WebInspector.EventTarget.prototype = { |
| 173 /** | 175 /** |
| 174 * @param {string|symbol} eventType | 176 * @param {string|symbol} eventType |
| 175 * @param {function(!WebInspector.Event)} listener | 177 * @param {function(!WebInspector.Event)} listener |
| 176 * @param {!Object=} thisObject | 178 * @param {!Object=} thisObject |
| 177 * @return {!WebInspector.EventTarget.EventDescriptor} | 179 * @return {!WebInspector.EventTarget.EventDescriptor} |
| 178 */ | 180 */ |
| 179 addEventListener: function(eventType, listener, thisObject) { }, | 181 addEventListener: function(eventType, listener, thisObject) { }, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 208 * @param {(!Object|undefined)} receiver | 210 * @param {(!Object|undefined)} receiver |
| 209 * @param {function(?):?} method | 211 * @param {function(?):?} method |
| 210 */ | 212 */ |
| 211 WebInspector.EventTarget.EventDescriptor = function(eventTarget, eventType, rece
iver, method) | 213 WebInspector.EventTarget.EventDescriptor = function(eventTarget, eventType, rece
iver, method) |
| 212 { | 214 { |
| 213 this.eventTarget = eventTarget; | 215 this.eventTarget = eventTarget; |
| 214 this.eventType = eventType; | 216 this.eventType = eventType; |
| 215 this.receiver = receiver; | 217 this.receiver = receiver; |
| 216 this.method = method; | 218 this.method = method; |
| 217 } | 219 } |
| OLD | NEW |