Does not inject content script into frames in dev mode
gurupras opened this issue · comments
Guru Prasad commented
I updated my manifest.ts
to contain the following:
content_scripts: [{
matches: ['http://*/*', 'https://*/*'],
all_frames: true,
js: ['./dist/contentScripts/index.global.js'],
}],
First, when I run npm run dev
, I don't see this entry in extension/manifest.json
, but that just looks like how the template operates? So maybe that's OK. However, once I update src/contentScripts/index.ts
to contain
debugger
if (window !== window.top) {
console.log('[vitesse-webext] Inside iframe')
}
It hits the debugger once but it doesn't print anything despite the page containing iframes.
I tested this on a codepen.io page.
Is this a known limitation? What am I doing wrong? 🙁
Guru Prasad commented
Found the cause.
src/background/contentScriptHMR.ts
browser.webNavigation.onCommitted.addListener(({ tabId, frameId, url }) => {
if (frameId !== 0) { return } // <-- Reason
...
...
})