| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var chrome = chrome || {}; | 5 var chrome = chrome || {}; |
| 6 (function () { | 6 (function () { |
| 7 native function GetChromeHidden(); | 7 native function GetChromeHidden(); |
| 8 native function AttachEvent(eventName); | 8 native function AttachEvent(eventName); |
| 9 native function DetachEvent(eventName); | 9 native function DetachEvent(eventName); |
| 10 | 10 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 if (this.validate_) { | 158 if (this.validate_) { |
| 159 var validationErrors = this.validate_(args); | 159 var validationErrors = this.validate_(args); |
| 160 if (validationErrors) { | 160 if (validationErrors) { |
| 161 return validationErrors; | 161 return validationErrors; |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 for (var i = 0; i < this.listeners_.length; i++) { | 164 for (var i = 0; i < this.listeners_.length; i++) { |
| 165 try { | 165 try { |
| 166 this.listeners_[i].apply(null, args); | 166 this.listeners_[i].apply(null, args); |
| 167 } catch (e) { | 167 } catch (e) { |
| 168 console.log(e.stack); |
| 168 console.error(e); | 169 console.error(e); |
| 169 } | 170 } |
| 170 } | 171 } |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 // Attaches this event object to its name. Only one object can have a given | 174 // Attaches this event object to its name. Only one object can have a given |
| 174 // name. | 175 // name. |
| 175 chrome.Event.prototype.attach_ = function() { | 176 chrome.Event.prototype.attach_ = function() { |
| 176 AttachEvent(this.eventName_); | 177 AttachEvent(this.eventName_); |
| 177 allAttachedEvents[allAttachedEvents.length] = this; | 178 allAttachedEvents[allAttachedEvents.length] = this; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 var event = allAttachedEvents[i]; | 220 var event = allAttachedEvents[i]; |
| 220 if (event) | 221 if (event) |
| 221 event.detach_(); | 222 event.detach_(); |
| 222 } | 223 } |
| 223 } | 224 } |
| 224 | 225 |
| 225 chromeHidden.dispatchError = function(msg) { | 226 chromeHidden.dispatchError = function(msg) { |
| 226 console.error(msg); | 227 console.error(msg); |
| 227 } | 228 } |
| 228 })(); | 229 })(); |
| OLD | NEW |