mirror of https://github.com/gorhill/uBlock.git
Injects user styles and content scripts in `about:blank` frames
Related issues: - https://github.com/uBlockOrigin/uBlock-issues/issues/688 - https://github.com/uBlockOrigin/uBlock-issues/issues/1164 `match_about_blank` is now used for content scripts and user styles.
This commit is contained in:
parent
fb0a442a9a
commit
221983646e
|
@ -39,8 +39,9 @@
|
|||
"/js/vapi-client.js",
|
||||
"/js/contentscript.js"
|
||||
],
|
||||
"run_at": "document_start",
|
||||
"all_frames": true
|
||||
"all_frames": true,
|
||||
"match_about_blank": true,
|
||||
"run_at": "document_start"
|
||||
},
|
||||
{
|
||||
"matches": [
|
||||
|
|
|
@ -49,8 +49,9 @@
|
|||
"/js/vapi-client.js",
|
||||
"/js/contentscript.js"
|
||||
],
|
||||
"run_at": "document_start",
|
||||
"all_frames": true
|
||||
"all_frames": true,
|
||||
"match_about_blank": true,
|
||||
"run_at": "document_start"
|
||||
},
|
||||
{
|
||||
"matches": [
|
||||
|
|
|
@ -30,16 +30,17 @@
|
|||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"all_frames": true,
|
||||
"matches": [
|
||||
"http://*/*",
|
||||
"https://*/*"
|
||||
],
|
||||
"js": [
|
||||
"js/vapi.js",
|
||||
"js/vapi-client.js",
|
||||
"js/contentscript.js"
|
||||
],
|
||||
"matches": [
|
||||
"http://*/*",
|
||||
"https://*/*"
|
||||
],
|
||||
"all_frames": true,
|
||||
"match_about_blank": true,
|
||||
"run_at": "document_start"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -30,8 +30,9 @@
|
|||
"/js/vapi-client.js",
|
||||
"/js/contentscript.js"
|
||||
],
|
||||
"run_at": "document_start",
|
||||
"all_frames": true
|
||||
"all_frames": true,
|
||||
"match_about_blank": true,
|
||||
"run_at": "document_start"
|
||||
},
|
||||
{
|
||||
"matches": [
|
||||
|
|
|
@ -1053,16 +1053,6 @@ vAPI.domCollapser = (function() {
|
|||
attributeFilter: [ 'src' ]
|
||||
};
|
||||
|
||||
// The injected scriptlets are those which were injected in the current
|
||||
// document, from within `bootstrapPhase1`, and which scriptlets are
|
||||
// selectively looked-up from:
|
||||
// https://github.com/uBlockOrigin/uAssets/blob/master/filters/resources.txt
|
||||
const primeLocalIFrame = function(iframe) {
|
||||
if ( vAPI.injectedScripts ) {
|
||||
vAPI.injectScriptlet(iframe.contentDocument, vAPI.injectedScripts);
|
||||
}
|
||||
};
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/162
|
||||
// Be prepared to deal with possible change of src attribute.
|
||||
const addIFrame = function(iframe, dontObserve) {
|
||||
|
@ -1070,10 +1060,7 @@ vAPI.domCollapser = (function() {
|
|||
iframeSourceObserver.observe(iframe, iframeSourceObserverOptions);
|
||||
}
|
||||
const src = iframe.src;
|
||||
if ( src === '' || typeof src !== 'string' ) {
|
||||
primeLocalIFrame(iframe);
|
||||
return;
|
||||
}
|
||||
if ( typeof src !== 'string' || src === '' ) { return; }
|
||||
if ( src.startsWith('http') === false ) { return; }
|
||||
toFilter.push({ type: 'sub_frame', url: iframe.src });
|
||||
add(iframe);
|
||||
|
|
|
@ -959,7 +959,8 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {
|
|||
code: out.injected + '\n{display:none!important;}',
|
||||
cssOrigin: 'user',
|
||||
frameId: request.frameId,
|
||||
runAt: 'document_start'
|
||||
matchAboutBlank: true,
|
||||
runAt: 'document_start',
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1151,7 +1152,8 @@ FilterContainer.prototype.retrieveSpecificSelectors = function(
|
|||
code: '',
|
||||
cssOrigin: 'user',
|
||||
frameId: request.frameId,
|
||||
runAt: 'document_start'
|
||||
matchAboutBlank: true,
|
||||
runAt: 'document_start',
|
||||
};
|
||||
if ( out.injectedHideFilters.length !== 0 ) {
|
||||
details.code = out.injectedHideFilters + '\n{display:none!important;}';
|
||||
|
|
Loading…
Reference in New Issue