Closed
Bug 1287159
Opened 8 years ago
Closed 8 years ago
onCommand listeners do not grant the activeTab permisson to the current tab
Categories
(WebExtensions :: Untriaged, defect, P1)
Tracking
(firefox51 fixed)
RESOLVED
FIXED
mozilla51
Tracking | Status | |
---|---|---|
firefox51 | --- | fixed |
People
(Reporter: zmstefan, Assigned: mattw)
References
Details
(Whiteboard: triaged)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Steps to reproduce: I'm creating an WebExtension. I want to inject javascript to two different urls, one .js file per URL. I manage to do this with chrome.browserAction.onClicked, so when I click on button on toolbar it works correctly. But when I assign an shortcut to extension, and assign the same code for injecting .js to the onCommand event listener, it does not work, and outputs "No matching window" error in Console. I inject javascript into active tab with executeScript function. Actual results: ^^ Expected results: ^^
Added <"all_urls"> to permissions in manifest.json file, and it's working as it should!
Updated•8 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Comment 3•8 years ago
|
||
I'm not sure if this should be made a duplicate of bug 1274871. I haven't confirmed this bug, but it looks as if what's happening is that Firefox is not treating a hotkey combination as an "explicit user action", that then lets the "activeTab" permission do its thing. That would explain why the same code worked with a browser action. I would have expected that a hotkey combination *should* be treated as a user action, and the Chrome docs for activeTab confirm this: https://developer.chrome.com/extensions/activeTab. In short: Stefan should be able to use "activeTab" here. Using "<all_urls>" is a workaround for that bug.
Comment 4•8 years ago
|
||
Ah, sorry, you're right
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: DUPLICATE → ---
Summary: "No matching window" error when trying to executeScript from onCommand event listener in background.js - WebExtension → onCommand listeners do not grant the activeTab permisson to the current tab
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → mwein
Updated•8 years ago
|
Priority: -- → P1
Whiteboard: triaged
Assignee | ||
Comment 5•8 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/66960/diff/#index_header See other reviews: https://reviewboard.mozilla.org/r/66960/
Attachment #8774538 -
Flags: review?(kmaglione+bmo)
Comment 6•8 years ago
|
||
Comment on attachment 8774538 [details] Bug 1287159 - Grant activeTab permission to the current tab when onCommand fires. https://reviewboard.mozilla.org/r/66960/#review63828 This is a good start, but we also need tests. Please add at least one or two to browser_ext_tabs_executeScript_good.js, and probably one to browser_ext_tabs_executeScript_bad.js as well.
Attachment #8774538 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 7•8 years ago
|
||
Comment on attachment 8774538 [details] Bug 1287159 - Grant activeTab permission to the current tab when onCommand fires. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/66960/diff/1-2/
Attachment #8774538 -
Flags: review?(kmaglione+bmo)
Comment 8•8 years ago
|
||
Comment on attachment 8774538 [details] Bug 1287159 - Grant activeTab permission to the current tab when onCommand fires. https://reviewboard.mozilla.org/r/66960/#review65128 Perfect. Thanks!
Attachment #8774538 -
Flags: review?(kmaglione+bmo) → review+
Assignee | ||
Comment 9•8 years ago
|
||
Comment on attachment 8774538 [details] Bug 1287159 - Grant activeTab permission to the current tab when onCommand fires. Review request updated; see interdiff: https://reviewboard.mozilla.org/r/66960/diff/2-3/
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment 10•8 years ago
|
||
Pushed by cbook@mozilla.com: https://hg.mozilla.org/integration/fx-team/rev/9e0cbff9c4e1 Grant activeTab permission to the current tab when onCommand fires. r=kmag
Keywords: checkin-needed
Comment 11•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/9e0cbff9c4e1
Status: REOPENED → RESOLVED
Closed: 8 years ago → 8 years ago
status-firefox51:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•