Closed
Bug 1328183
Opened 9 years ago
Closed 9 years ago
No window matching {"matchesHost":[]} when trying to execute a content script in a newly created tab
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: omidontop, Unassigned)
Details
(Whiteboard: [specification][type:bug])
What did you do?
================
1. Created a new tab using browser.tabs.create.
2. Upon success of the tab creation tried to execute a content script file using browser.tabs.executeScript on the tab.id received.
What happened?
==============
The executeScript fails with:
No window matching {"matchesHost":[]}
What should have happened?
==========================
It should've been able to execute the content script as I am able to do so on a user created tab pointing to the same URL.
Is there anything else we should know?
======================================
"permissions": ["activeTab", "storage", "tabs", "downloads", "alarms"]
And I figured adding "<all_urls>" to the permissions works around this.
Updated•9 years ago
|
Component: API → WebExtensions: Untriaged
Product: Mozilla Developer Network → Toolkit
Comment 1•9 years ago
|
||
Can you please provide the full (reduced) code that exhibits this behavior?
Specifically, what kind of URL are you opening in a tab?
Flags: needinfo?(omidontop)
Comment 2•9 years ago
|
||
You need permissions for a given host in order to inject a content script into it. So, yes, you'd need to add either the "<all_urls>" permission, or a permission for the specific hosts you need to access. The activeTab permission intentionally does not give you access to tabs that you create yourself, only to the tab on which the user initiated the action.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Updated•9 years ago
|
Flags: needinfo?(omidontop)
Thanks for the clarification. It might be helpful to mention this in the documentation for executeScript.
Updated•7 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•