| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 132 | 132 | 
| 133   function parseEventOptions(opt_eventOptions) { | 133   function parseEventOptions(opt_eventOptions) { | 
| 134     function merge(dest, src) { | 134     function merge(dest, src) { | 
| 135       for (var k in src) { | 135       for (var k in src) { | 
| 136         if (!$Object.hasOwnProperty(dest, k)) { | 136         if (!$Object.hasOwnProperty(dest, k)) { | 
| 137           dest[k] = src[k]; | 137           dest[k] = src[k]; | 
| 138         } | 138         } | 
| 139       } | 139       } | 
| 140     } | 140     } | 
| 141 | 141 | 
| 142     var options = opt_eventOptions || {}; | 142     var options = $Object.assign({}, opt_eventOptions || {}); | 
| 143     merge(options, { | 143     merge(options, { | 
| 144       // Event supports adding listeners with filters ("filtered events"), for | 144       // Event supports adding listeners with filters ("filtered events"), for | 
| 145       // example as used in the webNavigation API. | 145       // example as used in the webNavigation API. | 
| 146       // | 146       // | 
| 147       // event.addListener(listener, [filter1, filter2]); | 147       // event.addListener(listener, [filter1, filter2]); | 
| 148       supportsFilters: false, | 148       supportsFilters: false, | 
| 149 | 149 | 
| 150       // Events supports vanilla events. Most APIs use these. | 150       // Events supports vanilla events. Most APIs use these. | 
| 151       // | 151       // | 
| 152       // event.addListener(listener); | 152       // event.addListener(listener); | 
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 408     if (!this.eventOptions.supportsRules) | 408     if (!this.eventOptions.supportsRules) | 
| 409       throw new Error("This event does not support rules."); | 409       throw new Error("This event does not support rules."); | 
| 410 | 410 | 
| 411     // Takes a list of JSON datatype identifiers and returns a schema fragment | 411     // Takes a list of JSON datatype identifiers and returns a schema fragment | 
| 412     // that verifies that a JSON object corresponds to an array of only these | 412     // that verifies that a JSON object corresponds to an array of only these | 
| 413     // data types. | 413     // data types. | 
| 414     function buildArrayOfChoicesSchema(typesList) { | 414     function buildArrayOfChoicesSchema(typesList) { | 
| 415       return { | 415       return { | 
| 416         'type': 'array', | 416         'type': 'array', | 
| 417         'items': { | 417         'items': { | 
| 418           'choices': typesList.map(function(el) {return {'$ref': el};}) | 418           'choices': $Array.map(typesList, function(el) {return {'$ref': el};}) | 
| 419         } | 419         } | 
| 420       }; | 420       }; | 
| 421     }; | 421     }; | 
| 422 | 422 | 
| 423     // Validate conditions and actions against specific schemas of this | 423     // Validate conditions and actions against specific schemas of this | 
| 424     // event object type. | 424     // event object type. | 
| 425     // |rules| is an array of JSON objects that follow the Rule type of the | 425     // |rules| is an array of JSON objects that follow the Rule type of the | 
| 426     // declarative extension APIs. |conditions| is an array of JSON type | 426     // declarative extension APIs. |conditions| is an array of JSON type | 
| 427     // identifiers that are allowed to occur in the conditions attribute of each | 427     // identifiers that are allowed to occur in the conditions attribute of each | 
| 428     // rule. Likewise, |actions| is an array of JSON type identifiers that are | 428     // rule. Likewise, |actions| is an array of JSON type identifiers that are | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 501     'removeRules', | 501     'removeRules', | 
| 502     'getRules' | 502     'getRules' | 
| 503   ] }); | 503   ] }); | 
| 504 | 504 | 
| 505   // NOTE: Event is (lazily) exposed as chrome.Event from dispatcher.cc. | 505   // NOTE: Event is (lazily) exposed as chrome.Event from dispatcher.cc. | 
| 506   exports.$set('Event', Event); | 506   exports.$set('Event', Event); | 
| 507 | 507 | 
| 508   exports.$set('dispatchEvent', dispatchEvent); | 508   exports.$set('dispatchEvent', dispatchEvent); | 
| 509   exports.$set('parseEventOptions', parseEventOptions); | 509   exports.$set('parseEventOptions', parseEventOptions); | 
| 510   exports.$set('registerArgumentMassager', registerArgumentMassager); | 510   exports.$set('registerArgumentMassager', registerArgumentMassager); | 
| OLD | NEW | 
|---|