mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Added iframeAPI script for tests
This commit is contained in:
parent
3dc39e11a5
commit
372ee755f7
3 changed files with 137 additions and 39 deletions
|
@ -1,4 +1,4 @@
|
|||
|
||||
/* globals iframeAPI*/
|
||||
const createLog = function(){
|
||||
"use strict";
|
||||
|
||||
|
@ -18,9 +18,9 @@ const createLog = function(){
|
|||
str = str.replace("{old content}", logLine.textContent);
|
||||
logLine.textContent = str;
|
||||
},
|
||||
mark: function mark(index){
|
||||
mark: function mark(marktext){
|
||||
logLine.classList.add("marked");
|
||||
logLine.title += "failed test " + index + "\n";
|
||||
logLine.title += marktext + "\n";
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -35,41 +35,9 @@ if (!userAgentIsConsistent){
|
|||
consistencyLine.mark();
|
||||
}
|
||||
const lines = {};
|
||||
const iframeValues = [
|
||||
function(){
|
||||
"use strict";
|
||||
|
||||
return {windowToUse: window, cleanup: function(){}};
|
||||
},
|
||||
function(){
|
||||
"use strict";
|
||||
|
||||
const iframe = document.createElement("iframe");
|
||||
document.body.appendChild(iframe);
|
||||
const windowToUse = frames[frames.length - 1];
|
||||
return {windowToUse, cleanup: function(){document.body.removeChild(iframe);}};
|
||||
},
|
||||
function(){
|
||||
"use strict";
|
||||
|
||||
const iframe = document.createElement("iframe");
|
||||
document.body.appendChild(iframe);
|
||||
const windowToUse = window[window.length - 1];
|
||||
return {windowToUse, cleanup: function(){document.body.removeChild(iframe);}};
|
||||
},
|
||||
function(){
|
||||
"use strict";
|
||||
|
||||
const index = window.length;
|
||||
const iframe = document.createElement("iframe");
|
||||
document.body.appendChild(iframe);
|
||||
const windowToUse = window[index];
|
||||
return {windowToUse, cleanup: function(){document.body.removeChild(iframe);}};
|
||||
}
|
||||
].forEach(function(getWindow, index){
|
||||
|
||||
iframeAPI.forEachMethod(function(windowToUse, name){
|
||||
"use strict";
|
||||
|
||||
const {windowToUse, cleanup} = getWindow();
|
||||
|
||||
const navigator = windowToUse.navigator;
|
||||
Object.keys(navigator.__proto__).sort().forEach(function(property){
|
||||
|
@ -88,9 +56,8 @@ const iframeValues = [
|
|||
propertyLine.values.push(value);
|
||||
}
|
||||
if (propertyLine.values[0] !== value){
|
||||
propertyLine.log.mark(index);
|
||||
propertyLine.log.mark("failed test " + name);
|
||||
}
|
||||
}
|
||||
});
|
||||
cleanup();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue