mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
parent
87fa607d28
commit
308d7c4005
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -52,6 +52,7 @@
|
||||
"recaptcha",
|
||||
"ruleset",
|
||||
"spodermenpls",
|
||||
"statechange",
|
||||
"unticking",
|
||||
"webgl",
|
||||
"whitelisted",
|
||||
|
@ -36,14 +36,12 @@ if (!userAgentIsConsistent){
|
||||
}
|
||||
const lines = {};
|
||||
|
||||
iframeAPI.forEachMethod(function(windowToUse, name){
|
||||
function processNavigatorObject(navigator, keys, name){
|
||||
"use strict";
|
||||
|
||||
const navigator = windowToUse.navigator;
|
||||
Object.keys(navigator.__proto__).sort().forEach(function(property){
|
||||
|
||||
keys.sort().forEach(function(property){
|
||||
const value = navigator[property];
|
||||
if ((typeof value) === "string"){
|
||||
const isFirst = !lines[property];
|
||||
if (!lines[property]){
|
||||
lines[property] = {
|
||||
values: [],
|
||||
@ -60,4 +58,52 @@ iframeAPI.forEachMethod(function(windowToUse, name){
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
iframeAPI.forEachMethod(function(windowToUse, name){
|
||||
"use strict";
|
||||
|
||||
const navigator = windowToUse.navigator;
|
||||
processNavigatorObject(navigator, Object.keys(navigator.__proto__), name);
|
||||
});
|
||||
|
||||
const worker = new Worker("navigatorTestWorker.js");
|
||||
worker.addEventListener("message", function(event){
|
||||
"use strict";
|
||||
|
||||
processNavigatorObject(event.data, Object.keys(event.data), "Worker");
|
||||
worker.terminate();
|
||||
});
|
||||
|
||||
const sharedWorker = new SharedWorker("navigatorTestWorker.js");
|
||||
sharedWorker.port.addEventListener("message", function(event){
|
||||
"use strict";
|
||||
|
||||
processNavigatorObject(event.data, Object.keys(event.data), "SharedWorker");
|
||||
sharedWorker.port.close();
|
||||
});
|
||||
sharedWorker.port.start();
|
||||
|
||||
navigator.serviceWorker.register("navigatorTestWorker.js").then(function(registration){
|
||||
"use strict";
|
||||
|
||||
const worker = (registration.active || registration.waiting || registration.installing);
|
||||
navigator.serviceWorker.addEventListener("message", function(event){
|
||||
processNavigatorObject(event.data, Object.keys(event.data), "ServiceWorker");
|
||||
registration.unregister();
|
||||
});
|
||||
if (worker.state !== "activated"){
|
||||
worker.addEventListener("statechange", function(){
|
||||
if (worker.state === "activated"){
|
||||
worker.postMessage("send");
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
worker.postMessage("send");
|
||||
}
|
||||
return registration;
|
||||
}).catch(function(error){
|
||||
"use strict";
|
||||
console.error("Unable to register service worker:", error);
|
||||
});
|
||||
|
24
test/navigatorTestWorker.js
Normal file
24
test/navigatorTestWorker.js
Normal file
@ -0,0 +1,24 @@
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
const values = {};
|
||||
const navigator = self.navigator;
|
||||
Object.keys(navigator.__proto__).sort().forEach(function(property){
|
||||
const value = navigator[property];
|
||||
if ((typeof value) === "string"){
|
||||
values[property] = value;
|
||||
}
|
||||
});
|
||||
if (self.postMessage){
|
||||
self.postMessage(values);
|
||||
}
|
||||
self.addEventListener("connect", function(event){
|
||||
event.ports.forEach(function(port){
|
||||
port.postMessage(values);
|
||||
});
|
||||
});
|
||||
self.addEventListener("message", function(event){
|
||||
event.source.postMessage(values);
|
||||
return values;
|
||||
});
|
||||
}());
|
Loading…
x
Reference in New Issue
Block a user