2014-06-24 00:42:43 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
|
2016-06-29 04:01:15 +02:00
|
|
|
uBlock Origin - a browser extension to block requests.
|
2018-08-06 18:34:41 +02:00
|
|
|
Copyright (C) 2014-present Raymond Hill
|
2014-06-24 00:42:43 +02:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
|
|
|
|
|
|
|
Home: https://github.com/gorhill/uBlock
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2017-03-05 14:25:55 +01:00
|
|
|
'use strict';
|
2014-08-21 05:19:27 +02:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-04-05 13:29:15 +02:00
|
|
|
// Not all platforms may have properly declared vAPI.webextFlavor.
|
|
|
|
|
|
|
|
if ( vAPI.webextFlavor === undefined ) {
|
2018-04-18 13:11:13 +02:00
|
|
|
vAPI.webextFlavor = { major: 0, soup: new Set([ 'ublock' ]) };
|
2018-04-05 13:29:15 +02:00
|
|
|
}
|
|
|
|
|
2018-04-18 13:11:13 +02:00
|
|
|
|
2018-04-05 13:29:15 +02:00
|
|
|
/******************************************************************************/
|
|
|
|
|
2019-09-21 17:30:38 +02:00
|
|
|
const µBlock = (( ) => { // jshint ignore:line
|
2014-09-26 03:21:55 +02:00
|
|
|
|
2018-11-03 12:58:46 +01:00
|
|
|
const hiddenSettingsDefault = {
|
2019-05-19 00:57:32 +02:00
|
|
|
allowGenericProceduralFilters: false,
|
2017-01-18 19:17:47 +01:00
|
|
|
assetFetchTimeout: 30,
|
2019-01-08 13:37:50 +01:00
|
|
|
autoCommentFilterTemplate: '{{date}} {{origin}}',
|
2017-01-18 19:17:47 +01:00
|
|
|
autoUpdateAssetFetchPeriod: 120,
|
2019-05-20 00:31:12 +02:00
|
|
|
autoUpdateDelayAfterLaunch: 180,
|
2017-01-18 19:17:47 +01:00
|
|
|
autoUpdatePeriod: 7,
|
2020-02-21 14:06:52 +01:00
|
|
|
benchmarkDatasetURL: 'unset',
|
2019-08-11 19:55:39 +02:00
|
|
|
blockingProfiles: '11111/#F00 11011/#C0F 11001/#00F 00001',
|
2019-01-26 00:49:30 +01:00
|
|
|
cacheStorageAPI: 'unset',
|
2018-08-21 18:59:35 +02:00
|
|
|
cacheStorageCompression: true,
|
2018-09-21 15:16:46 +02:00
|
|
|
cacheControlForFirefox1376932: 'no-cache, no-store, must-revalidate',
|
2020-08-16 17:53:55 +02:00
|
|
|
cloudStorageCompression: false,
|
2019-11-19 18:05:33 +01:00
|
|
|
cnameIgnoreList: 'unset',
|
|
|
|
cnameIgnore1stParty: true,
|
2019-12-01 18:05:49 +01:00
|
|
|
cnameIgnoreExceptions: true,
|
2019-11-23 18:46:52 +01:00
|
|
|
cnameIgnoreRootDocument: true,
|
2019-12-31 22:36:51 +01:00
|
|
|
cnameMaxTTL: 120,
|
2019-11-23 18:46:52 +01:00
|
|
|
cnameReplayFullURL: false,
|
2019-12-01 18:05:49 +01:00
|
|
|
cnameUncloak: true,
|
2020-03-22 19:52:58 +01:00
|
|
|
cnameUncloakProxied: false,
|
2019-02-14 19:33:55 +01:00
|
|
|
consoleLogLevel: 'unset',
|
2018-11-16 16:19:06 +01:00
|
|
|
debugScriptlets: false,
|
2019-07-03 20:33:06 +02:00
|
|
|
debugScriptletInjector: false,
|
2018-11-16 16:19:06 +01:00
|
|
|
disableWebAssembly: false,
|
2019-09-11 14:00:55 +02:00
|
|
|
extensionUpdateForceReload: false,
|
2016-11-03 16:20:47 +01:00
|
|
|
ignoreRedirectFilters: false,
|
|
|
|
ignoreScriptInjectFilters: false,
|
2019-09-24 23:05:03 +02:00
|
|
|
filterAuthorMode: false,
|
2019-09-06 17:41:07 +02:00
|
|
|
loggerPopupType: 'popup',
|
2018-04-09 14:26:14 +02:00
|
|
|
manualUpdateAssetFetchPeriod: 500,
|
2016-11-06 22:27:21 +01:00
|
|
|
popupFontSize: 'unset',
|
2020-05-02 01:47:01 +02:00
|
|
|
popupPanelDisabledSections: 0,
|
|
|
|
popupPanelLockedSections: 0,
|
2020-05-22 14:47:51 +02:00
|
|
|
popupPanelHeightMode: 0,
|
2018-09-01 00:47:02 +02:00
|
|
|
requestJournalProcessPeriod: 1000,
|
2019-05-18 20:43:44 +02:00
|
|
|
selfieAfter: 3,
|
2018-10-29 13:56:51 +01:00
|
|
|
strictBlockingBypassDuration: 120,
|
2019-02-19 18:30:37 +01:00
|
|
|
suspendTabsUntilReady: 'unset',
|
2020-04-27 16:33:49 +02:00
|
|
|
uiPopupConfig: 'undocumented',
|
2020-01-25 15:24:59 +01:00
|
|
|
uiFlavor: 'unset',
|
2020-05-19 16:33:36 +02:00
|
|
|
uiStyles: 'unset',
|
2019-07-26 15:52:11 +02:00
|
|
|
updateAssetBypassBrowserCache: false,
|
2019-05-19 00:57:32 +02:00
|
|
|
userResourcesLocation: 'unset',
|
2017-03-05 14:25:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
userSettings: {
|
|
|
|
advancedUserEnabled: false,
|
2018-05-27 14:31:17 +02:00
|
|
|
alwaysDetachLogger: true,
|
2017-03-05 14:25:55 +01:00
|
|
|
autoUpdate: true,
|
|
|
|
cloudStorageEnabled: false,
|
|
|
|
collapseBlocked: true,
|
|
|
|
colorBlindFriendly: false,
|
|
|
|
contextMenuEnabled: true,
|
|
|
|
dynamicFilteringEnabled: false,
|
|
|
|
externalLists: [],
|
|
|
|
firewallPaneMinimized: true,
|
|
|
|
hyperlinkAuditingDisabled: true,
|
2019-05-11 15:04:13 +02:00
|
|
|
ignoreGenericCosmeticFilters: vAPI.webextFlavor.soup.has('mobile'),
|
2017-03-05 14:25:55 +01:00
|
|
|
largeMediaSize: 50,
|
|
|
|
parseAllABPHideFilters: true,
|
2020-05-12 16:11:24 +02:00
|
|
|
popupPanelSections: 0b111,
|
2017-03-05 14:25:55 +01:00
|
|
|
prefetchingDisabled: true,
|
|
|
|
requestLogMaxEntries: 1000,
|
|
|
|
showIconBadge: true,
|
|
|
|
tooltipsDisabled: false,
|
2019-09-21 17:30:38 +02:00
|
|
|
webrtcIPAddressHidden: false,
|
2017-03-05 14:25:55 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
hiddenSettingsDefault: hiddenSettingsDefault,
|
2020-02-23 18:18:45 +01:00
|
|
|
hiddenSettings: Object.assign({}, hiddenSettingsDefault),
|
2017-03-05 14:25:55 +01:00
|
|
|
|
|
|
|
// Features detection.
|
|
|
|
privacySettingsSupported: vAPI.browserSettings instanceof Object,
|
|
|
|
cloudStorageSupported: vAPI.cloud instanceof Object,
|
2018-10-28 14:58:25 +01:00
|
|
|
canFilterResponseData: typeof browser.webRequest.filterResponseData === 'function',
|
2018-05-18 16:19:14 +02:00
|
|
|
canInjectScriptletsNow: vAPI.webextFlavor.soup.has('chromium'),
|
2017-03-05 14:25:55 +01:00
|
|
|
|
|
|
|
// https://github.com/chrisaljoudi/uBlock/issues/180
|
|
|
|
// Whitelist directives need to be loaded once the PSL is available
|
2019-06-25 17:57:14 +02:00
|
|
|
netWhitelist: new Map(),
|
2017-03-05 14:25:55 +01:00
|
|
|
netWhitelistModifyTime: 0,
|
2019-05-18 20:20:05 +02:00
|
|
|
netWhitelistDefault: [
|
|
|
|
'about-scheme',
|
|
|
|
'chrome-extension-scheme',
|
|
|
|
'chrome-scheme',
|
2020-02-20 22:43:56 +01:00
|
|
|
'edge-scheme',
|
2019-05-18 20:20:05 +02:00
|
|
|
'moz-extension-scheme',
|
|
|
|
'opera-scheme',
|
|
|
|
'vivaldi-scheme',
|
|
|
|
'wyciwyg-scheme', // Firefox's "What-You-Cache-Is-What-You-Get"
|
|
|
|
],
|
2017-03-05 14:25:55 +01:00
|
|
|
|
|
|
|
localSettings: {
|
|
|
|
blockedRequestCount: 0,
|
2019-09-21 17:30:38 +02:00
|
|
|
allowedRequestCount: 0,
|
2017-03-05 14:25:55 +01:00
|
|
|
},
|
|
|
|
localSettingsLastModified: 0,
|
|
|
|
localSettingsLastSaved: 0,
|
|
|
|
|
2018-05-31 16:41:03 +02:00
|
|
|
// Read-only
|
2017-03-05 14:25:55 +01:00
|
|
|
systemSettings: {
|
2020-05-24 16:46:16 +02:00
|
|
|
compiledMagic: 28, // Increase when compiled format changes
|
|
|
|
selfieMagic: 28, // Increase when selfie format changes
|
2017-03-05 14:25:55 +01:00
|
|
|
},
|
|
|
|
|
2019-10-27 16:49:05 +01:00
|
|
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/759#issuecomment-546654501
|
|
|
|
// The assumption is that cache storage state reflects whether
|
|
|
|
// compiled or selfie assets are available or not. The properties
|
|
|
|
// below is to no longer rely on this assumption -- though it's still
|
|
|
|
// not clear how the assumption could be wrong, and it's still not
|
|
|
|
// clear whether relying on those properties will really solve the
|
|
|
|
// issue. It's just an attempt at hardening.
|
|
|
|
compiledFormatChanged: false,
|
|
|
|
selfieIsInvalid: false,
|
|
|
|
|
2017-03-05 14:25:55 +01:00
|
|
|
restoreBackupSettings: {
|
|
|
|
lastRestoreFile: '',
|
|
|
|
lastRestoreTime: 0,
|
|
|
|
lastBackupFile: '',
|
2019-09-21 17:30:38 +02:00
|
|
|
lastBackupTime: 0,
|
2017-03-05 14:25:55 +01:00
|
|
|
},
|
|
|
|
|
2018-07-19 00:00:55 +02:00
|
|
|
commandShortcuts: new Map(),
|
|
|
|
|
2017-03-05 14:25:55 +01:00
|
|
|
// Allows to fully customize uBO's assets, typically set through admin
|
|
|
|
// settings. The content of 'assets.json' will also tell which filter
|
|
|
|
// lists to enable by default when uBO is first installed.
|
2019-07-18 16:53:08 +02:00
|
|
|
assetsBootstrapLocation: undefined,
|
2017-03-05 14:25:55 +01:00
|
|
|
|
|
|
|
userFiltersPath: 'user-filters',
|
|
|
|
pslAssetKey: 'public_suffix_list.dat',
|
|
|
|
|
|
|
|
selectedFilterLists: [],
|
|
|
|
availableFilterLists: {},
|
2020-08-22 14:43:16 +02:00
|
|
|
badLists: new Map(),
|
2017-03-05 14:25:55 +01:00
|
|
|
|
2020-04-04 17:34:43 +02:00
|
|
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/974
|
|
|
|
// This can be used to defer filtering decision-making.
|
|
|
|
readyToFilter: false,
|
|
|
|
|
2018-02-26 19:59:16 +01:00
|
|
|
pageStores: new Map(),
|
2017-03-05 14:25:55 +01:00
|
|
|
pageStoresToken: 0,
|
|
|
|
|
|
|
|
storageQuota: vAPI.storage.QUOTA_BYTES,
|
|
|
|
storageUsed: 0,
|
|
|
|
|
|
|
|
noopFunc: function(){},
|
|
|
|
|
|
|
|
apiErrorCount: 0,
|
2017-09-06 01:49:48 +02:00
|
|
|
|
2019-09-18 18:17:45 +02:00
|
|
|
maybeGoodPopup: {
|
|
|
|
tabId: 0,
|
|
|
|
url: '',
|
2017-09-06 01:49:48 +02:00
|
|
|
},
|
|
|
|
|
2019-09-18 18:17:45 +02:00
|
|
|
epickerArgs: {
|
|
|
|
eprom: null,
|
|
|
|
mouse: false,
|
|
|
|
target: '',
|
|
|
|
zap: false,
|
|
|
|
},
|
2017-03-05 14:25:55 +01:00
|
|
|
|
2018-04-06 22:02:35 +02:00
|
|
|
scriptlets: {},
|
2019-05-11 16:40:34 +02:00
|
|
|
|
|
|
|
cspNoInlineScript: "script-src 'unsafe-eval' * blob: data:",
|
|
|
|
cspNoScripting: 'script-src http: https:',
|
|
|
|
cspNoInlineFont: 'font-src *',
|
2019-08-11 19:55:39 +02:00
|
|
|
|
|
|
|
liveBlockingProfiles: [],
|
2019-08-19 15:00:53 +02:00
|
|
|
blockingProfileColorCache: new Map(),
|
2017-03-05 14:25:55 +01:00
|
|
|
};
|
2014-06-24 00:42:43 +02:00
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
/******************************************************************************/
|