Switching to dark or light theme in the Add-On Manager is broken - Uncaught (in promise) TypeError: addon.userPermissions is null
Categories
(Toolkit :: Add-ons Manager, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | unaffected |
firefox-esr78 | --- | unaffected |
firefox83 | --- | wontfix |
firefox84 | --- | wontfix |
firefox85 | --- | fixed |
People
(Reporter: darktrojan, Assigned: TbSync)
References
Details
(Keywords: regression, regressionwindow-wanted)
Attachments
(1 file, 3 obsolete files)
Here's what happens if I go to the Add-On Manager and click enable on one of the built-in themes:
Uncaught (in promise) TypeError: addon.userPermissions is null
shouldShowPermissionsPrompt chrome://mozapps/content/extensions/aboutaddonsCommon.js:156
handleEvent chrome://mozapps/content/extensions/aboutaddons.js:2814
This doesn't seem to affect 78.
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Comment 1•4 years ago
|
||
It also happens if I install a theme from ATN then try to return to the default theme by clicking Enable. Switching between ATN themes works, as does disabling the current theme to return to the default theme.
Comment 2•4 years ago
|
||
Theme switching works for me. But I saw other mentioning this issue earlier and after some time it was gone away. Have you tried another profile?
Comment 3•4 years ago
|
||
I'm seeing this on Mac (first time I've tried dark mode there)
Uncaught (in promise) TypeError: addon.userPermissions is null
shouldShowPermissionsPrompt chrome://mozapps/content/extensions/aboutaddonsCommon.js:156
handleEvent chrome://mozapps/content/extensions/aboutaddons.js:2814
aboutaddonsCommon.js:156:36
Comment 4•4 years ago
|
||
Tested in "empty" profile. No error - dark enables fine.
Comment 5•4 years ago
•
|
||
In the problem profile (with many accounts) I see the following items that I don't see in the empty profile:
-
1595313308408 addons.xpi DEBUG Loaded add-on state: {"app-profile":{"addons":{"gpo@extensions.org":{"dependencies":[],"enabled":false,"lastModifiedTime":1500209962364,"path":"gpo@extensions.org.xpi","rootURI":"jar:file:///Users/wsm0/Library/Thunderbird/Profiles/q1j95wuf.default/extensions/gpo@extensions.org.xpi!/","runInSafeMode":false,"signedState":2,"telemetryKey":"gpo%40extensions.org:0.6.7.2","version":"0.6.7.2"},"labelhref@test":{"dependencies":[],"enabled":false,"lastModifiedTime":1356320846000,"path":"labelhref@test.xpi","rootURI":"jar:file:///Users/wsm0/Library/Thunderbird/Profiles/q1j95wuf.default/extensions/labelhref@test.xpi!/","runInSafeMode":false,"signedState":0,"telemetryKey":"labelhref%40test:1.0","version":"1.0"},"mailsummaries@mozillamessaging.com":{"dependencies":[],"enabled":false,"lastModifiedTime":1574200968554,"loader":null,"path":"mailsummaries@mozillamessaging.com.xpi","rootURI":"jar:file:///Users/wsm0/Library/Thunderbird/Profiles/q1j95wuf.default/extensions/ma…
-
Error while loading 'jar:file:///Users/wsm0/Library/Thunderbird/Profiles/q1j95wuf.default/extensions/crashme@ted.mielczarek.org.xpi!/manifest.json' (NS_ERROR_FILE_NOT_FOUND)
-
[Exception... "Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsIXPCComponents_Utils.readUTF8URI]" nsresult: "0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)" location: "JS frame :: resource://gre/modules/L10nRegistry.jsm :: L10nRegistry.loadSync :: line 684" data: no]
-
[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIStringBundle.GetStringFromName]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://messenger/content/about-support/aboutSupport.js :: application :: line 236" data: no]
-
Uncaught (in promise) undefined
-
InvisibleToDebugger: Error reps.js:8527:15
Comment 6•4 years ago
|
||
So incompatible mailsummaries and crashme add-ons is the cause?
Reporter | ||
Comment 7•4 years ago
|
||
I found that the extensions.json file in my profile had:
"userPermissions": null,
"optionalPermissions": null,
for the themes. If I changed them to:
"userPermissions": {
"permissions": [],
"origins": []
},
"optionalPermissions": {
"permissions": [],
"origins": []
},
I could again load the themes in my test profile (Daily). However, the values are also null
in my normal profile (79.0b2), and that works fine.
Comment 8•4 years ago
|
||
Is there a path forward?
Comment 9•4 years ago
|
||
Testers (including me) cannot test theme issues.
Who can be assigned to solve this?
Do we need a regression range?
Comment 10•4 years ago
|
||
John, please investigate.
Assignee | ||
Comment 11•4 years ago
•
|
||
I was testing 82.0a1 (2020-09-03) (64-bit) on Windows 10. All themes (built-in or installed from ATN) have
"userPermissions": null,
BUT I can switch between them without any issue, in old and new profiles. So I cannot reproduce comment 7. It works for me even with "null".
What we can do is to search for things like this:
https://searchfox.org/mozilla-central/source/toolkit/mozapps/extensions/content/aboutaddonsCommon.js#167
and fix those, as that obviously throws if userPermissions is null. It seems to be the only such usage;
Should I file a bug in m-c?
For further tests:
@Geoff + @ Wayne :
- Are you both on Mac?
@Geoff:
- Can you still reproduce this with latest Daily in your profile, when you switch back to
null
?
@ Wayne:
- You said it does not happen on a fresh profile, is there anything you can do to break a fresh profile? Install a certain add-on? Where did you get a working version from crashme?
Comment 12•4 years ago
|
||
You can just move this bug to the proper component if it's a problem m-c code error.
Assignee | ||
Comment 13•4 years ago
|
||
I would at least need confirmation that this is the cause.
@Geoff + Wayne:
- You can still reproduce the issue with one of your broken profiles with current tip? If so, I can create patch and you try if it resolves the issue?
Reporter | ||
Comment 14•4 years ago
|
||
Yes I've still got this problem and no I'm not on Mac (Linux). Dunno if it helps, but I have other non-default themes with null user permissions, and they work fine.
Assignee | ||
Comment 15•4 years ago
|
||
Patch to check if userPermissions is null.
Assignee | ||
Comment 16•4 years ago
|
||
@Geoff: Could you give it a spin?
Reporter | ||
Comment 17•4 years ago
|
||
Works for me.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 18•4 years ago
|
||
As suggested by Magnus I moved this bug into the toolkit component. Who can I ask for review?
Comment 19•4 years ago
|
||
Looking at the blame, r?mstriemer
https://hg.mozilla.org/mozilla-central/log/tip/toolkit/mozapps/extensions/content/aboutaddonsCommon.js
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 20•4 years ago
|
||
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 21•4 years ago
|
||
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 22•4 years ago
•
|
||
@mixedpuppy: As you suggested, I changed the patch to the nicer syntax without using isArray
, but still had to provide a dummy userPermissions
obj as {}
would still cause the expansion to fail. But this is not checking for all possible input conditions. I would therefore propose to remove the expension altogether and just use this return statement:
return !!addon.userPermissions?.origins?.length
|| !!addon.userPermissions?.permissions?.length;
So for origins
and permissions
, it does not matter if none, one or both have been defined or are of the wrong type.
I wanted to ask about your opinion before replacing the patch.
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 24•4 years ago
|
||
Is there anything I can do to move this forward? I changed the patch as requested by the original reviewer. Is it ok?
Comment 25•4 years ago
|
||
(In reply to John Bieling (:TbSync) from comment #24)
Is there anything I can do to move this forward? I changed the patch as requested by the original reviewer. Is it ok?
Updated•4 years ago
|
Comment 26•4 years ago
|
||
Hi, as per comment 9 do you need help getting a regression range? Can I get some steps on how to reproduce in order to give you a hand?
Best,
Clara
Comment 27•4 years ago
|
||
We only need mixedpuppy's assistance. But thanks for offering to help.
Comment 28•4 years ago
|
||
This dropped through the cracks, sorry. I've responded on the patch.
Assignee | ||
Comment 29•4 years ago
|
||
@mixedpuppy: Thanks for the review. Yes, the Null Propagation Operator / Optional Chaining Operator is much better. Working on the test now.
Assignee | ||
Comment 30•4 years ago
|
||
Comment 31•4 years ago
|
||
Hi John, are you able to update patches rather than push a new patch? Also the last patch didn't have a test in it.
Assignee | ||
Comment 32•4 years ago
|
||
The phabricator work flow is pretty new to me. I will try to learn how to update a patch.
I have send the updated patch to not stall this bug. But I struggle to write a test, as for me, the crucial part is never executed as addon.seen is always true. The function always exits early. You want a test that simulated theme enabled/disabled?
Comment 33•4 years ago
•
|
||
(In reply to John Bieling (:TbSync) from comment #32)
The phabricator work flow is pretty new to me. I will try to learn how to update a patch.
If you have arc working, you can do this:
edit files
hg commit -m "Bug XXX description
arc diff .^ (add push description in editor)
The to update:
edit files
hg commit --amend (just save when editor comes up)
arc diff .^ (add description for new push the save)
If you want to pull an existing phabricator patch:
hg up central (or specific commit)
arc patch Dnnnn
I have send the updated patch to not stall this bug. But I struggle to write a test, as for me, the crucial part is never executed as addon.seen is always true. The function always exits early. You want a test that simulated theme enabled/disabled?
If you can update the patch per the above with the test, I can take a look at what you are doing and make some suggestions.
Thanks!
Comment 34•4 years ago
|
||
Hi John, just touching base to see if you're still stuck.
Updated•4 years ago
|
Assignee | ||
Comment 36•4 years ago
|
||
So I gave it a try to update the revision using the documentation I found here:
https://github.com/mozilla-conduit/review/blob/master/README.md
This now includes a test to check for reproduction steps given in comment 1.
Assignee | ||
Comment 37•4 years ago
|
||
To get this checked in, I think a testing tag needs to be set?
Comment 38•3 years ago
|
||
Pushed by scaraveo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7638d4daff9c Fix addon.userPermissions is null r=mixedpuppy
Assignee | ||
Updated•3 years ago
|
Comment 39•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Description
•