diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 22:59:25 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 22:59:25 +0000 |
commit | ce95d0324ab1b5c30ff21ff9ef21b073e0f9d030 (patch) | |
tree | 787736b269885eb0535bd30ad045d43ff8e40715 /chrome/renderer/resources | |
parent | 86693068111d56f16fd2ceee6bb87ac72030e371 (diff) | |
download | chromium_src-ce95d0324ab1b5c30ff21ff9ef21b073e0f9d030.zip chromium_src-ce95d0324ab1b5c30ff21ff9ef21b073e0f9d030.tar.gz chromium_src-ce95d0324ab1b5c30ff21ff9ef21b073e0f9d030.tar.bz2 |
Async extension callbacks now always fire and set chrome.extension.lastError on error.
Includes doc changes for extension.lastError and a browsertest.
BUG=17381
Review URL: http://codereview.chromium.org/172078
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23676 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/resources')
-rw-r--r-- | chrome/renderer/resources/extension_process_bindings.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index f132e55..3155c05 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -61,11 +61,16 @@ var chrome = chrome || {}; chromeHidden.handleResponse = function(requestId, name, success, response, error) { try { - if (!success) { - if (!error) + if (success) { + delete chrome.extension.lastError; + } else { + if (!error) { error = "Unknown error." + } console.error("Error during " + name + ": " + error); - return; + chrome.extension.lastError = { + "message": error + }; } if (callbacks[requestId]) { @@ -77,6 +82,7 @@ var chrome = chrome || {}; } } finally { delete callbacks[requestId]; + delete chrome.extension.lastError; } }; @@ -94,8 +100,9 @@ var chrome = chrome || {}; // Calls with one argument expect singular argument. Calls with multiple // expect a list. - if (argCount == 1) + if (argCount == 1) { request.args = args[0]; + } if (argCount > 1) { request.args = []; for (var k = 0; k < argCount; k++) { |