summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/resources/runtime_custom_bindings.js
diff options
context:
space:
mode:
authorrob <rob@robwu.nl>2015-02-24 02:44:14 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-24 10:45:03 +0000
commit6f445970476cf84cd737968f2558813de768c86e (patch)
tree802c8177529b238a5804db7da391557a492885eb /extensions/renderer/resources/runtime_custom_bindings.js
parent2672bd90ba63cb8b19e1b44b9512e52f036bd813 (diff)
downloadchromium_src-6f445970476cf84cd737968f2558813de768c86e.zip
chromium_src-6f445970476cf84cd737968f2558813de768c86e.tar.gz
chromium_src-6f445970476cf84cd737968f2558813de768c86e.tar.bz2
Make sure that extension callbacks are called only once
customCallback implementations must now explicitly call the (optional) callback. BUG=446035 R=kalman@chromium.org Review URL: https://codereview.chromium.org/830293002 Cr-Commit-Position: refs/heads/master@{#317778}
Diffstat (limited to 'extensions/renderer/resources/runtime_custom_bindings.js')
-rw-r--r--extensions/renderer/resources/runtime_custom_bindings.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/extensions/renderer/resources/runtime_custom_bindings.js b/extensions/renderer/resources/runtime_custom_bindings.js
index 2f0cb49..60c3bd0 100644
--- a/extensions/renderer/resources/runtime_custom_bindings.js
+++ b/extensions/renderer/resources/runtime_custom_bindings.js
@@ -41,11 +41,12 @@ if (window == backgroundPage) {
var GetIsolatedFileSystem = fileSystemNatives.GetIsolatedFileSystem;
var bindDirectoryEntryCallback = function(functionName, apiFunctions) {
apiFunctions.setCustomCallback(functionName,
- function(name, request, response) {
- if (request.callback && response) {
- var callback = request.callback;
- request.callback = null;
-
+ function(name, request, callback, response) {
+ if (callback) {
+ if (!response) {
+ callback();
+ return;
+ }
var fileSystemId = response.fileSystemId;
var baseName = response.baseName;
var fs = GetIsolatedFileSystem(fileSystemId);
@@ -191,12 +192,11 @@ binding.registerCustomHook(function(binding, id, contextType) {
});
apiFunctions.setCustomCallback('getBackgroundPage',
- function(name, request, response) {
- if (request.callback) {
+ function(name, request, callback, response) {
+ if (callback) {
var bg = runtimeNatives.GetExtensionViews(-1, 'BACKGROUND')[0] || null;
- request.callback(bg);
+ callback(bg);
}
- request.callback = null;
});
bindDirectoryEntryCallback('getPackageDirectoryEntry', apiFunctions);