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

Unified Diff: chrome/renderer/resources/extensions/tabs_custom_bindings.js

Issue 9965005: Deprecate chrome.extension.sendRequest in favor of sendMessage, with a safer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync 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/renderer/resources/extensions/miscellaneous_bindings.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/tabs_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/tabs_custom_bindings.js b/chrome/renderer/resources/extensions/tabs_custom_bindings.js
index e0cc59cb71e9c6a57d3336b9f6c65f2149373090..283609d04b79d006d55c36ff4a97b8184264f997 100644
--- a/chrome/renderer/resources/extensions/tabs_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/tabs_custom_bindings.js
@@ -23,22 +23,13 @@ chromeHidden.registerCustomHook('tabs', function(bindingsAPI, extensionId) {
apiFunctions.setHandleRequest('sendRequest',
function(tabId, request, responseCallback) {
- var port = chrome.tabs.connect(tabId,
- {name: chromeHidden.kRequestChannel});
- port.postMessage(request);
- port.onDisconnect.addListener(function() {
- // For onDisconnects, we only notify the callback if there was an error.
- if (chrome.extension.lastError && responseCallback)
- responseCallback();
- });
- port.onMessage.addListener(function(response) {
- try {
- if (responseCallback)
- responseCallback(response);
- } finally {
- port.disconnect();
- port = null;
- }
- });
+ var port = chrome.tabs.connect(tabId, {name: chromeHidden.kRequestChannel});
+ chromeHidden.Port.sendMessageImpl(port, request, responseCallback);
+ });
+
+ apiFunctions.setHandleRequest('sendMessage',
+ function(tabId, message, responseCallback) {
+ var port = chrome.tabs.connect(tabId, {name: chromeHidden.kMessageChannel});
+ chromeHidden.Port.sendMessageImpl(port, message, responseCallback);
});
});
« no previous file with comments | « chrome/renderer/resources/extensions/miscellaneous_bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698