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
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.
let workingDir;
{
const url = document.currentScript.src;
const match = /[^\/]+$/.exec(url);
workingDir = match !== null
? url.slice(0, match.index)
: '';
const url = new URL(document.currentScript.src);
const match = /[^\/]+$/.exec(url.pathname);
if ( match !== null ) {
url.pathname = url.pathname.slice(0, match.index);
}
workingDir = url.href;
}
const memory = new WebAssembly.Memory({ initial: 1 });