Fix 'DedicatedWorkerGlobalScope is not defined' error on Web env

This commit is contained in:
Aleksander Tatarczyk
2018-05-24 16:55:00 +02:00
parent 406e86be2d
commit 4342f7788c

View File

@@ -32,7 +32,7 @@ if (typeof window !== "undefined") {
// using `xss` on the WebWorker, output `filterXSS` to the globals
function isWorkerEnv() {
return typeof self !== 'undefined' && self instanceof DedicatedWorkerGlobalScope;
return typeof self !== 'undefined' && typeof DedicatedWorkerGlobalScope !== 'undefined' && self instanceof DedicatedWorkerGlobalScope;
}
if (isWorkerEnv()) {
self.filterXSS = module.exports;