Just to make it clear I read multiple similar questions
1 2 3 4 5 etc
none of them are relevant to mine.
As I understood, WebAPI content scripts even if run in isolated environment still can manipulate page's DOM and add EventListeners, at least this is what Developer.Chrome and MDN says. However, I'm having a situation where it does not seems to be true.
Here is a sample extension:
manifest.json
{
"manifest_version": 2,
"name": "Foo",
"version": "0",
"permissions":
[
"storage",
"https://steamcommunity.com/*"
],
"content_scripts":
[ {
"matches": ["*://steamcommunity.com/groups/*"],
"js": ["content.js"],
"run_at": "document_idle",
"all_frames": true
} ]
}
content.js
'use strict';
const butArea = document.querySelector(".grouppage_join_area");
function queueGroup()
{
alert('yay!');
}
if (butArea)
{
butArea.addEventListener("click", queueGroup, false);
}
Load unpacked and go to https://steamcommunity.com/groups/SteamClientBeta. Click he button and no alert. Add the eventListener manually through console and it just werks. I tried click/onclick
properties too but same result.
Yes, I can inject my code into the page, no an issue here, but I dont really want to because it should work as it is, no? Otherwise - why not, what I'm missing?