| Index: go-back-with-backspace/background.js
|
| diff --git a/go-back-with-backspace/background.js b/go-back-with-backspace/background.js
|
| index 269b0bdf0f4b35b53cf3b4ed4db9f9d04e10ecc2..9c715aa7782731a5dad8edc25980b8a9af3c3678 100644
|
| --- a/go-back-with-backspace/background.js
|
| +++ b/go-back-with-backspace/background.js
|
| @@ -29,14 +29,27 @@ function injectContentScripts() {
|
| chrome.tabs.query({}, function(tabs) {
|
| tabs.forEach(function(tab) {
|
| scripts.forEach(function(script) {
|
| - // This will produce an error if extensions are prohibited on the
|
| - // tab (e.g., chrome:// pages), but we can ignore it.
|
| - chrome.tabs.executeScript(tab.id,
|
| - {
|
| - file: script,
|
| - allFrames: true,
|
| - runAt: 'document_start'
|
| - });
|
| + chrome.tabs.executeScript(
|
| + tab.id,
|
| + {
|
| + file: script,
|
| + allFrames: true,
|
| + runAt: 'document_start'
|
| + },
|
| + function() {
|
| + if (chrome.runtime.lastError) {
|
| + // An error will occur if extensions are prohibited on the
|
| + // tab (e.g., chrome:// pages). We don't need to do anything
|
| + // about that, but we do need to catch it here to avoid an
|
| + // error message on the Extensions page.
|
| + var message = chrome.runtime.lastError.message;
|
| + if (message != 'Cannot access a chrome:// URL' &&
|
| + message != 'The extensions gallery cannot be scripted.' &&
|
| + !message.startsWith('Cannot access contents of the page.')) {
|
| + throw message;
|
| + }
|
| + }
|
| + });
|
| });
|
| });
|
| });
|
|
|