Chromium Code Reviews| Index: extensions/renderer/resources/last_error.js |
| diff --git a/extensions/renderer/resources/last_error.js b/extensions/renderer/resources/last_error.js |
| index 8d53371827acd01eeaa12840bd71497b5bb90120..7c93721880030ef914083ffe9a7053f7a839cc43 100644 |
| --- a/extensions/renderer/resources/last_error.js |
| +++ b/extensions/renderer/resources/last_error.js |
| @@ -113,12 +113,28 @@ function run(name, message, stack, callback, args) { |
| try { |
| $Function.apply(callback, undefined, args); |
| } finally { |
| + if (!hasAccessed(targetChrome)) |
|
not at google - send to devlin
2015/01/20 17:41:35
This doesn't look right, it'll always print an err
robwu
2015/01/20 22:34:01
This is correct. Function run sets chrome.runtime.
not at google - send to devlin
2015/01/21 22:21:19
What am I missing here? If I do:
chrome.someNames
robwu
2015/01/21 23:21:09
callback is a user-supplied callback. That "// cod
not at google - send to devlin
2015/01/21 23:24:32
but if there isn't an error, it'll still print a n
robwu
2015/01/21 23:28:18
A few lines earlier, chrome.runtime.lastError is s
|
| + reportUncheckedLastError(name, message, stack); |
| clear(targetChrome); |
| } |
| } |
| +/** |
| + * Call this method when runtime.lastError was set but not checked. |
| + * This notifies the developer of the error via the (error) console. |
| + * |
| + * @param {string=} name - name of API. |
| + * @param {string} message - error description. |
| + * @param {string=} stack - Stack trace of the call up to the error. |
| + */ |
| +function reportUncheckedLastError(name, message, stack) { |
|
not at google - send to devlin
2015/01/20 17:41:35
Given that this method is under the "lastError" na
robwu
2015/01/20 22:34:01
If we couple this method with the chrome object, t
robwu
2015/01/21 23:21:09
Done.
|
| + console.error("Unchecked runtime.lastError while running " + |
| + (name || "unknown") + ": " + message + (stack ? "\n" + stack : "")); |
| +} |
| + |
| exports.clear = clear; |
| exports.hasAccessed = hasAccessed; |
| exports.hasError = hasError; |
| exports.set = set; |
| exports.run = run; |
| +exports.reportUncheckedLastError = reportUncheckedLastError; |