OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 native function GetExternalFileEntry(fileDefinition); | 10 native function GetExternalFileEntry(fileDefinition); |
11 | 11 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 var validationErrors = this.validate_(args); | 174 var validationErrors = this.validate_(args); |
175 if (validationErrors) { | 175 if (validationErrors) { |
176 return validationErrors; | 176 return validationErrors; |
177 } | 177 } |
178 } | 178 } |
179 for (var i = 0; i < this.listeners_.length; i++) { | 179 for (var i = 0; i < this.listeners_.length; i++) { |
180 try { | 180 try { |
181 this.listeners_[i].apply(null, args); | 181 this.listeners_[i].apply(null, args); |
182 } catch (e) { | 182 } catch (e) { |
183 console.error("Error in event handler for '" + this.eventName_ + | 183 console.error("Error in event handler for '" + this.eventName_ + |
184 "': " + e); | 184 "': " + e.stack); |
Matt Perry
2011/06/08 19:30:18
we should print the error message as well. does 's
Bernhard Bauer
2011/06/09 13:57:49
Yes, that's the topmost part.
| |
185 } | 185 } |
186 } | 186 } |
187 }; | 187 }; |
188 | 188 |
189 // Attaches this event object to its name. Only one object can have a given | 189 // Attaches this event object to its name. Only one object can have a given |
190 // name. | 190 // name. |
191 chrome.Event.prototype.attach_ = function() { | 191 chrome.Event.prototype.attach_ = function() { |
192 AttachEvent(this.eventName_); | 192 AttachEvent(this.eventName_); |
193 allAttachedEvents[allAttachedEvents.length] = this; | 193 allAttachedEvents[allAttachedEvents.length] = this; |
194 if (!this.eventName_) | 194 if (!this.eventName_) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 var event = allAttachedEvents[i]; | 241 var event = allAttachedEvents[i]; |
242 if (event) | 242 if (event) |
243 event.detach_(); | 243 event.detach_(); |
244 } | 244 } |
245 }; | 245 }; |
246 | 246 |
247 chromeHidden.dispatchError = function(msg) { | 247 chromeHidden.dispatchError = function(msg) { |
248 console.error(msg); | 248 console.error(msg); |
249 }; | 249 }; |
250 })(); | 250 })(); |
OLD | NEW |