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

Unified Diff: chrome/common/extensions/docs/static/messaging.html

Issue 9693048: Make sure ports are closed when they're no longer used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 9 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 | « chrome/common/extensions/docs/messaging.html ('k') | chrome/renderer/extensions/miscellaneous_bindings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/static/messaging.html
diff --git a/chrome/common/extensions/docs/static/messaging.html b/chrome/common/extensions/docs/static/messaging.html
index 1391e7e9d5fdcb7c5b655d77f2e4f48cc12cd792..c4774a5aca7dc8e505c146b399bfa767052595da 100644
--- a/chrome/common/extensions/docs/static/messaging.html
+++ b/chrome/common/extensions/docs/static/messaging.html
@@ -63,9 +63,7 @@ chrome.tabs.getSelected(null, function(tab) {
On the receiving end, you need to set up an
<a href="extension.html#event-onRequest">chrome.extension.onRequest</a>
event listener to handle the message. This looks the same from a content
-script or extension page. The request will remain open until you call
-sendResponse, so it is good practice to call sendResponse with an empty
-object to allow the request to be cleaned up.
+script or extension page.
<pre>
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
@@ -74,8 +72,6 @@ chrome.extension.onRequest.addListener(
"from the extension");
if (request.greeting == "hello")
sendResponse({farewell: "goodbye"});
- else
- sendResponse({}); // snub them.
});
</pre>
@@ -185,7 +181,7 @@ methods. Here's an example of each:
chrome.extension.onRequestExternal.addListener(
function(request, sender, sendResponse) {
if (sender.id == blacklistedExtension)
- sendResponse({}); // don't allow this extension access
+ return; // don't allow this extension access
else if (request.getTargetData)
sendResponse({targetData: targetData});
else if (request.activateLasers) {
« no previous file with comments | « chrome/common/extensions/docs/messaging.html ('k') | chrome/renderer/extensions/miscellaneous_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698