addEventListener not fired in child window

Hello, there is an extension for Firefox, the contentz.js file (content script) contains the following code that runs on the page - https://aliexpress.ru/wholesale?catId=0&initiative_id=SB_20200418035153&SearchText=power+bank

var lock = false;

window.onload = async function() {

if (!lock) {
lock = true;
emulate();
}
}

async function emulate() {

var urlz = “https://aliexpress.ru/item/4000409895804.html”;
var promise1 = new Promise(function(resolve, reject) {

newWin = window.open(urlz , “hello”, “width=800,height=600”);

newWin.addEventListener(“load”, analyze_it); //eventlistener
function analyze_it() {
alert(“test”);
resolve(“Success!”);
}
})
}

everything works fine in the Chrome browser, in Firefox, the event does not work, a message is displayed in the console - “Permission denied to access property “addEventListener” on cross-origin object”, when trying to access any element of the child window, a similar error is also displayed. What’s the matter? After all, the domains at the parent and child windows are the same.

Your origin is the origin of the extension, but because you have the host permission (I assume you do, since you’re running a content script), it should still work.

If you indeed have the host permission for aliexpress.ru, I’d recommend to file a bug on buzilla:
https://bugzilla.mozilla.org/enter_bug.cgi?product=WebExtensions

P.S.: discourse supports markdown code blocks or you can add code blocks in the editor so the code is easier to read for future posts :slight_smile: