Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: extensions/renderer/resources/send_request.js

Issue 865083003: Report unchecked error in lastError.run (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/targetChrome/callerChrome/ Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/resources/last_error.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bdf0324a36a475621d1a1e31a8ea32761d805e60 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)) {
+ // The native call caused an error, but the developer might not have
+ // checked runtime.lastError.
+ lastError.reportIfUnchecked(name, callerChrome, 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;
}
« no previous file with comments | « extensions/renderer/resources/last_error.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698