correcting old browser detection logic, fixes #446
This commit is contained in:
parent
fdc532b3c1
commit
67b9b5f0d8
|
@ -4580,11 +4580,11 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
function isOldBrowser() {
|
function isOldBrowser() {
|
||||||
// webcrypto support
|
// webcrypto support
|
||||||
if (typeof window.crypto !== 'object') {
|
if (typeof window.crypto !== 'object') {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof WebAssembly !== 'object' && typeof WebAssembly.instantiate !== 'function') {
|
if (typeof WebAssembly !== 'object' && typeof WebAssembly.instantiate !== 'function') {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// [\0, 'a', 's', 'm', (uint_32) 1] - smallest valid wasm module
|
// [\0, 'a', 's', 'm', (uint_32) 1] - smallest valid wasm module
|
||||||
|
@ -4595,17 +4595,17 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
new WebAssembly.Instance(module) instanceof WebAssembly.Instance
|
new WebAssembly.Instance(module) instanceof WebAssembly.Instance
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not checking for async/await, ES6, Promise or Uint8Array support,
|
// not checking for async/await, ES6, Promise or Uint8Array support,
|
||||||
// as most browsers introduced these earlier then webassembly and webcrypto:
|
// as most browsers introduced these earlier then webassembly and webcrypto:
|
||||||
// https://github.com/PrivateBin/PrivateBin/pull/431#issuecomment-493129359
|
// https://github.com/PrivateBin/PrivateBin/pull/431#issuecomment-493129359
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,6 +22,7 @@ describe('InitialCheck', function () {
|
||||||
'</body></html>'
|
'</body></html>'
|
||||||
);
|
);
|
||||||
$.PrivateBin.Alert.init();
|
$.PrivateBin.Alert.init();
|
||||||
|
window.crypto = null;
|
||||||
const result1 = !$.PrivateBin.InitialCheck.init(),
|
const result1 = !$.PrivateBin.InitialCheck.init(),
|
||||||
result2 = !$('#errormessage').hasClass('hidden');
|
result2 = !$('#errormessage').hasClass('hidden');
|
||||||
clean();
|
clean();
|
||||||
|
@ -48,13 +49,10 @@ describe('InitialCheck', function () {
|
||||||
'<html><body><div id="errormessage" class="hidden"></div>'+
|
'<html><body><div id="errormessage" class="hidden"></div>'+
|
||||||
'<div id="oldnotice" class="hidden"></div></body></html>'
|
'<div id="oldnotice" class="hidden"></div></body></html>'
|
||||||
);
|
);
|
||||||
const crypto = window.crypto;
|
|
||||||
window.crypto = null;
|
|
||||||
$.PrivateBin.Alert.init();
|
$.PrivateBin.Alert.init();
|
||||||
const result1 = !$.PrivateBin.InitialCheck.init(),
|
const result1 = !$.PrivateBin.InitialCheck.init(),
|
||||||
result2 = isSecureContext === $('#errormessage').hasClass('hidden'),
|
result2 = isSecureContext === $('#errormessage').hasClass('hidden'),
|
||||||
result3 = !$('#oldnotice').hasClass('hidden');
|
result3 = !$('#oldnotice').hasClass('hidden');
|
||||||
window.crypto = crypto;
|
|
||||||
clean();
|
clean();
|
||||||
return result1 && result2 && result3;
|
return result1 && result2 && result3;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +76,7 @@ describe('InitialCheck', function () {
|
||||||
'</body></html>'
|
'</body></html>'
|
||||||
);
|
);
|
||||||
$.PrivateBin.Alert.init();
|
$.PrivateBin.Alert.init();
|
||||||
|
window.crypto = null;
|
||||||
const result1 = $.PrivateBin.InitialCheck.init(),
|
const result1 = $.PrivateBin.InitialCheck.init(),
|
||||||
result2 = isSecureContext === $('#httpnotice').hasClass('hidden');
|
result2 = isSecureContext === $('#httpnotice').hasClass('hidden');
|
||||||
clean();
|
clean();
|
||||||
|
|
|
@ -72,7 +72,7 @@ if ($MARKDOWN):
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.11.js" integrity="sha512-p7UyJuyBkhMcMgE4mDsgK0Lz70OvetLefua1oXs1OujWv9gOxh4xy8InFux7bZ4/DAZsTmO4rgVwZW9BHKaTaw==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.11.js" integrity="sha512-p7UyJuyBkhMcMgE4mDsgK0Lz70OvetLefua1oXs1OujWv9gOxh4xy8InFux7bZ4/DAZsTmO4rgVwZW9BHKaTaw==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-xa4Dzm5z/8B3iElnf+46U0BMyvmDtQQdLO+O9DCnozrpuHb9YZ3MkAFMwbuytSgFx76FNvp/aQhTwqM4a6qbow==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-yrdGnBnMXuR3FYwWA7kHON7f7Beqr7EvUnIH4/m3qUuLaudXIcqJnt6qLIWLGL5E156DcVZc460rLzUGKlSHsA==" crossorigin="anonymous"></script>
|
||||||
<!--[if IE]>
|
<!--[if IE]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
|
@ -50,7 +50,7 @@ if ($MARKDOWN):
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.11.js" integrity="sha512-p7UyJuyBkhMcMgE4mDsgK0Lz70OvetLefua1oXs1OujWv9gOxh4xy8InFux7bZ4/DAZsTmO4rgVwZW9BHKaTaw==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.11.js" integrity="sha512-p7UyJuyBkhMcMgE4mDsgK0Lz70OvetLefua1oXs1OujWv9gOxh4xy8InFux7bZ4/DAZsTmO4rgVwZW9BHKaTaw==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-xa4Dzm5z/8B3iElnf+46U0BMyvmDtQQdLO+O9DCnozrpuHb9YZ3MkAFMwbuytSgFx76FNvp/aQhTwqM4a6qbow==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-yrdGnBnMXuR3FYwWA7kHON7f7Beqr7EvUnIH4/m3qUuLaudXIcqJnt6qLIWLGL5E156DcVZc460rLzUGKlSHsA==" crossorigin="anonymous"></script>
|
||||||
<!--[if IE]>
|
<!--[if IE]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
Loading…
Reference in New Issue