A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gorhill/uBlock/commit/b779f1f7c9deea32970b93e11a8d33ef7efe5db8 below:

Dynamically reload 3p css when noop-ing "3rd-party" cell · gorhill/uBlock@b779f1f · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+85

-2

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+85

-2

lines changed Original file line number Diff line number Diff line change

@@ -43,7 +43,7 @@ const µBlock = (( ) => { // jshint ignore:line

43 43

autoUpdateDelayAfterLaunch: 180,

44 44

autoUpdatePeriod: 7,

45 45

benchmarkDatasetURL: 'unset',

46 -

blockingProfiles: '11111/#F00 11011/#C0F 11001/#00F 00001',

46 +

blockingProfiles: '11111/#F00 11010/#C0F 11001/#00F 00001',

47 47

cacheStorageAPI: 'unset',

48 48

cacheStorageCompression: true,

49 49

cacheControlForFirefox1376932: 'no-cache, no-store, must-revalidate',

Original file line number Diff line number Diff line change

@@ -88,6 +88,8 @@ const relaxBlockingMode = (( ) => {

88 88

// TODO: Reset to original blocking profile?

89 89

if ( newProfileBits === undefined ) { return; }

90 90 91 +

const noReload = (newProfileBits & 0b00000001) === 0;

92 + 91 93

if (

92 94

(curProfileBits & 0b00000010) !== 0 &&

93 95

(newProfileBits & 0b00000010) === 0

@@ -104,6 +106,7 @@ const relaxBlockingMode = (( ) => {

104 106

(newProfileBits & 0b00000100) === 0

105 107

) {

106 108

µb.toggleFirewallRule({

109 +

tabId: noReload ? tab.id : undefined,

107 110

srcHostname: hn,

108 111

desHostname: '*',

109 112

requestType: '3p',

@@ -135,7 +138,7 @@ const relaxBlockingMode = (( ) => {

135 138

}

136 139 137 140

// Reload the target tab?

138 -

if ( (newProfileBits & 0b00000001) === 0 ) { return; }

141 +

if ( noReload ) { return; }

139 142 140 143

// Reload: use a timer to coalesce bursts of reload commands.

141 144

let timer = reloadTimers.get(tab.id);

Original file line number Diff line number Diff line change

@@ -0,0 +1,70 @@

1 +

/*******************************************************************************

2 + 3 +

uBlock Origin - a browser extension to block requests.

4 +

Copyright (C) 2020-present Raymond Hill

5 + 6 +

This program is free software: you can redistribute it and/or modify

7 +

it under the terms of the GNU General Public License as published by

8 +

the Free Software Foundation, either version 3 of the License, or

9 +

(at your option) any later version.

10 + 11 +

This program is distributed in the hope that it will be useful,

12 +

but WITHOUT ANY WARRANTY; without even the implied warranty of

13 +

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

14 +

GNU General Public License for more details.

15 + 16 +

You should have received a copy of the GNU General Public License

17 +

along with this program. If not, see {http://www.gnu.org/licenses/}.

18 + 19 +

Home: https://github.com/gorhill/uBlock

20 +

*/

21 + 22 +

'use strict';

23 + 24 +

/******************************************************************************/

25 + 26 +

(( ) => {

27 +

if ( typeof vAPI !== 'object' ) { return; }

28 + 29 +

if ( vAPI.load3rdPartyCSS ) { return; }

30 +

vAPI.load3rdPartyCSS = true;

31 + 32 +

const links = document.querySelectorAll('link[rel="stylesheet"]');

33 +

if ( links.length === 0 ) { return; }

34 + 35 +

const toLoadMaybe = new Map(Array.from(links).map(a => [ a.href, a ]));

36 + 37 +

for ( const sheet of Array.from(document.styleSheets) ) {

38 +

let loaded = false;

39 +

try {

40 +

loaded = sheet.rules.length !== 0;

41 +

} catch(ex) {

42 +

}

43 +

if ( loaded ) { continue; }

44 +

const link = toLoadMaybe.get(sheet.href);

45 +

if ( link === undefined ) { continue; }

46 +

toLoadMaybe.delete(sheet.href);

47 +

const clone = link.cloneNode(true);

48 +

link.replaceWith(clone);

49 +

}

50 +

})();

51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 +

/*******************************************************************************

60 + 61 +

DO NOT:

62 +

- Remove the following code

63 +

- Add code beyond the following code

64 +

Reason:

65 +

- https://github.com/gorhill/uBlock/pull/3721

66 +

- uBO never uses the return value from injected content scripts

67 + 68 +

**/

69 + 70 +

void 0;

Original file line number Diff line number Diff line change

@@ -509,9 +509,19 @@ const matchBucket = function(url, hostname, bucket, start) {

509 509

// https://github.com/chrisaljoudi/uBlock/issues/420

510 510

this.cosmeticFilteringEngine.removeFromSelectorCache(srcHostname, 'net');

511 511 512 +

if ( details.tabId === undefined ) { return; }

513 + 512 514

if ( requestType.startsWith('3p') ) {

513 515

this.updateToolbarIcon(details.tabId, 0b100);

514 516

}

517 + 518 +

if ( requestType === '3p' && action === 3 ) {

519 +

vAPI.tabs.executeScript(details.tabId, {

520 +

file: '/js/scriptlets/load-3p-css.js',

521 +

allFrames: true,

522 +

runAt: 'document_idle',

523 +

});

524 +

}

515 525

};

516 526 517 527

/******************************************************************************/

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4