1
0
Fork 0
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:
kkapsner 2017-01-31 20:00:02 +01:00
parent b563a9d3ca
commit ec1ae73cda
3 changed files with 31 additions and 4 deletions

View file

@ -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);