Fixes communication issue with US.o on Firefox browser
This commit is contained in:
parent
449f86e5ef
commit
6119a406da
|
@ -1,7 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
document.addEventListener('stylishUpdateChrome', onUpdateClicked);
|
const FIREFOX = /Firefox/.test(navigator.userAgent);
|
||||||
document.addEventListener('stylishInstallChrome', onInstallClicked);
|
|
||||||
|
document.addEventListener("stylishUpdate" + (FIREFOX ? "" : "Chrome"), onUpdateClicked);
|
||||||
|
document.addEventListener("stylishInstall" + (FIREFOX ? "" : "Chrome"), onInstallClicked);
|
||||||
|
|
||||||
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
||||||
// orphaned content script check
|
// orphaned content script check
|
||||||
|
@ -52,6 +54,9 @@ function checkUpdatability([installedStyle]) {
|
||||||
|
|
||||||
|
|
||||||
function sendEvent(type, detail = null) {
|
function sendEvent(type, detail = null) {
|
||||||
|
if (FIREFOX) {
|
||||||
|
type = type.replace('Chrome', '');
|
||||||
|
}
|
||||||
detail = {detail};
|
detail = {detail};
|
||||||
if (typeof cloneInto != 'undefined') {
|
if (typeof cloneInto != 'undefined') {
|
||||||
// Firefox requires explicit cloning, however USO can't process our messages anyway
|
// Firefox requires explicit cloning, however USO can't process our messages anyway
|
||||||
|
|
Loading…
Reference in New Issue
Block a user