From d5a8ecfb05739bcbcf61a12337916df44da98a63 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 9 Nov 2017 11:39:12 -0500 Subject: [PATCH] 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 --- Open-ILS/web/js/ui/default/staff/services/auth.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.11.0