Fix mozwebext class added to content pages (Issue #80).
This commit is contained in:
parent
7b35acdab0
commit
c2be460915
|
@ -1,12 +1,22 @@
|
||||||
var UA = {
|
{
|
||||||
isMozilla: document.URL.startsWith("moz-") || typeof window.wrappedJSObject === "object",
|
let mozWebExtUrl = document.URL.startsWith("moz-");
|
||||||
}
|
let isMozilla = mozWebExtUrl || window.wrappedJSObject === "object";
|
||||||
|
if (isMozilla) {
|
||||||
if (!UA.isMozilla) {
|
if (mozWebExtUrl) {
|
||||||
if (typeof chrome === "object" && !chrome.tabs && typeof exportFunction === "undefined") {
|
// help browser-specific UI styling
|
||||||
// content script shims
|
document.documentElement.classList.add("mozwebext");
|
||||||
window.exportFunction = () => {};
|
}
|
||||||
|
} else {
|
||||||
|
// shims for non-Mozilla browsers
|
||||||
|
if (typeof chrome === "object" && !chrome.tabs) {
|
||||||
|
// content script shims
|
||||||
|
if (typeof exportFunction === "undefined") {
|
||||||
|
window.exportFunction = () => {};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
document.documentElement.classList.add("mozwebext");
|
var UA = {
|
||||||
|
isMozilla
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue