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

Side by Side 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, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('hotword', function() { 5 cr.define('hotword', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Class used to manage the interaction between hotwording and the 9 * Class used to manage the interaction between hotwording and the
10 * NTP/google.com. Injects a content script to interact with NTP/google.com 10 * NTP/google.com. Injects a content script to interact with NTP/google.com
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 /** 158 /**
159 * Prepare a new or updated tab by injecting the content script. 159 * Prepare a new or updated tab by injecting the content script.
160 * @param {!Tab} tab Newly updated or created tab. 160 * @param {!Tab} tab Newly updated or created tab.
161 * @private 161 * @private
162 */ 162 */
163 prepareTab_: function(tab) { 163 prepareTab_: function(tab) {
164 if (!this.isEligibleUrl_(tab.url)) 164 if (!this.isEligibleUrl_(tab.url))
165 return; 165 return;
166 166
167 chrome.tabs.executeScript(tab.id, {'file': 'audio_client.js'}); 167 chrome.tabs.executeScript(
168 tab.id,
169 {'file': 'audio_client.js'},
170 function(results) {
171 if (chrome.runtime.lastError) {
172 // Ignore this error. For new tab pages, even though the URL is
173 // reported to be chrome://newtab/, the actual URL is a
174 // country-specific google domain. Since we don't have permission
175 // to inject on every page, an error will happen when the user is
176 // in an unsupported country.
177 //
178 // The property still needs to be accessed so that the error
179 // condition is cleared. If it isn't, exectureScript will log an
180 // error the next time it is called.
181 }
182 });
168 }, 183 },
169 184
170 /** 185 /**
171 * Updates hotwording state based on the state of current tabs/windows. 186 * Updates hotwording state based on the state of current tabs/windows.
172 * @private 187 * @private
173 */ 188 */
174 updateTabState_: function() { 189 updateTabState_: function() {
175 this.findCurrentTab_(this.activateTab_); 190 this.findCurrentTab_(this.activateTab_);
176 }, 191 },
177 192
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 this.stopHotwording_(); 440 this.stopHotwording_();
426 this.disconnectAllClients_(); 441 this.disconnectAllClients_();
427 } 442 }
428 } 443 }
429 }; 444 };
430 445
431 return { 446 return {
432 PageAudioManager: PageAudioManager 447 PageAudioManager: PageAudioManager
433 }; 448 };
434 }); 449 });
OLDNEW
« 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