From: Bill Erickson Date: Thu, 9 Nov 2017 16:39:12 +0000 (-0500) Subject: LP#1731496 Avoid PhantomJS BroadcastChannel failure X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d5a8ecfb05739bcbcf61a12337916df44da98a63;p=evergreen%2Fjoelewis.git LP#1731496 Avoid PhantomJS BroadcastChannel failure Avoid attempts to create BroadcastChannel objects in contexts where the object does not exist. Specifically, allow PhantomJS to run unit tesst without dying on: ReferenceError: Can't find variable: BroadcastChannel Signed-off-by: Bill Erickson Signed-off-by: Chris Sharp --- diff --git a/Open-ILS/web/js/ui/default/staff/services/auth.js b/Open-ILS/web/js/ui/default/staff/services/auth.js index 8912c78a4b..ec8300579c 100644 --- a/Open-ILS/web/js/ui/default/staff/services/auth.js +++ b/Open-ILS/web/js/ui/default/staff/services/auth.js @@ -53,7 +53,10 @@ function($q , $timeout , $rootScope , $window , $location , egNet , egHatch) { }, // Listen for logout events in other tabs - authChannel : new BroadcastChannel('eg.auth') + // Current version of phantomjs (unit tests, etc.) does not + // support BroadcastChannel, so just dummy it up. + authChannel : (typeof BroadcastChannel == 'undefined') ? + {} : new BroadcastChannel('eg.auth') }; /* Returns a promise, which is resolved if valid