Index: extensions/renderer/resources/send_request.js |
diff --git a/extensions/renderer/resources/send_request.js b/extensions/renderer/resources/send_request.js |
index 7cdc7d16936a19a267258e217ccc4fd0a853433c..361a00fed49802569a2d6a936e9224132261a43d 100644 |
--- a/extensions/renderer/resources/send_request.js |
+++ b/extensions/renderer/resources/send_request.js |
@@ -73,15 +73,10 @@ function handleResponse(requestId, name, success, responseList, error) { |
safeCallbackApply(name, request, request.callback, responseList); |
} |
- if (error && |
- !lastError.hasAccessed(chrome) && |
- !lastError.hasAccessed(callerChrome)) { |
- // The native call caused an error, but the developer didn't check |
- // runtime.lastError. |
- // Notify the developer of the error via the (error) console. |
- console.error("Unchecked runtime.lastError while running " + |
- (name || "unknown") + ": " + error + |
- (request.stack ? "\n" + request.stack : "")); |
+ if (error && !lastError.hasAccessed(chrome)) { |
not at google - send to devlin
2015/01/22 18:01:33
The second part of this condition is unnecessary g
robwu
2015/01/22 18:07:22
Look at the original code, there is a check for |c
not at google - send to devlin
2015/01/22 18:12:53
Ok, add a comment.
robwu
2015/01/22 18:19:33
The purpose of |chrome| and |callerChrome| is alre
|
+ // The native call caused an error, but the developer might not have |
+ // checked runtime.lastError. |
+ lastError.reportIfUnchecked(name, targetChrome, request.stack); |
} |
} finally { |
delete requests[requestId]; |
@@ -120,12 +115,14 @@ function prepareRequest(args, argSchemas) { |
// - forIOThread: true if this function should be handled on the browser IO |
// thread. |
// - preserveNullInObjects: true if it is safe for null to be in objects. |
+// - stack: An optional string that contains the stack trace, to be displayed |
+// to the user if an error occurs. |
function sendRequest(functionName, args, argSchemas, optArgs) { |
calledSendRequest = true; |
if (!optArgs) |
optArgs = {}; |
var request = prepareRequest(args, argSchemas); |
- request.stack = exceptionHandler.getExtensionStackTrace(); |
+ request.stack = optArgs.stack || exceptionHandler.getExtensionStackTrace(); |
if (optArgs.customCallback) { |
request.customCallback = optArgs.customCallback; |
} |