|
| 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; |
0 commit comments