Explainer for stylusUnavailableForURL message

We don't mention the G+ iframe on CWS stylable only when "Out of process iframes" feature is enabled which can be set manually via chrome://flags/#enable-site-per-process. It's still in development and is known to break some sites, which is why it's not enabled by default.
This commit is contained in:
tophf 2017-04-12 16:56:41 +03:00
parent dad1d1fe5f
commit 1749057b91
26 changed files with 490 additions and 514 deletions

View File

@ -294,10 +294,6 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": {
"message": "(Stylus does not work on pages like this.)",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
},
"sectionRemove": { "sectionRemove": {
"message": "إزالة القسم", "message": "إزالة القسم",
"description": "Label for the button to remove a section" "description": "Label for the button to remove a section"

View File

@ -294,8 +294,8 @@
"message": "Mozilla Formát", "message": "Mozilla Formát",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus nefunguje na těchto stránkách.)", "message": "Stylus nefunguje na těchto stránkách.",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -356,8 +356,8 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus funktioniert nicht auf Seiten wie diesen.)", "message": "Stylus funktioniert nicht auf Seiten wie diesen.",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -294,8 +294,8 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(To Stylus δεν λειτουργεί σε σελίδες όπως αυτή.)", "message": "To Stylus δεν λειτουργεί σε σελίδες όπως αυτή.",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -494,10 +494,14 @@
} }
} }
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus can't affect this page.)", "message": "Stylus doesn't work on pages like this.",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"stylusUnavailableForURLdetails": {
"message": "As a security precaution, the browser prohibits extensions from affecting its built-in pages (like chrome://version or about:addons) as well as other extensions' pages. Chrome/Chromium forks also restrict the Chrome Web Store.",
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
},
"toggleStyle": { "toggleStyle": {
"message": "Toggle style", "message": "Toggle style",
"description": "Label for the checkbox to enable/disable a style" "description": "Label for the checkbox to enable/disable a style"
@ -515,7 +519,7 @@
"description": "Note in the toolbar popup usually on file:// URLs after [re]loading Stylus" "description": "Note in the toolbar popup usually on file:// URLs after [re]loading Stylus"
}, },
"unreachableFileHint": { "unreachableFileHint": {
"message": "To allow Stylus access file:// URLs enable the checkbox 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"
}, },
"updateCheckFailBadResponseCode": { "updateCheckFailBadResponseCode": {

View File

@ -350,8 +350,8 @@
"message": "Formato Mozilla", "message": "Formato Mozilla",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus no funciona en páginas como esta)", "message": "Stylus no funciona en páginas como esta",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -294,10 +294,6 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": {
"message": "(Stylus does not work on pages like this.)",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
},
"sectionRemove": { "sectionRemove": {
"message": "Poista osio", "message": "Poista osio",
"description": "Label for the button to remove a section" "description": "Label for the button to remove a section"

View File

@ -294,8 +294,8 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus ne fonctionne pas sur les pages de ce genre)", "message": "Stylus ne fonctionne pas sur les pages de ce genre",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -294,10 +294,6 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": {
"message": "(Stylus does not work on pages like this.)",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
},
"sectionRemove": { "sectionRemove": {
"message": "Rimuovi sezione", "message": "Rimuovi sezione",
"description": "Label for the button to remove a section" "description": "Label for the button to remove a section"

View File

@ -294,10 +294,6 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": {
"message": "(Stylus does not work on pages like this.)",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
},
"sectionRemove": { "sectionRemove": {
"message": "セクションを削除", "message": "セクションを削除",
"description": "Label for the button to remove a section" "description": "Label for the button to remove a section"

View File

@ -294,8 +294,8 @@
"message": "Mozilla-opmaak", "message": "Mozilla-opmaak",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus werkt niet op pagina's als deze.)", "message": "Stylus werkt niet op pagina's als deze.",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -294,10 +294,6 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": {
"message": "(Stylus does not work on pages like this.)",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
},
"sectionRemove": { "sectionRemove": {
"message": "Remover seção", "message": "Remover seção",
"description": "Label for the button to remove a section" "description": "Label for the button to remove a section"

View File

@ -294,8 +294,8 @@
"message": "Формат Mozilla", "message": "Формат Mozilla",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus не работает на таких страницах)", "message": "Stylus не работает на таких страницах.",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -294,9 +294,8 @@
"message": "Mozilla формат", "message": "Mozilla формат",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus не ради на страницама као што је ова.)", "message": "Stylus не ради на страницама као што је ова.", "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {
"message": "Уклони одељак", "message": "Уклони одељак",

View File

@ -294,8 +294,8 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus fungerar inte på sidor som denna.)", "message": "Stylus fungerar inte på sidor som denna.",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -294,8 +294,8 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus fungerar inte på sidor som dessa.)", "message": "Stylus fungerar inte på sidor som dessa.",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -294,10 +294,6 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": {
"message": "(Stylus does not work on pages like this.)",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
},
"sectionRemove": { "sectionRemove": {
"message": "Remove section", "message": "Remove section",
"description": "Label for the button to remove a section" "description": "Label for the button to remove a section"

View File

@ -294,10 +294,6 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": {
"message": "(Stylus does not work on pages like this.)",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
},
"sectionRemove": { "sectionRemove": {
"message": "Bölümü kaldır", "message": "Bölümü kaldır",
"description": "Label for the button to remove a section" "description": "Label for the button to remove a section"

View File

@ -294,10 +294,6 @@
"message": "Mozilla Format", "message": "Mozilla Format",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": {
"message": "(Stylus does not work on pages like this.)",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
},
"sectionRemove": { "sectionRemove": {
"message": "移除节", "message": "移除节",
"description": "Label for the button to remove a section" "description": "Label for the button to remove a section"

View File

@ -352,8 +352,8 @@
"message": "Mozilla 格式", "message": "Mozilla 格式",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": "(Stylus在这样的页面上不工作)", "message": "Stylus在这样的页面上不工作",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -294,8 +294,8 @@
"message": "Mozilla格式", "message": "Mozilla格式",
"description": "Heading for the section with buttons to import/export Mozilla format of the style" "description": "Heading for the section with buttons to import/export Mozilla format of the style"
}, },
"stylishUnavailableForURL": { "stylusUnavailableForURL": {
"message": " Stylus 不能在諸如此類的網頁上生效。", "message": "Stylus 不能在諸如此類的網頁上生效。",
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect" "description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
}, },
"sectionRemove": { "sectionRemove": {

View File

@ -14,8 +14,14 @@ const URLS = {
configureCommands: configureCommands:
OPERA ? 'opera://settings/configureCommands' OPERA ? 'opera://settings/configureCommands'
: 'chrome://extensions/configureCommands', : 'chrome://extensions/configureCommands',
// CWS cannot be scripted in chromium, see ChromeExtensionsClient::IsScriptableURL
// https://cs.chromium.org/chromium/src/chrome/common/extensions/chrome_extensions_client.cc
chromeWebStore: FIREFOX ? 'N/A' : 'https://chrome.google.com/webstore/',
}; };
const RX_SUPPORTED_URLS = new RegExp(`^(file|https?|ftps?):|^${URLS.ownOrigin}`); const RX_SUPPORTED_URLS = new RegExp(
'^(file|ftps?|http)://|' +
`^https://${FIREFOX ? '' : '(?!chrome\\.google\\.com/webstore)'}|` +
'^' + URLS.ownOrigin);
let BG = chrome.extension.getBackgroundPage(); let BG = chrome.extension.getBackgroundPage();

View File

@ -66,7 +66,6 @@ a:hover {
display: table-cell; display: table-cell;
} }
#unavailable,
#installed { #installed {
border-bottom: 1px solid black; border-bottom: 1px solid black;
padding-bottom: 2px; padding-bottom: 2px;
@ -219,9 +218,7 @@ body > .actions {
} }
.actions > div:not(:last-child):not(#disable-all-wrapper), .actions > div:not(:last-child):not(#disable-all-wrapper),
.actions > .main-controls > div:not(:last-child), .actions > .main-controls > div:not(:last-child) {
#unavailable:not(:last-child),
#unavailable + .actions {
margin-bottom: 0.75em; margin-bottom: 0.75em;
} }
@ -230,24 +227,10 @@ body > .actions {
vertical-align: middle; vertical-align: middle;
} }
#unavailable { body.blocked #installed > *,
border: none; body.blocked .actions > .main-controls,
body.blocked .actions > .left-gutter {
display: none; display: none;
margin-top: 0.75em;
align-items: center;
justify-content: center;
font-size: 14px;
}
body.blocked #installed,
body.blocked #find-styles,
body.blocked #write-style,
body:not(.blocked) #unavailable {
display: none;
}
body.blocked #unavailable {
display: flex;
} }
/* Never shown, but can be enabled with a style */ /* Never shown, but can be enabled with a style */
@ -437,22 +420,38 @@ body.blocked #unavailable {
opacity: .25; opacity: .25;
} }
.blocked:before,
.unreachable:before { .unreachable:before {
content: "__MSG_unreachableContentScript__";
padding: 5px 0.75em; padding: 5px 0.75em;
display: block; display: block;
font-weight: bold; font-weight: bold;
} }
.blocked #installed:before,
.unreachable #installed:before { .unreachable #installed:before {
content: "__MSG_unreachableFileHint__";
padding: 1px 0.75em 9px; padding: 1px 0.75em 9px;
display: block; display: block;
font-size: 90%; font-size: 90%;
border-bottom: 1px solid black;
margin-bottom: 5px; margin-bottom: 5px;
} }
.blocked:before {
content: "__MSG_stylusUnavailableForURL__";
}
.blocked #installed:before {
content: "__MSG_stylusUnavailableForURLdetails__";
}
.unreachable:before {
content: "__MSG_unreachableContentScript__";
}
.unreachable #installed:before {
content: "__MSG_unreachableFileHint__";
border-bottom: 1px solid black;
}
@keyframes lights-off { @keyframes lights-off {
from { from {
background-color: transparent; background-color: transparent;

View File

@ -76,12 +76,6 @@
</div> </div>
</div> </div>
<div id="unavailable">
<div class="main-controls">
<span id="unavailable-message" i18n-text="stylishUnavailableForURL"></span>
</div>
</div>
<div id="installed"></div> <div id="installed"></div>
<div class="actions"> <div class="actions">

View File

@ -357,7 +357,7 @@ function handleUpdate(style) {
} }
// Add an entry when a new style for the current url is installed // Add an entry when a new style for the current url is installed
if (tabURL && BG.getApplicableSections({style, matchUrl: tabURL, stopOnFirst: true}).length) { if (tabURL && BG.getApplicableSections({style, matchUrl: tabURL, stopOnFirst: true}).length) {
$('#unavailable').style.display = 'none'; document.body.classList.remove('blocked');
createStyleElement({style}); createStyleElement({style});
} }
} }

View File

@ -104,6 +104,12 @@ function filterStyles({
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
const disableAll = asHash && prefs.get('disableAll', false); const disableAll = asHash && prefs.get('disableAll', false);
if (matchUrl && matchUrl.startsWith(URLS.chromeWebStore)) {
// CWS cannot be scripted in chromium, see ChromeExtensionsClient::IsScriptableURL
// https://cs.chromium.org/chromium/src/chrome/common/extensions/chrome_extensions_client.cc
return asHash ? {} : [];
}
// add \t after url to prevent collisions (not sure it can actually happen though) // add \t after url to prevent collisions (not sure it can actually happen though)
const cacheKey = ' ' + enabled + url + '\t' + id + matchUrl + '\t' + asHash + strictRegexp; const cacheKey = ' ' + enabled + url + '\t' + id + matchUrl + '\t' + asHash + strictRegexp;
const cached = cachedStyles.filters.get(cacheKey); const cached = cachedStyles.filters.get(cacheKey);