Skip to content

Commit 0f33f23

Browse files
committed
Expand log output of window.open-defuser
1 parent 425c12a commit 0f33f23

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/web_accessible_resources/window.open-defuser.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
if ( arg2 === '{{2}}' ) { arg2 = ''; }
2828
let arg3 = '{{3}}';
2929
if ( arg3 === '{{3}}' ) { arg3 = ''; }
30+
const log = arg3 !== ''
31+
? console.log.bind(console)
32+
: ( ) => { };
3033
const newSyntax = /^[01]?$/.test(arg1) === false;
3134
let pattern = '';
3235
let targetResult = true;
@@ -57,6 +60,7 @@
5760
const rePattern = new RegExp(pattern);
5861
window.open = new Proxy(window.open, {
5962
apply: function(target, thisArg, args) {
63+
log('window.open:', ...args);
6064
const url = args[0];
6165
if ( rePattern.test(url) !== targetResult ) {
6266
return target.apply(thisArg, args);
@@ -72,11 +76,11 @@
7276
if ( arg3 === '' ) { return iframe.contentWindow; }
7377
return new Proxy(iframe.contentWindow, {
7478
get: function(target, prop) {
75-
console.log('get', prop, '===', target[prop]);
79+
log('window.open / get', prop, '===', target[prop]);
7680
return target[prop];
7781
},
7882
set: function(target, prop, value) {
79-
console.log('set', prop, '=', value);
83+
log('window.open / set', prop, '=', value);
8084
target[prop] = value;
8185
},
8286
});

0 commit comments

Comments
 (0)