File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -636,12 +636,13 @@ fireauth.util.isOpenerAnIframe = function(opt_win) {
636
636
637
637
638
638
/**
639
- * @param {?Object= } opt_global The optional global scope.
639
+ * @param {?Object= } global The optional global scope.
640
640
* @return {boolean } Whether current environment is a worker.
641
641
*/
642
- fireauth . util . isWorker = function ( opt_global ) {
643
- var scope = opt_global || goog . global ;
644
- return typeof scope [ 'window' ] !== 'object' &&
642
+ fireauth . util . isWorker = function ( global ) {
643
+ var scope = global || goog . global ;
644
+ // WorkerGlobalScope only defined in worker environment.
645
+ return typeof scope [ 'WorkerGlobalScope' ] !== 'undefined' &&
645
646
typeof scope [ 'importScripts' ] === 'function' ;
646
647
} ;
647
648
Original file line number Diff line number Diff line change @@ -557,6 +557,7 @@ function testGetEnvironment_worker() {
557
557
function testIsWorker ( ) {
558
558
assertFalse ( fireauth . util . isWorker ( { 'window' : { } } ) ) ;
559
559
assertTrue ( fireauth . util . isWorker ( {
560
+ 'WorkerGlobalScope' : function ( ) { } ,
560
561
'importScripts' : function ( ) { }
561
562
} ) ) ;
562
563
}
You can’t perform that action at this time.
0 commit comments