FF: allow access to AMO in FF (actually works in 59+)

fixes #312
This commit is contained in:
tophf 2017-12-22 08:36:10 +03:00
parent 7d8507743d
commit 4946aad684
3 changed files with 28 additions and 9 deletions

View File

@ -1031,6 +1031,18 @@
"message": "Stylus can access file:// URLs only if you enable the corresponding checkbox for Stylus extension on chrome://extensions page.", "message": "Stylus can access file:// URLs only if you enable the corresponding checkbox for Stylus extension on chrome://extensions page.",
"description": "Note in the toolbar popup for file:// URLs" "description": "Note in the toolbar popup for file:// URLs"
}, },
"unreachableAMO": {
"message": "Firefox forbids access to the site.",
"description": "Note in the popup displayed when opened on addons.mozilla.org"
},
"unreachableAMOHint": {
"message": "To allow access open <about:config>, right-click the list, click 'New', then 'Boolean', paste <privacy.resistFingerprinting.block_mozAddonManager> and click OK, <true>, OK, reload the <addons.mozilla.org> page.",
"description": "Note in the popup when opened on addons.mozilla.org in Firefox >= 59"
},
"unreachableAMOHintOldFF": {
"message": "Only Firefox 59 and newer can be configured to allow WebExtensions to add style elements on CSP-protected sites such as this one.",
"description": "Note in the popup when opened on addons.mozilla.org in Firefox < 59"
},
"updateCheckFailBadResponseCode": { "updateCheckFailBadResponseCode": {
"message": "Update failed: server responded with code $code$.", "message": "Update failed: server responded with code $code$.",
"description": "Text that displays when an update check failed because the response code indicates an error", "description": "Text that displays when an update check failed because the response code indicates an error",

View File

@ -45,7 +45,7 @@ const URLS = {
chromeProtectsNTP: CHROME >= 3161, chromeProtectsNTP: CHROME >= 3161,
supported: url => ( supported: url => (
url.startsWith('http') && !url.startsWith(URLS.browserWebStore) || url.startsWith('http') && (FIREFOX || !url.startsWith(URLS.browserWebStore)) ||
url.startsWith('ftp') || url.startsWith('ftp') ||
url.startsWith('file') || url.startsWith('file') ||
url.startsWith(URLS.ownOrigin) || url.startsWith(URLS.ownOrigin) ||

View File

@ -122,17 +122,24 @@ function initPopup(url) {
ignoreChromeError(); ignoreChromeError();
// FF and some Chrome forks (e.g. CentBrowser) implement tab-on-demand // FF and some Chrome forks (e.g. CentBrowser) implement tab-on-demand
// so we'll wait a bit to handle popup being invoked right after switching // so we'll wait a bit to handle popup being invoked right after switching
if ( if (retryCountdown > 0 && (
retryCountdown > 0 && (
tab.status !== 'complete' || tab.status !== 'complete' ||
FIREFOX && tab.url === 'about:blank' FIREFOX && tab.url === 'about:blank')) {
)
) {
setTimeout(ping, 100, tab, --retryCountdown); setTimeout(ping, 100, tab, --retryCountdown);
} else { return;
document.body.classList.add('unreachable');
document.body.insertBefore(template.unreachableInfo, document.body.firstChild);
} }
const info = template.unreachableInfo;
if (FIREFOX && tabURL.startsWith(URLS.browserWebStore)) {
$('label', info).textContent = t('unreachableAMO');
$('p', info).insertAdjacentElement('afterend',
$create('p',
t(FIREFOX < 59 ? 'unreachableAMOHintOldFF' : 'unreachableAMOHint')
.split(/(<.*?>)/)
.map(s => s[0] === '<' ? $create('b', s.slice(1, -1)) : s)));
$('p', info).remove();
}
document.body.classList.add('unreachable');
document.body.insertBefore(info, document.body.firstChild);
}); });
}); });