fix an issue where loading antlr from an IE web worker would fail
This commit is contained in:
parent
aa909ddcb1
commit
d5dcfc42c4
|
@ -62,13 +62,16 @@
|
|||
// anchor element as parser in that case. Thes breaks web worker support,
|
||||
// but we don't care since these browsers also don't support web workers.
|
||||
|
||||
try {
|
||||
var parser = new URL(location.href);
|
||||
}
|
||||
catch (e) {
|
||||
console.warn("Honey: falling back to DOM workaround for URL parser ("+e+")");
|
||||
parser = document.createElement('A');
|
||||
}
|
||||
var parser = (function() {
|
||||
try {
|
||||
return new URL(location.href);
|
||||
} catch(e) {
|
||||
var p = Object.create(location);
|
||||
// need to set writable, because WorkerLocation is read-only
|
||||
Object.defineProperty(p, "href", {writable:true});
|
||||
return p;
|
||||
}
|
||||
})();
|
||||
|
||||
// INFO Module cache
|
||||
// Contains getter functions for the exports objects of all the loaded
|
||||
|
|
Loading…
Reference in New Issue