diff --git a/lib/intercept.js b/lib/intercept.js index abf6c51..e966066 100644 --- a/lib/intercept.js +++ b/lib/intercept.js @@ -251,8 +251,8 @@ if ( funcStatus.active && ( - !protectedAPIFeatures.hasOwnProperty(name) || - protectedAPIFeatures[name] + !protectedAPIFeatures.hasOwnProperty(name + " @ " + changedFunction.api) || + protectedAPIFeatures[name + " @ " + changedFunction.api] ) ){ if (funcStatus.mode === "ask"){ @@ -383,8 +383,8 @@ if ( functionStatus.active && ( - !protectedAPIFeatures.hasOwnProperty(name) || - protectedAPIFeatures[name] + !protectedAPIFeatures.hasOwnProperty(name + " @ " + changedGetter.api) || + protectedAPIFeatures[name + " @ " + changedGetter.api] ) ){ switch (functionStatus.mode){ diff --git a/lib/settingDefinitions.js b/lib/settingDefinitions.js index 519a0ae..cea546c 100644 --- a/lib/settingDefinitions.js +++ b/lib/settingDefinitions.js @@ -91,44 +91,45 @@ defaultValue: {}, keys: [ {name: "Canvas-API", level: 1}, - "getContext", + "getContext @ canvas", {message: "readout", level: 2}, - "toDataURL", "toBlob", "mozGetAsFile", "getImageData", - "isPointInPath", "isPointInStroke", + "toDataURL @ canvas", "toBlob @ canvas", "mozGetAsFile @ canvas", "getImageData @ canvas", + "isPointInPath @ canvas", "isPointInStroke @ canvas", {message: "input", level: 2}, - "fillText", "strokeText", + "fillText @ canvas", "strokeText @ canvas", {name: "webGL", level: 2}, - "readPixels", "getParameter", + "readPixels @ canvas", "getParameter @ canvas", {name: "Audio-API", level: 1}, - "getFloatFrequencyData", "getByteFrequencyData", "getFloatTimeDomainData", "getByteTimeDomainData", - "getChannelData", "copyFromChannel", - "getFrequencyResponse", + "getFloatFrequencyData @ audio", "getByteFrequencyData @ audio", + "getFloatTimeDomainData @ audio", "getByteTimeDomainData @ audio", + "getChannelData @ audio", "copyFromChannel @ audio", + "getFrequencyResponse @ audio", {name: "History-API", level: 1}, - "length", + "length @ history", {name: "Window-API", level: 1}, - "opener", - "name", + "opener @ window", + "name @ window", {name: "DOMRect-API", level: 1}, - "getClientRects", - "getBoundingClientRect", - "getBounds", - "getBBox", - "getExtentOfChar", - "intersectionRect", - "boundingClientRect", + "getClientRects @ domRect", + "getBoundingClientRect @ domRect", + "getBounds @ domRect", + "getBBox @ domRect", + "getExtentOfChar @ domRect", + "intersectionRect @ domRect", + "boundingClientRect @ domRect", "rootBounds", {name: "Navigator-API", level: 1}, - "appCodeName", - "appName", - "appVersion", - "buildID", - "oscpu", - "platform", - "product", - "productSub", - "userAgent", - "vendor", - "vendorSub" + "appCodeName @ navigator", + "appName @ navigator", + "appVersion @ navigator", + "buildID @ navigator", + "oscpu @ navigator", + "platform @ navigator", + "product @ navigator", + "productSub @ navigator", + "userAgent @ navigator", + "vendor @ navigator", + "vendorSub @ navigator", ], defaultKeyValue: true }, @@ -356,7 +357,7 @@ }, { name: "storageVersion", - defaultValue: 0.5, + defaultValue: 0.6, fixed: true } ]; diff --git a/lib/settingsMigration.js b/lib/settingsMigration.js index e2167d7..f44f54b 100644 --- a/lib/settingsMigration.js +++ b/lib/settingsMigration.js @@ -12,6 +12,9 @@ else { scope = require.register("./settingsMigration", {}); } + + const settingDefinitions = require("./settingDefinitions"); + scope.validVersions = [undefined, 0.1, 0.2, 0.3, 0.4, 0.5]; scope.transitions = { "": function(oldStorage){ @@ -129,7 +132,31 @@ } } return newStorage; - } + }, + 0.5: function(oldStorage){ + var newStorage = { + storageVersion: 0.6 + }; + + if (oldStorage.hasOwnProperty("protectedAPIFeatures")){ + const protectedAPIFeatures = {}; + const protectedAPIFeaturesKeys = settingDefinitions.filter(function(definition){ + return definition.name === "protectedAPIFeatures"; + })[0].keys.filter(function(key){ + return typeof key === "string"; + }); + Object.keys(oldStorage.protectedAPIFeatures).forEach(function(key){ + const matchingKeys = protectedAPIFeaturesKeys.filter(function(definedKey){ + return definedKey.startsWith(key); + }); + if (matchingKeys.length){ + protectedAPIFeatures[matchingKeys[0]] = oldStorage.protectedAPIFeatures[key]; + } + }); + newStorage.protectedAPIFeatures = protectedAPIFeatures; + } + return newStorage; + }, }; scope.check = function(storage, {settings, logging, changeValue, urlContainer}){ diff --git a/options/optionsGui.js b/options/optionsGui.js index 105b658..8358943 100644 --- a/options/optionsGui.js +++ b/options/optionsGui.js @@ -174,7 +174,9 @@ } let nameCell = document.createElement("td"); - nameCell.textContent = key; + nameCell.textContent = setting.display.replaceKeyPattern? + key.replace(setting.display.replaceKeyPattern, ""): + key; row.appendChild(nameCell); let keyType = inputTypes[typeof setting.defaultKeyValue]; diff --git a/options/settingsDisplay.js b/options/settingsDisplay.js index d388332..ac68735 100644 --- a/options/settingsDisplay.js +++ b/options/settingsDisplay.js @@ -298,6 +298,7 @@ }, { "name": "protectedAPIFeatures", + "replaceKeyPattern": / @ .+$/, "displayedSection": "Canvas-API", "displayDependencies": [ { @@ -445,6 +446,7 @@ }, { "name": "protectedAPIFeatures", + "replaceKeyPattern": / @ .+$/, "displayedSection": "Audio-API", "displayDependencies": [ { @@ -542,6 +544,7 @@ settings: [ { "name": "protectedAPIFeatures", + "replaceKeyPattern": / @ .+$/, "displayedSection": "History-API", "displayDependencies": [ { @@ -565,6 +568,7 @@ }, { "name": "protectedAPIFeatures", + "replaceKeyPattern": / @ .+$/, "displayedSection": "Window-API", "displayDependencies": [ { @@ -583,6 +587,7 @@ }, { "name": "protectedAPIFeatures", + "replaceKeyPattern": / @ .+$/, "displayedSection": "DOMRect-API", "displayDependencies": [ { @@ -608,6 +613,7 @@ }, { "name": "protectedAPIFeatures", + "replaceKeyPattern": / @ .+$/, "displayedSection": "Navigator-API", "displayDependencies": [ { diff --git a/releaseNotes.txt b/releaseNotes.txt index fe0f657..13414ff 100644 --- a/releaseNotes.txt +++ b/releaseNotes.txt @@ -1,6 +1,6 @@ Version 0.5.15: changes: - - + - improved storage of protected API features new features: -