Index: extensions/renderer/resources/binding.js |
diff --git a/extensions/renderer/resources/binding.js b/extensions/renderer/resources/binding.js |
index b0c6afa4fa43a8fe01aabdad02a32a4ce1519771..6765a441bb0cdb280b8255fa8c0da3879e79b079 100644 |
--- a/extensions/renderer/resources/binding.js |
+++ b/extensions/renderer/resources/binding.js |
@@ -420,10 +420,19 @@ Binding.prototype = { |
addProperties(mod, schema); |
var availability = GetAvailability(schema.namespace); |
- if (!availability.is_available && $Object.keys(mod).length == 0) { |
- console.error('chrome.' + schema.namespace + ' is not available: ' + |
- availability.message); |
- return; |
+ if (!availability.is_available) { |
+ // The namespace isn't available, but some of its functions may be, so we |
+ // still allow access to the API. |
+ // |
+ // A special case is runtime.lastError which is only occasionally set, so |
+ // specifically check that availability. |
+ if ($Object.keys(mod).length == 0 && |
+ !(schema.namespace == 'runtime' && |
+ GetAvailability('runtime.lastError').is_available)) { |
Ken Rockot(use gerrit already)
2014/07/18 22:33:40
I'm not sure how to make this less confusing, but
not at google - send to devlin
2014/07/18 23:28:35
I was confused when I re-read my own CL. How does
|
+ console.error('chrome.' + schema.namespace + ' is not available: ' + |
+ availability.message); |
+ return; |
+ } |
} |
this.runHooks_(mod); |