| Index: chrome/renderer/resources/extensions/bluetooth_custom_bindings.js
|
| diff --git a/chrome/renderer/resources/extensions/bluetooth_custom_bindings.js b/chrome/renderer/resources/extensions/bluetooth_custom_bindings.js
|
| index 9531b3a2d3f8b01bae3a206489531a09e624820c..273a094932499f99250e1181d5c58efa775f65d5 100644
|
| --- a/chrome/renderer/resources/extensions/bluetooth_custom_bindings.js
|
| +++ b/chrome/renderer/resources/extensions/bluetooth_custom_bindings.js
|
| @@ -19,10 +19,10 @@ binding.registerCustomHook(function(api) {
|
|
|
| chromeHidden.bluetooth = {};
|
|
|
| - function callCallbackIfPresent(args) {
|
| - if (typeof(args[args.length-1]) == "function") {
|
| - args[args.length-1]();
|
| - }
|
| + function callCallbackIfPresent(args, error) {
|
| + var callback = args[args.length - 1];
|
| + if (typeof(callback) == "function")
|
| + lastError.run(error, callback);
|
| }
|
|
|
| chromeHidden.bluetooth.deviceDiscoveredHandler = null;
|
| @@ -38,8 +38,7 @@ binding.registerCustomHook(function(api) {
|
| var args = arguments;
|
| if (args.length > 0 && args[0] && args[0].deviceCallback) {
|
| if (chromeHidden.bluetooth.deviceDiscoveredHandler != null) {
|
| - lastError.set("Concurrent discovery is not allowed.");
|
| - callCallbackIfPresent(args);
|
| + callCallbackIfPresent(args, "Concurrent discovery is not allowed.");
|
| return;
|
| }
|
|
|
| @@ -52,8 +51,9 @@ binding.registerCustomHook(function(api) {
|
| this.definition.parameters,
|
| {customCallback:this.customCallback});
|
| } else {
|
| - lastError.set("deviceCallback is required in the options object");
|
| - callCallbackIfPresent(args);
|
| + callCallbackIfPresent(
|
| + args, "deviceCallback is required in the options object");
|
| + return;
|
| }
|
| });
|
| apiFunctions.setCustomCallback('startDiscovery',
|
|
|