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
|
|
|
/******************************************************************************/
|
|
|
|
|
2018-11-03 12:58:46 +01:00
|
|
|
const µBlock = (function() { // 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,
|
2019-06-27 14:16:18 +02:00
|
|
|
blockingProfiles: '11101 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',
|
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,
|
2016-11-03 16:20:47 +01:00
|
|
|
ignoreRedirectFilters: false,
|
|
|
|
ignoreScriptInjectFilters: false,
|
2018-04-09 14:26:14 +02:00
|
|
|
manualUpdateAssetFetchPeriod: 500,
|
2016-11-06 22:27:21 +01:00
|
|
|
popupFontSize: 'unset',
|
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',
|
2019-05-19 00:57:32 +02:00
|
|
|
userResourcesLocation: 'unset',
|
2017-03-05 14:25:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
firstInstall: false,
|
|
|
|
|
|
|
|
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,
|
|
|
|
prefetchingDisabled: true,
|
|
|
|
requestLogMaxEntries: 1000,
|
|
|
|
showIconBadge: true,
|
|
|
|
tooltipsDisabled: false,
|
|
|
|
webrtcIPAddressHidden: false
|
|
|
|
},
|
|
|
|
|
|
|
|
hiddenSettingsDefault: hiddenSettingsDefault,
|
|
|
|
hiddenSettings: (function() {
|
2019-02-18 20:41:04 +01:00
|
|
|
const out = Object.assign({}, hiddenSettingsDefault);
|
|
|
|
const json = vAPI.localStorage.getItem('immediateHiddenSettings');
|
|
|
|
if ( typeof json !== 'string' ) { return out; }
|
|
|
|
try {
|
|
|
|
const o = JSON.parse(json);
|
|
|
|
if ( o instanceof Object ) {
|
|
|
|
for ( const k in o ) {
|
|
|
|
if ( out.hasOwnProperty(k) ) { out[k] = o[k]; }
|
2017-03-05 14:25:55 +01:00
|
|
|
}
|
2019-02-18 20:41:04 +01:00
|
|
|
self.log.verbosity = out.consoleLogLevel;
|
2019-02-19 18:30:37 +01:00
|
|
|
if ( typeof out.suspendTabsUntilReady === 'boolean' ) {
|
|
|
|
out.suspendTabsUntilReady = out.suspendTabsUntilReady
|
|
|
|
? 'yes'
|
|
|
|
: 'unset';
|
|
|
|
}
|
2017-03-05 14:25:55 +01:00
|
|
|
}
|
2019-02-18 20:41:04 +01:00
|
|
|
}
|
|
|
|
catch(ex) {
|
2017-03-05 14:25:55 +01:00
|
|
|
}
|
|
|
|
return out;
|
|
|
|
})(),
|
|
|
|
|
|
|
|
// 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',
|
|
|
|
'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,
|
|
|
|
allowedRequestCount: 0
|
|
|
|
},
|
|
|
|
localSettingsLastModified: 0,
|
|
|
|
localSettingsLastSaved: 0,
|
|
|
|
|
2018-05-31 16:41:03 +02:00
|
|
|
// Read-only
|
2017-03-05 14:25:55 +01:00
|
|
|
systemSettings: {
|
2019-06-19 01:16:39 +02:00
|
|
|
compiledMagic: 17, // Increase when compiled format changes
|
|
|
|
selfieMagic: 17 // Increase when selfie format changes
|
2017-03-05 14:25:55 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
restoreBackupSettings: {
|
|
|
|
lastRestoreFile: '',
|
|
|
|
lastRestoreTime: 0,
|
|
|
|
lastBackupFile: '',
|
|
|
|
lastBackupTime: 0
|
|
|
|
},
|
|
|
|
|
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.
|
|
|
|
assetsBootstrapLocation: 'assets/assets.json',
|
|
|
|
|
|
|
|
userFiltersPath: 'user-filters',
|
|
|
|
pslAssetKey: 'public_suffix_list.dat',
|
|
|
|
|
|
|
|
selectedFilterLists: [],
|
|
|
|
availableFilterLists: {},
|
|
|
|
|
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
|
|
|
|
|
|
|
mouseEventRegister: {
|
|
|
|
tabId: '',
|
|
|
|
x: -1,
|
|
|
|
y: -1,
|
|
|
|
url: ''
|
|
|
|
},
|
|
|
|
|
2017-03-05 14:25:55 +01:00
|
|
|
epickerTarget: '',
|
2017-05-27 17:51:24 +02:00
|
|
|
epickerZap: false,
|
2017-03-05 14:25:55 +01:00
|
|
|
epickerEprom: null,
|
|
|
|
|
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 *',
|
2017-03-05 14:25:55 +01:00
|
|
|
};
|
2014-06-24 00:42:43 +02:00
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
/******************************************************************************/
|