mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-03 12:06:31 +02:00
about:blank pages are treated with respect to the opening page
This commit is contained in:
parent
b563a9d3ca
commit
ec1ae73cda
3 changed files with 31 additions and 4 deletions
|
@ -5,10 +5,21 @@
|
|||
(function(){
|
||||
"use strict";
|
||||
|
||||
function getDomain(window){
|
||||
if (window.location.href === "about:blank"){
|
||||
if (window !== window.parent){
|
||||
return getDomain(window.parent);
|
||||
}
|
||||
else if (window.opener){
|
||||
return getDomain(window.opener);
|
||||
}
|
||||
}
|
||||
return window.location.host;
|
||||
}
|
||||
const persistentRnd = Object.create(null);
|
||||
exports.persistent = {
|
||||
getRng: function(length, window){
|
||||
var domain = window.document.location.host;
|
||||
var domain = getDomain(window);
|
||||
if (!persistentRnd[domain]){
|
||||
// create the (sub-)domains random numbers if not existing
|
||||
persistentRnd[domain] = new Uint8Array(128);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue