From 9585aea08dee14f7497d855295044e78d7980880 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 30 Sep 2017 02:32:43 +0300 Subject: [PATCH] insertCSS#cssOrigin requires FF53 --- background/storage.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/background/storage.js b/background/storage.js index 389dd365..fe8a222b 100644 --- a/background/storage.js +++ b/background/storage.js @@ -754,19 +754,18 @@ function handleCssTransitionBug({tabId, frameId, url, styles}) { } function patchFirefox() { - browser.tabs.insertCSS(tabId, { + const options = { frameId, code: CSS_TRANSITION_SUPPRESSOR, - cssOrigin: 'user', - runAt: 'document_start', matchAboutBlank: true, - }).then(() => setTimeout(() => { - browser.tabs.removeCSS(tabId, { - frameId, - code: CSS_TRANSITION_SUPPRESSOR, - cssOrigin: 'user', - matchAboutBlank: true, - }).catch(ignoreChromeError); + }; + if (FIREFOX >= 53) { + options.cssOrigin = 'user'; + } + browser.tabs.insertCSS(tabId, Object.assign(options, { + runAt: 'document_start', + })).then(() => setTimeout(() => { + browser.tabs.removeCSS(tabId, options).catch(ignoreChromeError); })).catch(ignoreChromeError); }