| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 exceptionHandler = require('uncaught_exception_handler'); | 5 var exceptionHandler = require('uncaught_exception_handler'); |
| 6 var eventNatives = requireNative('event_natives'); | 6 var eventNatives = requireNative('event_natives'); |
| 7 var logging = requireNative('logging'); | 7 var logging = requireNative('logging'); |
| 8 var schemaRegistry = requireNative('schema_registry'); | 8 var schemaRegistry = requireNative('schema_registry'); |
| 9 var sendRequest = require('sendRequest').sendRequest; | 9 var sendRequest = require('sendRequest').sendRequest; |
| 10 var utils = require('utils'); | 10 var utils = require('utils'); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 }; | 352 }; |
| 353 | 353 |
| 354 EventImpl.prototype.dispatch_ = function(args, listenerIDs) { | 354 EventImpl.prototype.dispatch_ = function(args, listenerIDs) { |
| 355 if (this.destroyed) { | 355 if (this.destroyed) { |
| 356 throw new Error(this.eventName + ' was already destroyed at: ' + | 356 throw new Error(this.eventName + ' was already destroyed at: ' + |
| 357 this.destroyed); | 357 this.destroyed); |
| 358 } | 358 } |
| 359 if (!this.eventOptions.supportsListeners) | 359 if (!this.eventOptions.supportsListeners) |
| 360 throw new Error("This event does not support listeners."); | 360 throw new Error("This event does not support listeners."); |
| 361 | 361 |
| 362 if (this.argSchemas && logging.DCHECK_IS_ON()) { | 362 if (this.argSchemas && !logging.DCHECK_IS_OFF()) { |
| 363 try { | 363 try { |
| 364 validate(args, this.argSchemas); | 364 validate(args, this.argSchemas); |
| 365 } catch (e) { | 365 } catch (e) { |
| 366 e.message += ' in ' + this.eventName; | 366 e.message += ' in ' + this.eventName; |
| 367 throw e; | 367 throw e; |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 | 370 |
| 371 // Make a copy of the listeners in case the listener list is modified | 371 // Make a copy of the listeners in case the listener list is modified |
| 372 // while dispatching the event. | 372 // while dispatching the event. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 'removeRules', | 517 'removeRules', |
| 518 'getRules' | 518 'getRules' |
| 519 ] }); | 519 ] }); |
| 520 | 520 |
| 521 // NOTE: Event is (lazily) exposed as chrome.Event from dispatcher.cc. | 521 // NOTE: Event is (lazily) exposed as chrome.Event from dispatcher.cc. |
| 522 exports.Event = Event; | 522 exports.Event = Event; |
| 523 | 523 |
| 524 exports.dispatchEvent = dispatchEvent; | 524 exports.dispatchEvent = dispatchEvent; |
| 525 exports.parseEventOptions = parseEventOptions; | 525 exports.parseEventOptions = parseEventOptions; |
| 526 exports.registerArgumentMassager = registerArgumentMassager; | 526 exports.registerArgumentMassager = registerArgumentMassager; |
| OLD | NEW |