diff --git a/.jpmignore b/.jpmignore index ad0fd14..8abd659 100644 --- a/.jpmignore +++ b/.jpmignore @@ -8,4 +8,5 @@ *.md test/ addon description/ -doc/ \ No newline at end of file +doc/ +!webextension/icons/* \ No newline at end of file diff --git a/lib/main.js b/lib/main.js index 7a06838..28b0eac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -16,6 +16,12 @@ const preferences = require("sdk/simple-prefs"); const prefService = require("sdk/preferences/service"); const prefs = preferences.prefs; + const webExtension = require("sdk/webextension"); + webExtension.startup().then(function(api){ + const {browser} = api; + // browser.runtime.onMessage.addListener(handleMessage); + } + ); const notificationPref = { doShow: function(){ diff --git a/package.json b/package.json index f17e483..0b25859 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "keywords": "privacy, canvas, fingerprinting", "description": "Changes the JS-API for modifying to prevent Canvas-Fingerprinting.", "homepage": "https://github.com/kkapsner/CanvasBlocker/", + "hasEmbeddedWebExtension": true, "preferences": [ { "name": "whiteList", diff --git a/webextension/background.js b/webextension/background.js new file mode 100644 index 0000000..451e6fc --- /dev/null +++ b/webextension/background.js @@ -0,0 +1,16 @@ +console.log("background"); +browser.tabs.query({}).then(function(tabs){ + console.log("tabs", tabs); + tabs.forEach(function(tab){ + console.log("tab", tab); + browser.pageAction.show(tab.id).then(function(){console.log("success");}, function(){console.log("error");}); + }); +}); + +browser.tabs.onActivated.addListener(function(tab){ + browser.pageAction.show(tab.id); +}); +browser.tabs.onUpdate.addistener(function(tab){ + browser.pageAction.show(tab.id); +}); + \ No newline at end of file diff --git a/webextension/icons/printed19.png b/webextension/icons/printed19.png new file mode 100644 index 0000000..7ec5cf4 Binary files /dev/null and b/webextension/icons/printed19.png differ diff --git a/webextension/icons/printed38.png b/webextension/icons/printed38.png new file mode 100644 index 0000000..15304ed Binary files /dev/null and b/webextension/icons/printed38.png differ diff --git a/webextension/manifest.json b/webextension/manifest.json new file mode 100644 index 0000000..a5383be --- /dev/null +++ b/webextension/manifest.json @@ -0,0 +1,30 @@ +{ + "background": { + "scripts": ["background.js"] + }, + "permissions": [ + "activeTab", + "tabs" + ], + "page_action": { + "browser_style": true, + "default_icon": { + "19": "icons/printed19.png", + "38": "icons/printed38.png" + }, + "default_popup": "pageAction/index.html" + }, + + "applications": { + "gecko": { + "id": "CanvasBlocker-WebExtension@kkapsner.de", + "strict_min_version": "51.0", + "strict_max_version": "60.*" + } + }, + + "description": "Embeded WebExtension for the CanvasBlocker.", + "name": "CanvasBlocker-WebExtension", + "version": "1.0", + "manifest_version": 2 +} \ No newline at end of file diff --git a/webextension/pageAction/index.html b/webextension/pageAction/index.html new file mode 100644 index 0000000..d1b790d --- /dev/null +++ b/webextension/pageAction/index.html @@ -0,0 +1,11 @@ + + + + Fingerprinted + + +

Test

+ How does this display? + + + \ No newline at end of file diff --git a/webextension/pageAction/index.js b/webextension/pageAction/index.js new file mode 100644 index 0000000..1ebe954 --- /dev/null +++ b/webextension/pageAction/index.js @@ -0,0 +1,3 @@ +(function(){ + document.body.appendChild(document.createTextElement("JS generated!")); +}()); \ No newline at end of file