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 oneSecond = 1000,
|
|
|
|
oneMinute = 60 * oneSecond;
|
2014-09-26 03:21:55 +02:00
|
|
|
|
2018-11-03 12:58:46 +01:00
|
|
|
const hiddenSettingsDefault = {
|
2017-01-18 19:17:47 +01:00
|
|
|
assetFetchTimeout: 30,
|
|
|
|
autoUpdateAssetFetchPeriod: 120,
|
|
|
|
autoUpdatePeriod: 7,
|
2018-11-02 20:18:50 +01:00
|
|
|
benchmarkingPane: false,
|
2018-08-21 18:59:35 +02:00
|
|
|
cacheStorageCompression: true,
|
2018-05-17 13:33:21 +02:00
|
|
|
debugScriptlets: false,
|
2018-09-21 15:16:46 +02:00
|
|
|
cacheControlForFirefox1376932: 'no-cache, no-store, must-revalidate',
|
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,
|
2018-10-29 13:56:51 +01:00
|
|
|
strictBlockingBypassDuration: 120,
|
2017-03-05 18:54:47 +01:00
|
|
|
suspendTabsUntilReady: false,
|
|
|
|
userResourcesLocation: 'unset'
|
2017-03-05 14:25:55 +01:00
|
|
|
};
|
|
|
|
|
2018-11-03 12:58:46 +01:00
|
|
|
const whitelistDefault = [
|
2018-04-20 17:26:11 +02:00
|
|
|
'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
|
|
|
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,
|
|
|
|
ignoreGenericCosmeticFilters: false,
|
|
|
|
largeMediaSize: 50,
|
|
|
|
parseAllABPHideFilters: true,
|
|
|
|
prefetchingDisabled: true,
|
|
|
|
requestLogMaxEntries: 1000,
|
|
|
|
showIconBadge: true,
|
|
|
|
tooltipsDisabled: false,
|
|
|
|
webrtcIPAddressHidden: false
|
|
|
|
},
|
|
|
|
|
|
|
|
hiddenSettingsDefault: hiddenSettingsDefault,
|
|
|
|
hiddenSettings: (function() {
|
2018-10-28 14:58:25 +01:00
|
|
|
let out = Object.assign({}, hiddenSettingsDefault),
|
2018-02-21 19:29:36 +01:00
|
|
|
json = vAPI.localStorage.getItem('immediateHiddenSettings');
|
2017-03-05 14:25:55 +01:00
|
|
|
if ( typeof json === 'string' ) {
|
|
|
|
try {
|
2018-10-28 14:58:25 +01:00
|
|
|
let o = JSON.parse(json);
|
2017-03-05 14:25:55 +01:00
|
|
|
if ( o instanceof Object ) {
|
2018-10-28 14:58:25 +01:00
|
|
|
for ( let k in o ) {
|
2017-03-05 14:25:55 +01:00
|
|
|
if ( out.hasOwnProperty(k) ) {
|
|
|
|
out[k] = o[k];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(ex) {
|
|
|
|
}
|
|
|
|
}
|
2018-02-21 19:29:36 +01:00
|
|
|
// Remove once 1.15.12+ is widespread.
|
|
|
|
vAPI.localStorage.removeItem('hiddenSettings');
|
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
|
|
|
|
netWhitelist: {},
|
|
|
|
netWhitelistModifyTime: 0,
|
2018-04-20 17:26:11 +02:00
|
|
|
netWhitelistDefault: whitelistDefault.join('\n'),
|
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: {
|
2018-10-23 19:01:08 +02:00
|
|
|
compiledMagic: 6, // Increase when compiled format changes
|
|
|
|
selfieMagic: 6 // 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: {},
|
|
|
|
|
2017-06-02 14:17:09 +02:00
|
|
|
selfieAfter: 17 * oneMinute,
|
2017-03-05 14:25:55 +01:00
|
|
|
|
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: {},
|
2017-03-05 14:25:55 +01:00
|
|
|
};
|
2014-06-24 00:42:43 +02:00
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
/******************************************************************************/
|