mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-24 11:22:44 +01:00
add new advanced setting to disable use of WASM for dev purpose
This commit is contained in:
parent
7831c094fc
commit
2189f020df
@ -44,8 +44,9 @@ const µBlock = (function() { // jshint ignore:line
|
||||
autoUpdatePeriod: 7,
|
||||
benchmarkingPane: false,
|
||||
cacheStorageCompression: true,
|
||||
debugScriptlets: false,
|
||||
cacheControlForFirefox1376932: 'no-cache, no-store, must-revalidate',
|
||||
debugScriptlets: false,
|
||||
disableWebAssembly: false,
|
||||
ignoreRedirectFilters: false,
|
||||
ignoreScriptInjectFilters: false,
|
||||
manualUpdateAssetFetchPeriod: 500,
|
||||
|
@ -467,6 +467,15 @@ const hnTrieManager = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Soft-dependency on µBlock's advanced settings so that the code here can
|
||||
// be used outside of uBO (i.e. tests, benchmarks)
|
||||
if (
|
||||
typeof µBlock === 'object' &&
|
||||
µBlock.hiddenSettings.disableWebAssembly === true
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The wasm module will work only if CPU is natively little-endian,
|
||||
// as we use native uint32 array in our trie-creation js code.
|
||||
const uint32s = new Uint32Array(1);
|
||||
|
@ -52,7 +52,11 @@ let init = function() {
|
||||
return Promise.resolve(lz4CodecInstance);
|
||||
}
|
||||
if ( pendingInitialization === undefined ) {
|
||||
pendingInitialization = lz4BlockCodec.createInstance()
|
||||
let flavor;
|
||||
if ( µBlock.hiddenSettings.disableWebAssembly === true ) {
|
||||
flavor = 'js';
|
||||
}
|
||||
pendingInitialization = lz4BlockCodec.createInstance(flavor)
|
||||
.then(instance => {
|
||||
lz4CodecInstance = instance;
|
||||
pendingInitialization = undefined;
|
||||
|
@ -186,6 +186,7 @@
|
||||
vAPI.localStorage.setItem(
|
||||
'immediateHiddenSettings',
|
||||
JSON.stringify({
|
||||
disableWebAssembly: this.hiddenSettings.disableWebAssembly,
|
||||
suspendTabsUntilReady: this.hiddenSettings.suspendTabsUntilReady,
|
||||
userResourcesLocation: this.hiddenSettings.userResourcesLocation
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user