Index: chrome/browser/resources/hotword_helper/manager.js |
diff --git a/chrome/browser/resources/hotword_helper/manager.js b/chrome/browser/resources/hotword_helper/manager.js |
index 4ce86db62959d7fb42ade923a8d80fb11daa24f2..7e325ab07e50101b6a9444a7f499364fb173fc06 100644 |
--- a/chrome/browser/resources/hotword_helper/manager.js |
+++ b/chrome/browser/resources/hotword_helper/manager.js |
@@ -58,19 +58,28 @@ OptInManager.CommandFromPage = { |
*/ |
OptInManager.prototype.injectTab_ = function( |
tab, sendResponse, hotwordStatus) { |
- if (tab.incognito || !hotwordStatus.available) { |
- sendResponse({'doNotShowOptinMessage': true}); |
- return; |
- } |
+ try { |
+ if (tab.incognito || !hotwordStatus.available) { |
+ sendResponse({'doNotShowOptinMessage': true}); |
+ return; |
+ } |
- if (!hotwordStatus.enabledSet) { |
- sendResponse(hotwordStatus); |
- return; |
- } |
+ if (!hotwordStatus.enabledSet) { |
+ sendResponse(hotwordStatus); |
+ return; |
+ } |
- if (hotwordStatus.enabled) |
- chrome.tabs.executeScript(tab.id, {'file': 'audio_client.js'}); |
- sendResponse({'doNotShowOptinMessage': true}); |
+ if (hotwordStatus.enabled) |
+ chrome.tabs.executeScript(tab.id, {'file': 'audio_client.js'}); |
+ sendResponse({'doNotShowOptinMessage': true}); |
+ } catch (err) { |
+ // Suppress the exception thrown when the page doesn't specify a response |
+ // callback. Unfortunately, there doesn't appear to be a way to detect |
+ // one-way messages without explicitly saying in the message itself. |
+ if (err.message == 'Attempting to use a disconnected port object') |
rpetterson
2014/09/22 23:04:41
Weird question, but is this always going to be in
Anand Mistry (off Chromium)
2014/09/22 23:50:43
It's an untranslated constant in https://code.goog
rpetterson
2014/09/22 23:53:03
Understood. Please add a note to the comment listi
Anand Mistry (off Chromium)
2014/09/23 00:31:30
Done.
|
+ return; |
+ throw err; |
+ } |
}; |