summaryrefslogtreecommitdiff
path: root/common/browser.js
blob: d1aab821af2269d41a03b505c615b1eaf12bf8b9 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Myext WebExtension API access normalization
*
* Copyright (C) 2021 Wojtek Kosior
*
* Dual-licensed under:
*   - 0BSD license
*   - GPLv3 or (at your option) any later version
*/

"use strict";

/*
 * This module normalizes access to WebExtension apis between
 * chrome-based and firefox-based browsers.
 */

(() => {
    if (typeof browser === "object") {
	window.browser = browser;
	window.is_chrome = false;
	window.is_mozilla = true;
    } else {
	window.browser = window.chrome;
	window.is_chrome = true;
	window.is_mozilla = false;
    }
})();