mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 04:26:35 +02:00
parent
4c7b83aca6
commit
fd7c4fabbd
12 changed files with 161 additions and 19 deletions
|
@ -86,7 +86,8 @@
|
|||
visible: _("askForVisiblePermission"),
|
||||
invisible: _("askForInvisiblePermission"),
|
||||
nocanvas: _("askForPermission"),
|
||||
audio: _("askForAudioPermission")
|
||||
audio: _("askForAudioPermission"),
|
||||
history: _("askForHistoryPermission"),
|
||||
},
|
||||
askStatus: {
|
||||
alreadyAsked: {},
|
||||
|
@ -98,7 +99,8 @@
|
|||
visible: _("askForVisibleInputPermission"),
|
||||
invisible: _("askForInvisibleInputPermission"),
|
||||
nocanvas: _("askForInputPermission"),
|
||||
audio: _("askForAudioInputPermission")
|
||||
audio: _("askForAudioInputPermission"),
|
||||
history: _("askForHistoryInputPermission"),
|
||||
},
|
||||
askStatus: {
|
||||
alreadyAsked: {},
|
||||
|
@ -110,7 +112,8 @@
|
|||
visible: _("askForVisibleReadoutPermission"),
|
||||
invisible: _("askForInvisibleReadoutPermission"),
|
||||
nocanvas: _("askForReadoutPermission"),
|
||||
audio: _("askForAudioReadoutPermission")
|
||||
audio: _("askForAudioReadoutPermission"),
|
||||
history: _("askForHistoryReadoutPermission"),
|
||||
},
|
||||
askStatus: {
|
||||
alreadyAsked: {},
|
||||
|
|
|
@ -486,4 +486,5 @@
|
|||
});
|
||||
}
|
||||
appendModified(modifiedAudioAPI);
|
||||
appendModified(require("./modifiedHistoryAPI"));
|
||||
}());
|
56
lib/modifiedHistoryAPI.js
Normal file
56
lib/modifiedHistoryAPI.js
Normal file
|
@ -0,0 +1,56 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
var scope;
|
||||
if ((typeof exports) !== "undefined"){
|
||||
scope = exports;
|
||||
}
|
||||
else {
|
||||
window.scope.modifiedHistoryAPI = {};
|
||||
scope = window.scope.modifiedHistoryAPI;
|
||||
}
|
||||
|
||||
const {hasType, checkerWrapper} = require("./modifiedAPIFunctions");
|
||||
|
||||
scope.changedGetters = [
|
||||
{
|
||||
objectGetters: [function(window){return window.History.prototype;}],
|
||||
name: "length",
|
||||
getterGenerator: function(checker){
|
||||
const temp = {
|
||||
get length(){
|
||||
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||
const {prefs, notify, window, original} = check;
|
||||
const originalLength = original.apply(this, window.Array.from(args));
|
||||
const threshold = prefs("historyLengthThreshold", window.location);
|
||||
if (originalLength > threshold){
|
||||
notify("fakedHistoryReadout");
|
||||
return threshold;
|
||||
}
|
||||
else {
|
||||
return originalLength;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
return Object.getOwnPropertyDescriptor(temp, "length").get;
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
function getStatus(obj, status){
|
||||
status = Object.create(status);
|
||||
status.active = hasType(status, "readout");
|
||||
return status;
|
||||
}
|
||||
|
||||
scope.changedGetters.forEach(function(changedGetter){
|
||||
changedGetter.type = "readout";
|
||||
changedGetter.getStatus = getStatus;
|
||||
changedGetter.api = "history";
|
||||
});
|
||||
}());
|
|
@ -89,7 +89,9 @@
|
|||
{name: "Audio-API", level: 1},
|
||||
"getFloatFrequencyData", "getByteFrequencyData", "getFloatTimeDomainData", "getByteTimeDomainData",
|
||||
"getChannelData", "copyFromChannel",
|
||||
"getFrequencyResponse"
|
||||
"getFrequencyResponse",
|
||||
{name: "History-API", level: 1},
|
||||
"length",
|
||||
],
|
||||
defaultKeyValue: false
|
||||
},
|
||||
|
@ -188,6 +190,7 @@
|
|||
keys: [
|
||||
"canvas",
|
||||
"audio",
|
||||
"history",
|
||||
],
|
||||
defaultKeyValue: false
|
||||
},
|
||||
|
@ -236,6 +239,10 @@
|
|||
return Math.floor(Math.random() * 30).toString(10);
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "historyLengthThreshold",
|
||||
defaultValue: 2
|
||||
},
|
||||
{
|
||||
name: "blockDataURLs",
|
||||
defaultValue: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue