1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 04:49:12 +02:00

minor code review

This commit is contained in:
Raymond Hill 2018-11-04 19:26:02 -02:00
parent 95899a0d1d
commit a42513aa2f
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 7 additions and 6 deletions

View File

@ -1,3 +1,3 @@
## uBlock Origin pages ## uBlock Origin pages
HTML: <http://gorhill.github.io/uBlock/>. HTML: <https://gorhill.github.io/uBlock/>.

View File

@ -477,11 +477,12 @@ const hnTrieManager = {
// location, and consequently so will be the related WASM file. // location, and consequently so will be the related WASM file.
let workingDir; let workingDir;
{ {
const url = document.currentScript.src; const url = new URL(document.currentScript.src);
const match = /[^\/]+$/.exec(url); const match = /[^\/]+$/.exec(url.pathname);
workingDir = match !== null if ( match !== null ) {
? url.slice(0, match.index) url.pathname = url.pathname.slice(0, match.index);
: ''; }
workingDir = url.href;
} }
const memory = new WebAssembly.Memory({ initial: 1 }); const memory = new WebAssembly.Memory({ initial: 1 });