mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Reduced direct dependency on browser.xxx APIs
This commit is contained in:
parent
a9edf45aa8
commit
137c1688ba
7 changed files with 53 additions and 14 deletions
|
@ -10,6 +10,7 @@
|
|||
const lists = require("./lists.js");
|
||||
const {check: originalCheck, checkStack: originalCheckStack} = require("./check.js");
|
||||
const getWrapped = require("sdk/getWrapped");
|
||||
const extension = require("./extension");
|
||||
|
||||
const logging = require("./logging");
|
||||
const {error, warning, message, notice, verbose, setPrefix: setLogPrefix} = logging;
|
||||
|
@ -38,7 +39,7 @@
|
|||
}
|
||||
function askWrapper(data){
|
||||
return ask(data, {
|
||||
_: browser.i18n.getMessage,
|
||||
_: extension.getTranslation,
|
||||
prefs
|
||||
});
|
||||
}
|
||||
|
@ -56,7 +57,7 @@
|
|||
notice("my tab id is", data.tabId);
|
||||
tabId = data.tabId;
|
||||
}
|
||||
const persistentRndName = "persistent" + (browser.extension.inIncognitoContext? "Incognito": "") + "Rnd";
|
||||
const persistentRndName = "persistent" + (extension.inIncognitoContext? "Incognito": "") + "Rnd";
|
||||
if (data.hasOwnProperty(persistentRndName)){
|
||||
const persistentRndValue = data[persistentRndName];
|
||||
notice("got persistent random data", persistentRndValue);
|
||||
|
@ -151,7 +152,7 @@
|
|||
}
|
||||
|
||||
message("register listener for messages from background script");
|
||||
browser.runtime.onMessage.addListener(function(data){
|
||||
extension.message.on(function(data){
|
||||
if (data["canvasBlocker-unload"]){
|
||||
enabled = false;
|
||||
}
|
||||
|
@ -160,7 +161,7 @@
|
|||
data["canvasBlocker-sendNotifications"] === tabId
|
||||
){
|
||||
notice("sending notifications:", notifications);
|
||||
browser.runtime.sendMessage({
|
||||
extension.message.send({
|
||||
sender: tabId,
|
||||
url: window.location.href,
|
||||
"canvasBlocker-notificationCounter": notificationCounter,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue