Error this.selectedItems is undefined when opening the prefs
Categories
(Toolkit :: UI Widgets, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr60 | --- | unaffected |
firefox64 | --- | unaffected |
firefox65 | --- | unaffected |
firefox66 | --- | fixed |
People
(Reporter: Paenglab, Assigned: jorgk-bmo)
References
Details
(Keywords: regression)
Attachments
(1 file, 2 obsolete files)
1.85 KB,
patch
|
bgrins
:
review+
|
Details | Diff | Splinter Review |
When opening the prefs, the error this.selectedItems is undefined is shown.
Full error:
this.selectedItems is undefined richlistbox.js:248
get selectedCount chrome://global/content/elements/richlistbox.js:248
_fireOnSelect chrome://global/content/elements/richlistbox.js:280
clearSelection chrome://global/content/elements/richlistbox.js:536
updateCategoryList chrome://calendar/content/preferences/categories.js:81
init chrome://calendar/content/preferences/categories.js:54
<anonymous> chrome://lightning/content/messenger-overlay-preferences.js:37
loadScript resource:///modules/Overlays.jsm:477
load resource:///modules/Overlays.jsm:195
load resource:///modules/Overlays.jsm:40
observe chrome://messenger/content/parent/ext-legacy.js:138
This shows since the 4. January 2019. So it's likely bug 1472558 which regressed this.
Assignee | ||
Comment 2•6 years ago
|
||
With this patch, the cloudfile test in bug 1517040 passes when switching from xbl-richlistbox back to the normal one.
Brian, does this change make sense. I don't know how it can end up uninitialised.
Assignee | ||
Updated•6 years ago
|
Comment 3•6 years ago
|
||
Since the selectedItems property is set in connectedCallback() 0, I'm assuming we are running this getter either before DOMContentLoaded has fired and we finish delayConnectedCallback(), or the element is being created from JS and this getter is being accessed before it's inserted into the DOM. Do you know which it is?
As for this patch specifically, I think a better fix would be to set this.selectedItems = new ChromeNodeList();
inside the constructor and not connectedCallback, so other methods / properties using selectedItems would be get as well. If you still see the error with that change I'd really like to know what's going on.
Comment 4•6 years ago
|
||
Reporter | ||
Comment 5•6 years ago
|
||
Comment on attachment 9036162 [details] [diff] [review]
1519653-selectedItems.patch
The calendar categories list shows still this error.
Assignee | ||
Comment 6•6 years ago
|
||
Richard, how do you get to this error? I see no categories, and I ran into bug 1519662.
Reporter | ||
Comment 7•6 years ago
|
||
Opening the prefs tab shows the error.
Assignee | ||
Comment 9•6 years ago
|
||
OK, with this patch
- the error opening the options tab goes away
- bug 1519662 goes away
- and we can use the normal richlistbox for the cloud file stuff and the test still passes (bug 1517040).
Comment 10•6 years ago
|
||
Assignee | ||
Comment 11•6 years ago
|
||
Thanks, Brian. "So as long as our tests pass this seems OK to me": I haven't run any test on M-C, to here goes. Let me know if you want more platforms. Also, we're moving only this line this.selectedItems = new ChromeNodeList();
, but there's more initialisation in connectedCallback()
, like this._currentIndex = null;
, etc. Should that move too?
https://treeherder.mozilla.org/#/jobs?repo=try&revision=9e68aaa40316d089e34566ea73113a3dcc2c5a76
Assignee | ||
Comment 12•6 years ago
|
||
Brian, the try came out green. So unless you want to check this on my platforms or we should move more code to the constructor, this would be ready for checkin. Please let me know.
Updated•6 years ago
|
Comment 13•6 years ago
|
||
(In reply to Jorg K (GMT+1) from comment #11)
Thanks, Brian. "So as long as our tests pass this seems OK to me": I haven't run any test on M-C, to here goes. Let me know if you want more platforms. Also, we're moving only this line
this.selectedItems = new ChromeNodeList();
, but there's more initialisation inconnectedCallback()
, likethis._currentIndex = null;
, etc. Should that move too?
Paolo, do you have an opinion about this? See comments 3 and 10 as well. I assume all of this initialization could move to the constructor as opposed to the connectedCallback with the same reasoning: https://searchfox.org/mozilla-central/rev/7d7aca6a935f0725f35050fdaa3dd7a1b05d8d38/toolkit/content/widgets/richlistbox.js#139-147.
It's not clear to me if the calls to this.setAttribute("allowevents", "true");
and this._refreshSelection();
can/should be done in the constructor, though. I get the feeling this isn't really a case we worry about (removing and re-appending a richlistitem).
Assignee | ||
Comment 14•6 years ago
|
||
Comment on attachment 9036166 [details] [diff] [review]
1519653-selectedItems.patch (v2)
Gentle ping, we'd like to move this forward.
Comment 15•6 years ago
|
||
(In reply to Brian Grinstead [:bgrins] from comment #13)
I assume all of this initialization could move to the constructor as opposed to the connectedCallback with the same reasoning
Hm, in fact the most correct location probably depends on the specific variable. I don't think the behavior of "richlistbox" when detached from the document has ever been a design consideration, so I'd say that either one of keeping the patch as it is now or moving all the variables to the constructor works for me.
It's not clear to me if the calls to
this.setAttribute("allowevents", "true");
andthis._refreshSelection();
can/should be done in the constructor, though. I get the feeling this isn't really a case we worry about (removing and re-appending a richlistitem).
I'd keep these two calls in the connectedCallback.
Comment 16•6 years ago
|
||
Comment on attachment 9036166 [details] [diff] [review]
1519653-selectedItems.patch (v2)
Either this or moving the initialization of the other properties here works for me.
Assignee | ||
Comment 17•6 years ago
|
||
As an alternative, this moves the initialisation of all object properties to the constructor.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=d2635a0d89a30c943a172ec9d081d355d07de66d
Comment 18•6 years ago
|
||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Comment 19•6 years ago
|
||
Pushed by dluca@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/41dbbcf3a61b
move initialisation of richlist properties to constructor. r=paolo
Comment 20•6 years ago
|
||
bugherder |
Updated•6 years ago
|
Description
•