add/move permission to optional_permissions caused error
Categories
(WebExtensions :: General, defect, P2)
Tracking
(firefox85 fixed)
Tracking | Status | |
---|---|---|
firefox85 | --- | fixed |
People
(Reporter: micha.postbox, Assigned: mixedpuppy)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0
Steps to reproduce:
Moved webRequest fro permission to optional permission
- on Firefox start
- addon disable/enable
Tried to reproduce this as a separate xpi testcase for this bug, but there was all working.
Actual results:
- on firefox start
can't access property "primeListener", api is undefined ExtensionCommon.jsm:2285
primeListeners resource://gre/modules/ExtensionCommon.jsm:2285
onManifestEntry chrome://extensions/content/parent/ext-backgroundPage.js:156
asyncEmitManifestEntry resource://gre/modules/ExtensionCommon.jsm:1546
AsyncFunctionNext self-hosted:693
(Async: async)
runManifest resource://gre/modules/Extension.jsm:2203
addStartupStatePromise resource://gre/modules/Extension.jsm:1905
addPromise resource://gre/modules/Extension.jsm:2197
runManifest resource://gre/modules/Extension.jsm:2202
startup resource://gre/modules/Extension.jsm:2504
addStartupStatePromise resource://gre/modules/Extension.jsm:1905
startup resource://gre/modules/Extension.jsm:2503
AsyncFunctionNext self-hosted:693
(Async: async)
startup resource://gre/modules/Extension.jsm:1699
callBootstrapMethod resource://gre/modules/addons/XPIProvider.jsm:1803
startup resource://gre/modules/addons/XPIProvider.jsm:1907
startup resource://gre/modules/addons/XPIProvider.jsm:2506
callProvider resource://gre/modules/AddonManager.jsm:212
_startProvider resource://gre/modules/AddonManager.jsm:583
startup resource://gre/modules/AddonManager.jsm:807
startup resource://gre/modules/AddonManager.jsm:3440
observe resource://gre/modules/addonManager.js:87
1589219456752 addons.xpi WARN Exception running bootstrap method startup on xxx-xxx@xxxxxxxx: TypeError: can't access property "primeListener", api is undefined(resource://gre/modules/ExtensionCommon.jsm:2285:11) JS Stack trace: primeListeners@ExtensionCommon.jsm:2285:11
onManifestEntry@ext-backgroundPage.js:156:18
asyncEmitManifestEntry@ExtensionCommon.jsm:1546:18
async_runManifest/<@Extension.jsm:2203:22addStartupStatePromise@Extension.jsm:1905:13addPromise@Extension.jsm:2197:26runManifest@Extension.jsm:2202:19startup/<@Extension.jsm:2504:16addStartupStatePromise@Extension.jsm:1905:13startup@Extension.jsm:2503:14async_startup@Extension.jsm:1699:27
callBootstrapMethod@XPIProvider.jsm:1803:33
startup@XPIProvider.jsm:1907:32
startup@XPIProvider.jsm:2506:39
callProvider@AddonManager.jsm:212:31
_startProvider@AddonManager.jsm:583:17
startup@AddonManager.jsm:807:14
startup@AddonManager.jsm:3440:26
observe@addonManager.js:87:29
- addon disable/enable
no failure
Expected results:
-
on Firefox start
no failure -
addon disable/enable
no failure
Comment 1•5 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Comment 2•5 years ago
|
||
Because this bug's Severity is normal
and has not been changed, and this bug's priority is --
(none,) indicating it has has not been previously triaged, the bug's Severity is being updated to --
(default, untriaged.)
Comment 3•5 years ago
|
||
Can you spell out the steps to reproduce more clearly? i.e., install version N where webRequest is a mandatory permission, then install version N+1 in which webRequest has become optional, then restart?
If you're getting this error in that case, then it sounds like another manifestation of bug 1618500.
I thought i had exactly this already tested in my test case but maybe something was going wrong.
Starting Firefox with webRequest in permissions, close Firefox, move webRequest to optional permissions and start Firefox again. Today i tested this again and here is the result:
Uncaught TypeError: can't access property "primeListener", api is undefined
primeListeners resource://gre/modules/ExtensionCommon.jsm:2285
onManifestEntry chrome://extensions/content/parent/ext-backgroundPage.js:156
asyncEmitManifestEntry resource://gre/modules/ExtensionCommon.jsm:1546
runManifest resource://gre/modules/Extension.jsm:2203
addStartupStatePromise resource://gre/modules/Extension.jsm:1905
addPromise resource://gre/modules/Extension.jsm:2197
runManifest resource://gre/modules/Extension.jsm:2202
startup resource://gre/modules/Extension.jsm:2504
addStartupStatePromise resource://gre/modules/Extension.jsm:1905
startup resource://gre/modules/Extension.jsm:2503
startup resource://gre/modules/Extension.jsm:1699
callBootstrapMethod resource://gre/modules/addons/XPIProvider.jsm:1803
startup resource://gre/modules/addons/XPIProvider.jsm:1907
startup resource://gre/modules/addons/XPIProvider.jsm:2506
callProvider resource://gre/modules/AddonManager.jsm:212
_startProvider resource://gre/modules/AddonManager.jsm:583
startup resource://gre/modules/AddonManager.jsm:807
startup resource://gre/modules/AddonManager.jsm:3440
observe resource://gre/modules/addonManager.js:87
ExtensionCommon.jsm:2285
1589384407360 addons.xpi WARN Exception running bootstrap method startup on test_bug-WE@test.de: TypeError: can't access property "primeListener", api is undefined(resource://gre/modules/ExtensionCommon.jsm:2285:11) JS Stack trace: primeListeners@ExtensionCommon.jsm:2285:11
onManifestEntry@ext-backgroundPage.js:156:18
asyncEmitManifestEntry@ExtensionCommon.jsm:1546:18
asyncrunManifest/<@Extension.jsm:2203:22
addStartupStatePromise@Extension.jsm:1905:13
addPromise@Extension.jsm:2197:26
runManifest@Extension.jsm:2202:19
startup/<@Extension.jsm:2504:16
addStartupStatePromise@Extension.jsm:1905:13
startup@Extension.jsm:2503:14
asyncstartup@Extension.jsm:1699:27
callBootstrapMethod@XPIProvider.jsm:1803:33
startup@XPIProvider.jsm:1907:32
startup@XPIProvider.jsm:2506:39
callProvider@AddonManager.jsm:212:31
_startProvider@AddonManager.jsm:583:17
startup@AddonManager.jsm:807:14
startup@AddonManager.jsm:3440:26
observe@addonManager.js:87:29
As next step i have removed the optional_permission completely. The failure persist.
The failure disappears only if i add the webrequest permission back to permissions and will come back if i remove the webrequest permission again. So optional_permissions is not relevant here. This is related to removal of webRequest permission (at least this one) from permissions.
If i disable/enable the addon in addonmanager the addon starts normally, at next firefox restart failure is back. This appears only at Firefox startup.
Maybe it is also relevant that my development profile use proxy files and no packed xpi.
Comment 6•5 years ago
|
||
(In reply to TheRave from comment #5)
If i disable/enable the addon in addonmanager the addon starts normally, at next firefox restart failure is back. This appears only at Firefox startup.
Maybe it is also relevant that my development profile use proxy files and no packed xpi.
Ah, are you changing the extension version when you change the manifest?
I do not have changed the addon version after the permission change in my dev enviroment.
To check if this is caused by proxy file enviroment, i made a xpi wihout webRequest and install. Proxy file is gone and xpi in extension folder. But fault is present at firefox start.
Then i installed a xpi with webRequest, failure is away and installed again the XPI without webRequest and failure is back.
Last but not least to exclude influence of addon versions number i made a 3rd test with different versions, same behavior.
So we can conclude
- only at firefox start
- not on addon enable
- also with xpi files
- also with different version numbers
- needed to access the API to get the failure message
I will upload the both testcases.
Is there a reason why the webRequest permission is not listed in addon manager addon properties or during install popup?
I was able to get rid of the permanent webRequest permission fault via the manual permission.remove()
- removed webRequest from manifest "permissions"
- placed a button to my options.html/js
- started Firefox and disable/enable my addon to get the addon working
- clicked the button to call permission.remove()
5 no success - permissions getAll() show that webRequest is still present, after next restart primeListener fault was still present
Added optional_permissions section with webRequest
- started Firefox and disable/enable my addon to get the addon working
- made a permissions.request() for webRequest permission
- Restart Firefox and no fault
- tried again permissions.remove() and permissions.getAll() show that webRequest permission is gone
- Restart Firefox / no fault
Comment 10•5 years ago
|
||
We mistakenly assume that api
is not null at https://searchfox.org/mozilla-central/rev/df4c90d4b8c92c99f76334acfe4813c573c12661/toolkit/components/extensions/ExtensionCommon.jsm#2285
However, when the extension lacks the permission, api
can be null
. I suppose that we can add !api ||
to the condition to fix this bug.
Comment 11•4 years ago
|
||
The severity field is not set for this bug.
:mixedpuppy, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 12•4 years ago
|
||
(In reply to TheRave from comment #7)
Is there a reason why the webRequest permission is not listed in addon manager addon properties or during install popup?
webRequest is used in conjunction with host permissions, so the user-facing prompt here is about "access your data on site ..."
(In reply to Rob Wu [:robwu] from comment #10)
We mistakenly assume that
api
is not null at https://searchfox.org/mozilla-central/rev/df4c90d4b8c92c99f76334acfe4813c573c12661/toolkit/components/extensions/ExtensionCommon.jsm#2285However, when the extension lacks the permission,
api
can benull
. I suppose that we can add!api ||
to the condition to fix this bug.
That would eliminate the exception but I think it might be papering over a deeper problem. That code only runs when the extension has an associated persistent listener and an extension can only create a persistent listener using a given api if it has permission to use that api. This bug is about the case when an extension is updated and the new version either drops the permission or migrates it from mandatory to optional. In the first case, we should have update handling code that clears any persistent listener state for apis that the extension is dropping permissions for. In the latter case, the permission should be migrated so the extension should retain the permission. The fact that this isn't happening suggests that we're not running the update handler when following the steps the original reporter used.
Ideally, both of these issues would get addressed and tested, but they both seem uncommon so its probably not a high priority.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 13•4 years ago
|
||
I want to investigate further, if a persistent proxy listener breaks due to moving to optional permission, this is a higher severity issue (which is how we marked it).
Comment 14•4 years ago
|
||
S1 or S2 bugs need an assignee - could you find someone for this bug?
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 15•4 years ago
|
||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Comment 16•4 years ago
|
||
Comment 17•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•3 years ago
|
Description
•