Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1969)

Unified Diff: chrome/renderer/resources/extensions/bluetooth_custom_bindings.js

Issue 12378077: Attempting to fix problems in 11571014. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: oops Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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',

Powered by Google App Engine
This is Rietveld 408576698