Safari compatibility

main
Elbert Alias 5 years ago
parent 0302eba2f4
commit 9d77cd5b48

@ -97,7 +97,6 @@ const Content = {
* @param {Array} technologies
*/
onGetTechnologies(technologies = []) {
console.log({ technologies })
// Inject a script tag into the page to access methods of the window object
const script = document.createElement('script')

@ -72,7 +72,7 @@ const Driver = {
if (previous === null) {
open('https://www.wappalyzer.com/installed')
} else if (version !== previous && upgradeMessage) {
// open(`https://www.wappalyzer.com/upgraded?v${version}`, false)
open(`https://www.wappalyzer.com/upgraded?v${version}`, false)
}
await setOption('version', version)

@ -163,24 +163,15 @@
* @param {String} responseMessage
*/
sendToBackground: function(message, event, responseMessage) {
if (typeof chrome !== 'undefined') {
var port = chrome.runtime.connect({ name: 'adparser' })
port.onMessage.addListener((message) => {
if (message && typeof message.tracking_enabled !== 'undefined') {
if (message.tracking_enabled) {
utilCallback()
} else {
utilElseCallback()
}
}
})
port.postMessage(message)
} else if (window.self.port) {
window.self.port.on(responseMessage, onResponse)
window.self.port.emit(event, message)
}
chrome.runtime.sendMessage(message, (message) => {
if (message && typeof message.tracking_enabled !== 'undefined') {
if (message.tracking_enabled) {
utilCallback()
} else {
utilElseCallback()
}
}
})
},
/**
@ -1446,15 +1437,11 @@
* @param {Function} callback
*/
function addBackgroundListener(event, callback) {
if (typeof chrome !== 'undefined') {
chrome.runtime.onMessage.addListener(function(msg) {
if (msg.event === event) {
callback(msg)
}
})
} else if (window.self.port) {
window.self.port.on(event, callback)
}
chrome.runtime.onMessage.addListener(function(msg) {
if (msg.event === event) {
callback(msg)
}
})
}
exports.coordinator = {
@ -1541,7 +1528,7 @@
;(function(adparser, pageUrl) {
function onAdFound(log) {
adparser.sendToBackground(
{ func: 'onAd', args: [log] },
{ source: 'iframe.js', func: 'onAd', args: [log] },
'onAd',
'',
function() {}

@ -730,20 +730,18 @@
}
);
chrome.runtime.onConnect.addListener((port) => {
port.onMessage.addListener((message) => {
if ( message === 'is_tracking_enabled' ) {
ifTrackingEnabled(
port.sender.tab,
function() {
try {port.postMessage({'tracking_enabled': true});}
catch(err) {} },
function() {
try {port.postMessage({'tracking_enabled': false});}
catch(err) {} }
);
}
return true;
});
});
chrome.runtime.onMessage.addListener((message, sender, callback) => {
if ( message === 'is_tracking_enabled' ) {
ifTrackingEnabled(
sender.tab,
function() {
try {callback({'tracking_enabled': true});}
catch(err) {} },
function() {
try {callback({'tracking_enabled': false});}
catch(err) {} }
);
}
return true;
});
})();

@ -1,6 +1,6 @@
'use strict'
/* eslint-env browser */
/* globals Utils */
/* globals chrome, Utils */
const { i18n, getOption, setOption } = Utils
@ -36,6 +36,12 @@ const Options = {
})
})
if (!chrome.pageAction.show) {
document
.querySelector('[data-i18n="optionDynamicIcon"]')
.parentNode.remove()
}
i18n()
}
}

@ -68,4 +68,4 @@
"https://*/*"
],
"content_security_policy": "script-src 'self'; object-src 'self'"
}
}