diff --git a/_locales/de/messages.json b/_locales/de/messages.json index a976ef8..d7956cf 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -78,6 +78,22 @@ "message": "Nur einmal nachfragen", "description": "" }, + "askDenyMode_title":{ + "message": "Nachfrageverweigerungsmodus", + "description": "" + }, + "askDenyMode_description":{ + "message": "Welcher Modus soll gewählt werden, wenn die Erlaubnis verweigert wird.", + "description": "" + }, + "askDenyMode_options.block":{ + "message": "blockieren", + "description": "" + }, + "askDenyMode_options.fake":{ + "message": "vortäuschen", + "description": "" + }, "blackList_description": { "message": "Domänen oder URLs, die die -API niemals verwenden dürfen. Mehrere Einträge müssen durch ein Komma getrennt werden.", "description": "" diff --git a/_locales/en/messages.json b/_locales/en/messages.json index fb8e2a1..bd507e5 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -78,6 +78,22 @@ "message": "Ask only once", "description": "" }, + "askDenyMode_title":{ + "message": "Ask deny mode", + "description": "" + }, + "askDenyMode_description":{ + "message": "Which mode should be used when the permission is denied.", + "description": "" + }, + "askDenyMode_options.block":{ + "message": "block", + "description": "" + }, + "askDenyMode_options.fake":{ + "message": "fake", + "description": "" + }, "blackList_description": { "message": "Domains or URLs where the -API should always be blocked. To add multiple entries, separate them by commas.", "description": "" diff --git a/lib/askForPermission.js b/lib/askForPermission.js index a55f728..3a913c7 100644 --- a/lib/askForPermission.js +++ b/lib/askForPermission.js @@ -136,7 +136,7 @@ if (prefs("showCallingFile")){ msg += parseErrorStack(errorStack).toString(_); } - answer = window.confirm(msg)? "allow": "block"; + answer = window.confirm(msg)? "allow": prefs("askDenyMode"); askStatus.alreadyAsked[appearance.text] = true; askStatus.answer[appearance.text] = answer; appearance.reset(); diff --git a/lib/intercept.js b/lib/intercept.js index 604a360..ab9e148 100644 --- a/lib/intercept.js +++ b/lib/intercept.js @@ -62,7 +62,9 @@ if (siteStatus.mode !== "allow"){ apiNames.forEach(function(name){ var changedFunction = changedFunctions[name]; - if (changedFunction.getStatus(undefined, siteStatus).active){ + var functionStatus = changedFunction.getStatus(undefined, siteStatus); + logging.verbose("status for", name, ":", functionStatus); + if (functionStatus.active){ ( Array.isArray(changedFunction.object)? changedFunction.object: diff --git a/lib/modifiedAPI.js b/lib/modifiedAPI.js index fe01615..6a6154d 100644 --- a/lib/modifiedAPI.js +++ b/lib/modifiedAPI.js @@ -166,7 +166,7 @@ } else if (hasType(status, "context") || hasType(status, "input")){ return { - mode: (status.mode === "block")? "block": "fake", + mode: status.mode, type: status.type, active: true }; @@ -189,13 +189,11 @@ type: "readout", getStatus: function(obj, status){ status = Object.create(status); - if (hasType(status, "input")){ + status.active = hasType(status, "readout"); + if (!status.active && hasType(status, "input")){ var contextType = canvasContextType.get(obj); status.active = contextType !== "2d"; } - else { - status.active = hasType(status, "readout"); - } return status; }, object: "HTMLCanvasElement", @@ -215,13 +213,11 @@ type: "readout", getStatus: function(obj, status){ status = Object.create(status); - if (hasType(status, "input")){ + status.active = hasType(status, "readout"); + if (!status.active && hasType(status, "input")){ var contextType = canvasContextType.get(obj); status.active = contextType !== "2d"; } - else { - status.active = hasType(status, "readout"); - } return status; }, object: "HTMLCanvasElement", @@ -242,13 +238,11 @@ type: "readout", getStatus: function(obj, status){ status = Object.create(status); - if (hasType(status, "input")){ + status.active = hasType(status, "readout"); + if (!status.active && hasType(status, "input")){ var contextType = canvasContextType.get(obj); status.active = contextType !== "2d"; } - else { - status.active = hasType(status, "readout"); - } return status; }, object: "HTMLCanvasElement", diff --git a/lib/settingDefinitions.js b/lib/settingDefinitions.js index 87fae41..ff4cc1c 100644 --- a/lib/settingDefinitions.js +++ b/lib/settingDefinitions.js @@ -76,6 +76,11 @@ name: "askOnlyOnce", defaultValue: true }, + { + name: "askDenyMode", + defaultValue: "block", + options: ["block", "fake"] + }, { name: "showNotifications", defaultValue: true diff --git a/options/settingsDisplay.js b/options/settingsDisplay.js index ca83bde..6f92f36 100644 --- a/options/settingsDisplay.js +++ b/options/settingsDisplay.js @@ -22,73 +22,6 @@ "blockMode": ["blockReadout", "fakeReadout", "fakeInput", "askReadout", "ask", "allow"] } }, - { - "name": "minFakeSize", - "displayDependencies": { - "blockMode": ["fakeReadout", "fakeInput"], - "displayAdvancedSettings": [true] - } - }, - { - "name": "maxFakeSize", - "displayDependencies": { - "blockMode": ["fakeReadout", "fakeInput"], - "displayAdvancedSettings": [true] - } - }, - { - "name": "rng", - "displayDependencies": { - "blockMode": ["fakeReadout", "fakeInput"], - "displayAdvancedSettings": [true] - } - }, - { - "name": "storePersistentRnd", - "displayDependencies": { - "blockMode": ["fakeReadout", "fakeInput"], - "rng": ["persistent"], - "displayAdvancedSettings": [true] - } - }, - { - "name": "persistentRndClearInterval", - "inputs": ["persistentRndClearIntervalValue", "persistentRndClearIntervalUnit"], - "displayDependencies": { - "blockMode": ["fakeReadout", "fakeInput"], - "rng": ["persistent"], - "displayAdvancedSettings": [true] - } - }, - { - "name": "clearPersistentRnd", - "displayDependencies": { - "blockMode": ["fakeReadout", "fakeInput"], - "rng": ["persistent"], - "displayAdvancedSettings": [true] - } - }, - { - "name": "ignoreFrequentColors", - "displayDependencies": { - "blockMode": ["fakeReadout"], - "displayAdvancedSettings": [true] - } - }, - { - "name": "fakeAlphaChannel", - "displayDependencies": { - "blockMode": ["fakeReadout"], - "displayAdvancedSettings": [true] - } - }, - { - "name": "useCanvasCache", - "displayDependencies": { - "blockMode": ["fakeReadout"], - "displayAdvancedSettings": [true] - } - }, { "name": "askOnlyOnce", "displayDependencies": { @@ -96,25 +29,186 @@ } }, { - "name": "showNotifications", + "name": "askDenyMode", "displayDependencies": { - "blockMode": ["fakeReadout", "fakeInput"] - } - }, - { - "name": "storeImageForInspection", - "displayDependencies": { - "blockMode": ["fakeReadout", "fakeInput"], - "showNotifications": [true], + "blockMode": ["askReadout", "ask"], "displayAdvancedSettings": [true] } }, + { + "name": "minFakeSize", + "displayDependencies": [ + { + "blockMode": ["fakeReadout", "fakeInput"], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "displayAdvancedSettings": [true] + } + ] + }, + { + "name": "maxFakeSize", + "displayDependencies": [ + { + "blockMode": ["fakeReadout", "fakeInput"], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "displayAdvancedSettings": [true] + } + ] + }, + { + "name": "rng", + "displayDependencies": [ + { + "blockMode": ["fakeReadout", "fakeInput"], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "displayAdvancedSettings": [true] + } + ] + }, + { + "name": "storePersistentRnd", + "displayDependencies": [ + { + "blockMode": ["fakeReadout", "fakeInput"], + "rng": ["persistent"], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "rng": ["persistent"], + "displayAdvancedSettings": [true] + } + ] + }, + { + "name": "persistentRndClearInterval", + "inputs": ["persistentRndClearIntervalValue", "persistentRndClearIntervalUnit"], + "displayDependencies": [ + { + "blockMode": ["fakeReadout", "fakeInput"], + "rng": ["persistent"], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "rng": ["persistent"], + "displayAdvancedSettings": [true] + } + ] + }, + { + "name": "clearPersistentRnd", + "displayDependencies": [ + { + "blockMode": ["fakeReadout", "fakeInput"], + "rng": ["persistent"], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "rng": ["persistent"], + "displayAdvancedSettings": [true] + } + ] + }, + { + "name": "ignoreFrequentColors", + "displayDependencies": [ + { + "blockMode": ["fakeReadout"], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "displayAdvancedSettings": [true] + } + ] + }, + { + "name": "fakeAlphaChannel", + "displayDependencies": [ + { + "blockMode": ["fakeReadout"], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "displayAdvancedSettings": [true] + } + ] + }, + { + "name": "useCanvasCache", + "displayDependencies": [ + { + "blockMode": ["fakeReadout"], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "displayAdvancedSettings": [true] + } + ] + }, + { + "name": "showNotifications", + "displayDependencies": [ + { + "blockMode": ["fakeReadout", "fakeInput"] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"] + } + ] + }, + { + "name": "storeImageForInspection", + "displayDependencies": [ + { + "blockMode": ["fakeReadout", "fakeInput"], + "showNotifications": [true], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "showNotifications": [true], + "displayAdvancedSettings": [true] + } + ] + }, { "name": "ignoreList", - "displayDependencies": { - "blockMode": ["fakeReadout", "fakeInput"], - "showNotifications": [true] - } + "displayDependencies": [ + { + "blockMode": ["fakeReadout", "fakeInput"], + "showNotifications": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "showNotifications": [true] + } + ] }, { "name": "showCallingFile", diff --git a/releaseNotes.txt b/releaseNotes.txt index f954318..e3cbe48 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -6,9 +6,11 @@ Version 0.4.1: new features: - setting to set an interval to clear the persistent random generator data + - setting for the ask deny mode fixes: - unnecessary check for context type in getImageData broke websites + - getContext was not asked in ask mode. Version 0.4.0.2: fixes: