I'm trying to avoid explicitly defining content scripts to match urls -- I'm trying to limit the amount of permissions I need on install -- and I'm running into an issue where a content script I'm attempting to insert via `executeScript()` isn't working when I create a new window and attempt to insert it.
These are my permissions:
optional_host_permissions: ["*://*/*"],
permissions: ["contextMenus", "activeTab", "scripting"],
The flow:
- ContextMenu onclick event fired
- Request Permissions with { origins: ["*://*.localhost/*"] } (this works)
- If I get them:
- Open the new window with url of ("http://my-app.localhost:8000/workflow/search")
- Insert the script with `executeScript()`, passing in the tabId of the first tab that is in the chrome.windows.Window object that's returned by the `create()` call
I don't get any error when I insert the script, I get back an InjectionResul[] containing:
- documentId: "8A5832935780B3A540A1A7103A6C8E9B"
- frameId: 0
- result: null
This looks good to me, but when I view the new popup window I created, the content script isn't injected.
The only way I've gotten this to work is to define the content script in my manifest, which also requires a `matches` string array to go with it. I don't want to specify the match expliciltly, so I use "*://*/*", but this has the result of displaying in the extension's permissions that I can manipulate any page, the opposite of what I want.
Any ideas for what's going on are greatly appreciated.