| 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 Event = require('event_bindings').Event; | 5 var Event = require('event_bindings').Event; |
| 6 var forEach = require('utils').forEach; | 6 var forEach = require('utils').forEach; |
| 7 // Note: Beware sneaky getters/setters when using GetAvailbility(). Use safe/raw | 7 // Note: Beware sneaky getters/setters when using GetAvailbility(). Use safe/raw |
| 8 // variables as arguments. | 8 // variables as arguments. |
| 9 var GetAvailability = requireNative('v8_context').GetAvailability; | 9 var GetAvailability = requireNative('v8_context').GetAvailability; |
| 10 var exceptionHandler = require('uncaught_exception_handler'); | 10 var exceptionHandler = require('uncaught_exception_handler'); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 var name = prefix + '.' + apiName; | 77 var name = prefix + '.' + apiName; |
| 78 logActivity.LogAPICall(extensionId, name, $Array.slice(arguments)); | 78 logActivity.LogAPICall(extensionId, name, $Array.slice(arguments)); |
| 79 var stack = exceptionHandler.getExtensionStackTrace(); | 79 var stack = exceptionHandler.getExtensionStackTrace(); |
| 80 var callback = arguments[arguments.length - 1]; | 80 var callback = arguments[arguments.length - 1]; |
| 81 var args = $Array.slice(arguments, 0, arguments.length - 1); | 81 var args = $Array.slice(arguments, 0, arguments.length - 1); |
| 82 var keepAlivePromise = requireAsync('keep_alive').then(function(module) { | 82 var keepAlivePromise = requireAsync('keep_alive').then(function(module) { |
| 83 return module.createKeepAlive(); | 83 return module.createKeepAlive(); |
| 84 }); | 84 }); |
| 85 $Function.apply(customizedFunction, this, args).then(function(result) { | 85 $Function.apply(customizedFunction, this, args).then(function(result) { |
| 86 if (callback) { | 86 if (callback) { |
| 87 sendRequestHandler.safeCallbackApply(name, {'stack': stack}, callback, | 87 exceptionHandler.safeCallbackApply(name, {'stack': stack}, callback, |
| 88 [result]); | 88 [result]); |
| 89 } | 89 } |
| 90 }).catch(function(error) { | 90 }).catch(function(error) { |
| 91 if (callback) { | 91 if (callback) { |
| 92 var message = exceptionHandler.safeErrorToString(error, true); | 92 var message = exceptionHandler.safeErrorToString(error, true); |
| 93 lastError.run(name, message, stack, callback); | 93 lastError.run(name, message, stack, callback); |
| 94 } | 94 } |
| 95 }).then(function() { | 95 }).then(function() { |
| 96 keepAlivePromise.then(function(keepAlive) { | 96 keepAlivePromise.then(function(keepAlive) { |
| 97 keepAlive.close(); | 97 keepAlive.close(); |
| 98 }); | 98 }); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 availability.message); | 568 availability.message); |
| 569 return; | 569 return; |
| 570 } | 570 } |
| 571 | 571 |
| 572 this.runHooks_(mod, schema); | 572 this.runHooks_(mod, schema); |
| 573 return mod; | 573 return mod; |
| 574 } | 574 } |
| 575 }; | 575 }; |
| 576 | 576 |
| 577 exports.$set('Binding', Binding); | 577 exports.$set('Binding', Binding); |
| OLD | NEW |