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

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

Issue 1860953003: Call chrome.runtime.sendMessage's callback without arguments upon fail (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/resources/messaging.js
diff --git a/extensions/renderer/resources/messaging.js b/extensions/renderer/resources/messaging.js
index ef562779ad847e2d29d780e231b1c313c195a9c8..3b98432f887000fbfeba505e28bf17c28645c300 100644
--- a/extensions/renderer/resources/messaging.js
+++ b/extensions/renderer/resources/messaging.js
@@ -339,7 +339,13 @@
// Save a reference so that we don't re-entrantly call responseCallback.
var sendResponse = responseCallback;
responseCallback = null;
- sendResponse(response);
+ if (arguments.length === 0) {
+ // According to the documentation of chrome.runtime.sendMessage, the
+ // callback is invoked without any arguments when an error occurs.
+ sendResponse();
+ } else {
+ sendResponse(response);
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698