File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 * @module MobileOptions
1313 */
1414
15+ /**
16+ * Return the browser's browser info or fallback to an empty object.
17+ *
18+ * This is a workaround for Chrome/ium browsers that do not support runtime.getBrowserInfo().
19+ * See https://github.com/TinyWebEx/AutomaticSettings/issues/18
20+ *
21+ * @private
22+ * @returns {Promise<bool> }
23+ */
24+ async function getBrowserInfo ( ) {
25+ if ( ! browser . runtime . getBrowserInfo ) {
26+ return { } ;
27+ }
28+
29+ return await browser . runtime . getBrowserInfo ( ) ;
30+ }
31+
1532/**
1633 * Returns whether the current runtime is a mobile one (true) or not (false).
1734 *
3350* @returns {Promise<bool> }
3451*/
3552export async function isMozilla ( ) {
36- const browserInfo = await browser . runtime . getBrowserInfo ( ) ;
53+ const browserInfo = await getBrowserInfo ( ) ;
3754
3855 // Thunderbird is explicitly checked as a workaround as Thunderbird does not return the vendor correctly
3956 // see https://bugzilla.mozilla.org/show_bug.cgi?id=1702722
@@ -50,7 +67,7 @@ export async function isMozilla() {
5067* @returns {Promise<bool> }
5168*/
5269export async function isFirefox ( ) {
53- const browserInfo = await browser . runtime . getBrowserInfo ( ) ;
70+ const browserInfo = await getBrowserInfo ( ) ;
5471
5572 return browserInfo . name === "Firefox" ;
5673}
You can’t perform that action at this time.
0 commit comments