check for WorkerGlobalScope (fixes #1)