summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/static
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 10:43:22 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 10:43:22 +0000
commit921777f2b0b5adeb766419ffbf6538d10c819912 (patch)
treec7b81951118217e9956a8d0d5744827336d46043 /chrome/common/extensions/docs/static
parent21d90b88fd5b2a054e4825e89d104bfe1aadbdde (diff)
downloadchromium_src-921777f2b0b5adeb766419ffbf6538d10c819912.zip
chromium_src-921777f2b0b5adeb766419ffbf6538d10c819912.tar.gz
chromium_src-921777f2b0b5adeb766419ffbf6538d10c819912.tar.bz2
Make sure ports are closed when they're no longer used.
It appears to be a common pattern that extensions don't invoke the responseCallback, and so the port objects leak. Register a callback that triggers when the responseCallback is finalized to free up these resources. BUG=114738, 93566 TEST=manual Review URL: http://codereview.chromium.org/9693048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126884 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs/static')
-rw-r--r--chrome/common/extensions/docs/static/messaging.html8
1 files changed, 2 insertions, 6 deletions
diff --git a/chrome/common/extensions/docs/static/messaging.html b/chrome/common/extensions/docs/static/messaging.html
index 1391e7e..c4774a5 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) {