| Index: lib/cssInjection.js |
| =================================================================== |
| --- a/lib/cssInjection.js |
| +++ b/lib/cssInjection.js |
| @@ -71,23 +71,36 @@ |
| try |
| { |
| browser.tabs.insertCSS(tabId, { |
| code: styleSheet, |
| cssOrigin: "user", |
| frameId, |
| matchAboutBlank: true, |
| runAt: "document_start" |
| - }); |
| + }) |
| + // Some errors on Chromium are asynchronous promise rejections |
| + // (e.g. "Error: No frame with id 574 in tab 266"). We explicitly ignore |
| + // these, because otherwise they show up in the log too often and make |
| + // debugging difficult. |
| + .catch(() => {}); |
| } |
| catch (error) |
| { |
| + // If the error is about the "cssOrigin" option, this is an older version |
| + // of Chromium (65 and below) or Firefox (52 and below) that does not |
| + // support user style sheets. |
| if (/\bcssOrigin\b/.test(error.message)) |
| userStyleSheetsSupported = false; |
| + // Sometimes a frame gets removed from the document between the time the |
| + // content script sends the "elemhide.getSelectors" message and the time |
| + // the background page tries to inject a style sheet, which causes |
| + // tabs.insertCSS to throw a frame-not-found error. We must handle any such |
| + // errors. |
|
Sebastian Noack
2018/03/13 18:40:58
This is only the case on Firefox, while Chromium g
Manish Jethani
2018/03/13 22:08:38
Done.
|
| return false; |
| } |
| return true; |
| } |
| function removeStyleSheet(tabId, frameId, styleSheet) |
| { |