schomery / popup-blocker

A reliable popup blocker with history
https://webextension.org/listing/popup-blocker.html
Mozilla Public License 2.0
143 stars 37 forks source link

Uncaught TypeError: Cannot create proxy with a non-object as target or handler #160

Open Juko8 opened 3 months ago

Juko8 commented 3 months ago

Logging on our website caught one user having ~4k exceptions from this extension in a very short timespan.

Call Stack: TypeError: Cannot create proxy with a non-object as target or handler at simulate (chrome-extension://ijhfkkgjgpcplfeajghagkcebakjcpge/data/inject/block/main.js:52:52) at Object.get (chrome-extension://ijhfkkgjgpcplfeajghagkcebakjcpge/data/inject/block/main.js:63:13) at util.scorm.js:127:40

util.scorm.js being our code. Here is a snippet which seems to be the part the extension has issues with. We are opening a new window and then checking every 500 ms if it has been closed.

$('#TopDiv').addClass('BackGroundDisabled');
var win = window.open(scormUrl, '_blank', 'status=0,resizable=1,toolbar=0,location=0,width=' + width + ',height=' + height + ',scrollbars=1,left=' + parseInt((screen.availWidth / 2) - (width / 2)) + ',top=' + parseInt((screen.availHeight / 2) - (height / 2)) + '');

// If fullscreen, resize the new window:
if (fullscreen == 1) {
    win.moveTo(0, 0);
    win.resizeTo(screen.availWidth, screen.availHeight);
}

var refreshIntervalId;
if (ps.reload) {
    refreshIntervalId = setInterval(function () {
        if (win && win.closed) { // <----- This is line 127
            clearInterval(refreshIntervalId);
            __doPostBack('PopUpClosed', '');
        }
    }, 500);
}
else {
    refreshIntervalId = setInterval(function () {
        if (win && win.closed) {
            clearInterval(refreshIntervalId);
            $('#TopDiv').removeClass('BackGroundDisabled');
        }
    }, 500);
}

Operating system | Windows 10 Browser version | Edge 125.0 SDK version | javascript:3.0.1

schomery commented 3 months ago

can I have the link?

Juko8 commented 3 months ago

I could give you the link, but you wouldn't be able to access the page without a user login, which we typically only provide to our customer organizations and their employees.

schomery commented 3 months ago

You can provide a minimal HTML page that cause the issue (Cannot create proxy with a non-object as target)