From d048c480c3321c4fff8175c143b74a5faa9f8ae8 Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 29 Jan 2022 18:19:21 +0300 Subject: [PATCH] require FF >= 55 --- background/background.js | 6 ------ background/remove-unused-storage.js | 15 --------------- content/apply.js | 19 ++++++------------- edit/codemirror-factory.js | 4 ++-- edit/embedded-popup.js | 11 +++-------- edit/sections-editor.js | 5 ++--- global.css | 18 ------------------ js/toolbox.js | 8 +++----- manifest.json | 2 +- popup/search.js | 2 +- 10 files changed, 18 insertions(+), 72 deletions(-) delete mode 100644 background/remove-unused-storage.js diff --git a/background/background.js b/background/background.js index 1d5b8605..0ca81b4a 100644 --- a/background/background.js +++ b/background/background.js @@ -176,12 +176,6 @@ chrome.runtime.onInstalled.addListener(({reason, previousVersion}) => { if (UA.mobile) prefs.set('manage.newUI', false); if (UA.windows) prefs.set('editor.keyMap', 'sublime'); } - if (reason === 'update') { - const [a, b, c] = (previousVersion || '').split('.'); - if (a <= 1 && b <= 5 && c <= 13) { // 1.5.13 - require(['/background/remove-unused-storage']); - } - } // TODO: remove this before 1.5.23 as it's only for a few users who installed git 26b75e77 if (reason === 'update' && previousVersion === '1.5.22') { for (const dbName of ['drafts', prefs.STORAGE_KEY]) { diff --git a/background/remove-unused-storage.js b/background/remove-unused-storage.js deleted file mode 100644 index 1c1a9154..00000000 --- a/background/remove-unused-storage.js +++ /dev/null @@ -1,15 +0,0 @@ -/* global chromeLocal */// storage-util.js -'use strict'; - -// Removing unused stuff from storage on extension update -// TODO: delete this by the middle of 2021 - -try { - localStorage.clear(); -} catch (e) {} - -setTimeout(async () => { - const del = Object.keys(await chromeLocal.get()) - .filter(key => key.startsWith('usoSearchCache')); - if (del.length) chromeLocal.remove(del); -}, 15e3); diff --git a/content/apply.js b/content/apply.js index a7c232cc..824de819 100644 --- a/content/apply.js +++ b/content/apply.js @@ -43,17 +43,14 @@ /* about:blank iframes are often used by sites for file upload or background tasks * and they may break if unexpected DOM stuff is present at `load` event * so we'll add the styles only if the iframe becomes visible */ - const {IntersectionObserver} = window; const xoEventId = `${Math.random()}`; /** @type IntersectionObserver */ let xo; - if (IntersectionObserver) { - window[Symbol.for('xo')] = (el, cb) => { - if (!xo) xo = new IntersectionObserver(onIntersect, {rootMargin: '100%'}); - el.addEventListener(xoEventId, cb, {once: true}); - xo.observe(el); - }; - } + window[Symbol.for('xo')] = (el, cb) => { + if (!xo) xo = new IntersectionObserver(onIntersect, {rootMargin: '100%'}); + el.addEventListener(xoEventId, cb, {once: true}); + xo.observe(el); + }; // Declare all vars before init() or it'll throw due to "temporal dead zone" of const/let const ready = init(); @@ -246,11 +243,7 @@ } function onFrameElementInView(cb) { - if (IntersectionObserver) { - parent[parent.Symbol.for('xo')](frameElement, cb); - } else { - requestAnimationFrame(cb); - } + parent[parent.Symbol.for('xo')](frameElement, cb); } /** @param {IntersectionObserverEntry[]} entries */ diff --git a/edit/codemirror-factory.js b/edit/codemirror-factory.js index 08e1d6bc..6e18789e 100644 --- a/edit/codemirror-factory.js +++ b/edit/codemirror-factory.js @@ -32,7 +32,7 @@ globalSetOption(key, value) { CodeMirror.defaults[key] = value; - if (cms.size > 4 && lazyOpt && lazyOpt.names.includes(key)) { + if (cms.size > 4 && lazyOpt.names.includes(key)) { lazyOpt.set(key, value); } else { cms.forEach(cm => cm.setOption(key, value)); @@ -104,7 +104,7 @@ // lazy propagation - lazyOpt = window.IntersectionObserver && { + lazyOpt = { names: ['theme', 'lineWrapping'], set(key, value) { const {observer, queue} = lazyOpt; diff --git a/edit/embedded-popup.js b/edit/embedded-popup.js index d96cc8cc..a503bc6f 100644 --- a/edit/embedded-popup.js +++ b/edit/embedded-popup.js @@ -60,14 +60,9 @@ const body = pw.document.body; pw.on('keydown', removePopupOnEsc); pw.close = removePopup; - if (pw.IntersectionObserver) { - new pw.IntersectionObserver(onIntersect).observe(body.appendChild( - $create('div', {style: {height: '1px', marginTop: '-1px'}}) - )); - } else { - frame.dataset.loaded = ''; - frame.height = body.scrollHeight; - } + new pw.IntersectionObserver(onIntersect).observe(body.appendChild( + $create('div', {style: {height: '1px', marginTop: '-1px'}}) + )); new pw.MutationObserver(onMutation).observe(body, { attributes: true, attributeFilter: ['style'], diff --git a/edit/sections-editor.js b/edit/sections-editor.js index a45a822e..edcf569c 100644 --- a/edit/sections-editor.js +++ b/edit/sections-editor.js @@ -16,8 +16,7 @@ function SectionsEditor() { const container = $('#sections'); /** @type {EditorSection[]} */ const sections = []; - const xo = window.IntersectionObserver && - new IntersectionObserver(refreshOnViewListener, {rootMargin: '100%'}); + const xo = new IntersectionObserver(refreshOnViewListener, {rootMargin: '100%'}); let INC_ID = 0; // an increment id that is used by various object to track the order let sectionOrder = ''; let headerOffset; // in compact mode the header is at the top so it reduces the available height @@ -632,7 +631,7 @@ function SectionsEditor() { if (code) { linterMan.enableForEditor(cm, code); } - if (force || !xo) { + if (force) { refreshOnViewNow(cm); } else { xo.observe(cm.display.wrapper); diff --git a/global.css b/global.css index 502944a6..44e9bf58 100644 --- a/global.css +++ b/global.css @@ -359,20 +359,6 @@ body.resizing-v > * { } @supports (-moz-appearance: none) { - .moz-appearance-bug .svg-icon.checked, - .moz-appearance-bug .onoffswitch input, - .moz-appearance-bug input[type="radio"]:after { - display: none !important; - } - - .moz-appearance-bug input[type="checkbox"] { - -moz-appearance: checkbox !important; - } - - .moz-appearance-bug input[type="radio"] { - -moz-appearance: radio !important; - } - .firefox select { padding: 0 20px 0 2px; line-height: var(--input-height)!important; @@ -400,10 +386,6 @@ body.resizing-v > * { border: 1px solid hsl(0, 0%, 66%); padding: 4px; } - - .firefox.moz-appearance-bug button:not(.install) { - padding: 2px 4px; - } } @media (max-width: 850px) { diff --git a/js/toolbox.js b/js/toolbox.js index 91583403..9afedf9f 100644 --- a/js/toolbox.js +++ b/js/toolbox.js @@ -46,15 +46,13 @@ const [CHROME, UA] = (() => { // see PR #781 const CHROME_POPUP_BORDER_BUG = CHROME >= 62 && CHROME <= 74; -if (!CHROME && !chrome.browserAction.openPopup) { +if (FIREFOX && !chrome.browserAction.openPopup) { // in FF pre-57 legacy addons can override useragent so we assume the worst // until we know for sure in the async getBrowserInfo() // (browserAction.openPopup was added in 57) - FIREFOX = browser.runtime.getBrowserInfo ? 51 : 50; - // getBrowserInfo was added in FF 51 - Promise.resolve(FIREFOX >= 51 ? browser.runtime.getBrowserInfo() : {version: 50}).then(info => { + FIREFOX = 55; // from strict_min_version + browser.runtime.getBrowserInfo().then(info => { FIREFOX = parseFloat(info.version); - document.documentElement.classList.add('moz-appearance-bug', FIREFOX && FIREFOX < 54); }); } diff --git a/manifest.json b/manifest.json index 4ed8a4a1..a6a4ef9b 100644 --- a/manifest.json +++ b/manifest.json @@ -101,7 +101,7 @@ "applications": { "gecko": { "id": "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}", - "strict_min_version": "53.0" + "strict_min_version": "55.0" } }, "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2ypG+Z/beZtoYrxxwXYhMwQiAiwRVnSHqdpOSzJdjsXVWdvJjlgEuZcU8kte75w58P45LsRUrwvU6N9x12S6eW84KNEBC8rlZj0RGNoxuhSAcdxneYzjJ9tBkZKOidVedYHHsi3LeaXiLuTNTBR+2lf3uCNcP0ebaFML9uDLdYTGEW4eL3hnEKYPSmT1/xkh4bSGTToCg4YNuWWWoTA0beEOpBWYkPVMarLDQgPzMN5Byu5w3lOS2zL0PPJcmdyk3ez/ZsB4PZKU+h17fVA6+YTvUfxUqLde5i2RiuZhEb6Coo5/W90ZW1yCDC9osjWrxMGYeUMQWHPIgFtDhk4K6QIDAQAB" diff --git a/popup/search.js b/popup/search.js index d69215ea..4e88b3fa 100644 --- a/popup/search.js +++ b/popup/search.js @@ -256,7 +256,7 @@ if (results.length && 'empty' in dom.container.dataset) { delete dom.container.dataset.empty; } - if (scrollToFirstResult && (!FIREFOX || FIREFOX >= 55)) { + if (scrollToFirstResult) { debounce(doScrollToFirstResult); } // navigation