diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 5aecce6..7ec6313 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -394,6 +394,15 @@ "description": "" }, + "apiWhiteList_title": { + "message": "API Whitelist", + "description": "" + }, + "apiWhiteList_description": { + "message": "Erlaubt ausgewählte Teile der Canvas-API.", + "description": "" + }, + "disableNotifications": { "message": "Benachrichtigungen deaktivieren", "description": "" diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 15a10c6..4802db0 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -393,6 +393,15 @@ "message": "Enables the canvas cache. This can prevent detection and increases the performance when small canvas are read several times but decreases it for big canvas.", "description": "" }, + + "apiWhiteList_title": { + "message": "API whitelist", + "description": "" + }, + "apiWhiteList_description": { + "message": "Allows certain parts of the canvas API.", + "description": "" + }, "disableNotifications": { "message": "disable notifications", diff --git a/lib/intercept.js b/lib/intercept.js index 4cd9084..4ccc60b 100644 --- a/lib/intercept.js +++ b/lib/intercept.js @@ -227,7 +227,7 @@ }); } - if (funcStatus.active){ + if (funcStatus.active && !prefs("apiWhiteList")[name]){ if (funcStatus.mode === "ask"){ funcStatus.mode = ask({ window: window, diff --git a/lib/settingDefinitions.js b/lib/settingDefinitions.js index 33a08d2..08a8b78 100644 --- a/lib/settingDefinitions.js +++ b/lib/settingDefinitions.js @@ -59,6 +59,18 @@ defaultValue: "nonPersistent", options: ["white", "nonPersistent", "constant", "persistent"] }, + { + name: "apiWhiteList", + defaultValue: {}, + keys: [ + "getContext", + "toDataURL", "toBlob", "mozGetAsFile", "getImageData", + "isPointInPath", "isPointInStroke", + "fillText", "strokeText", + "readPixels" + ], + defaultKeyValue: false + }, { name: "useCanvasCache", defaultValue: true diff --git a/options/optionsGui.js b/options/optionsGui.js index 950ce1b..ef5355b 100644 --- a/options/optionsGui.js +++ b/options/optionsGui.js @@ -127,6 +127,47 @@ }); } + else if (setting.keys){ + input = document.createElement("table"); + setting.keys.forEach(function(key){ + let row = document.createElement("tr"); + + let nameCell = document.createElement("td"); + nameCell.textContent = key; + row.appendChild(nameCell); + + let keyType = inputTypes[typeof setting.defaultKeyValue]; + let keyInput = document.createElement("input"); + keyType.input(keyInput, setting.defaultKeyValue); + + let inputCell = document.createElement("td"); + inputCell.appendChild(keyInput); + row.appendChild(inputCell); + + setting.on(function(){ + var container = setting.get(url); + keyType.updateCallback( + keyInput, + container && container.hasOwnProperty(key)? + container[key]: + setting.defaultKeyValue, + url + ); + }); + keyInput.addEventListener("change", function(){ + var value = keyType.getValue(keyInput); + var container = setting.get(url); + if (!container){ + container = setting.defaultValue; + } + container[key] = value; + setting.set(container, url); + logging.message("changed setting", setting.name, "(", key, "):", value); + }); + input.appendChild(row); + }); + } + if (setting.urlSpecific && url === ""){ let container = document.createElement("div"); container.className = "urlValues collapsed"; diff --git a/options/settingsDisplay.js b/options/settingsDisplay.js index 83ff2b2..6f0feba 100644 --- a/options/settingsDisplay.js +++ b/options/settingsDisplay.js @@ -182,6 +182,20 @@ } ] }, + { + "name": "apiWhiteList", + "displayDependencies": [ + { + "blockMode": ["fakeReadout", "fakeInput"], + "displayAdvancedSettings": [true] + }, + { + "blockMode": ["askReadout", "ask"], + "askDenyMode": ["fake"], + "displayAdvancedSettings": [true] + } + ] + }, "notifications", { "name": "showNotifications", diff --git a/releaseNotes.txt b/releaseNotes.txt index 29122c5..1053c17 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -3,7 +3,7 @@ Version 0.4.6: - new features: - - + - Added setting to whitelist parts of the canvas API fixes: -