LP#1640255 Avoid Firefox startup error
authorBill Erickson <berickxx@gmail.com>
Mon, 14 Nov 2016 22:10:35 +0000 (17:10 -0500)
committerBill Erickson <berickxx@gmail.com>
Wed, 23 Nov 2016 23:06:01 +0000 (18:06 -0500)
Connect to Hatch asynchronously (via $timeout) to avoid Angular digest
in-progress errors in Firefox.

Notes added about FF's current lack of support for
externally_connectable extensions.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/services/hatch.js

index 7115ecc..c936ef5 100644 (file)
@@ -76,7 +76,16 @@ angular.module('egCoreMod')
         } else {  // Hatch status unknown; attempt to connect
             service.messages[msg.msgid] = msg;
             service.pending.push(msg);
-            service.hatchConnect();
+            // Connect to Hatch asynchronously. Othwerise, results
+            // in a $rootScope:inprog error in Firefox, possibly
+            // because hatchConnect() does not yet work in FF.
+            //
+            // Firefox does not yet support runtime.connect(..)
+            // from the browser to "externally_connectable" extensions.
+            // http://stackoverflow.com/questions/38487552/externally-connectable-and-firefox-webextensions
+            // http://stackoverflow.com/questions/10526995/can-a-site-invoke-a-browser-extension/10527809#10527809
+            // https://bugzilla.mozilla.org/show_bug.cgi?id=1204583
+            $timeout(service.hatchConnect);
         }
 
         return msg.deferred.promise;