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

Unified Diff: chrome/browser/resources/hotword/page_audio_manager.js

Issue 689473002: Ignore errors from chrome.tabs.executeScript. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo. Created 6 years, 2 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: chrome/browser/resources/hotword/page_audio_manager.js
diff --git a/chrome/browser/resources/hotword/page_audio_manager.js b/chrome/browser/resources/hotword/page_audio_manager.js
index 11e343d0dbe544993f7d4c9c70afdee240c47b2a..918f1a74ead075260d35d42651e3a19d2e34c858 100644
--- a/chrome/browser/resources/hotword/page_audio_manager.js
+++ b/chrome/browser/resources/hotword/page_audio_manager.js
@@ -164,7 +164,22 @@ cr.define('hotword', function() {
if (!this.isEligibleUrl_(tab.url))
return;
- chrome.tabs.executeScript(tab.id, {'file': 'audio_client.js'});
+ chrome.tabs.executeScript(
+ tab.id,
+ {'file': 'audio_client.js'},
+ function(results) {
+ if (chrome.runtime.lastError) {
+ // Ignore this error. For new tab pages, even though the URL is
+ // reported to be chrome://newtab/, the actual URL is a
+ // country-specific google domain. Since we don't have permission
+ // to inject on every page, an error will happen when the user is
+ // in an unsupported country.
+ //
+ // The property still needs to be accessed so that the error
+ // condition is cleared. If it isn't, exectureScript will log an
+ // error the next time it is called.
+ }
+ });
},
/**
« 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