convert thunderbird javascript components over to use static registration (like bug 1524688)
Categories
(Thunderbird :: General, task)
Tracking
(thunderbird_esr102 unaffected)
Tracking | Status | |
---|---|---|
thunderbird_esr102 | --- | unaffected |
People
(Reporter: mkmelin, Assigned: khushil324)
References
Details
(Keywords: leave-open, Whiteboard: [two cases remaining in calendar])
Attachments
(8 files, 17 obsolete files)
43.75 KB,
patch
|
khushil324
:
review+
|
Details | Diff | Splinter Review |
86.02 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
166.82 KB,
patch
|
khushil324
:
review+
|
Details | Diff | Splinter Review |
35.18 KB,
patch
|
Details | Diff | Splinter Review | |
125.77 KB,
patch
|
khushil324
:
review+
|
Details | Diff | Splinter Review |
4.72 KB,
patch
|
khushil324
:
review+
|
Details | Diff | Splinter Review |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Bug 1524688 made it possible for javascript components to use static registration.
We should convert them over like mozilla-central did.
Reporter | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Reporter | ||
Comment 2•5 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
Assignee | ||
Comment 4•5 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #2)
The functionality should really be merged into MessengerContentHandler.jsm.
(Do it here or file a followup.)
I will do it in the follow-up bug. I guess we can also include MailContentHandler.jsm in MessengerContentHandler.jsm.
Reporter | ||
Comment 5•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
I will submit 4 patches here, one for each folder.
Reporter | ||
Comment 7•5 years ago
|
||
Noticed there's a linting error in Activity.jsm and the commit message is not quite right
Assignee | ||
Comment 8•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 9•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
I don't see a try run for the first part, well, this early one has the Calendar tests pretty busted:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=59694e6e496f274908a94ec58ab5d5c22c5ba2eb
Here's a new one:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=287fd9c8b026825ddf76130f0c5d36544fa9475b
Comment 12•5 years ago
|
||
Looks OK after rerunning Z4 twice :/
Updated•5 years ago
|
Comment 13•5 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/5624874a8354
Convert JavaScript components to use static registration in mail/. r=mkmelin
Reporter | ||
Comment 14•5 years ago
|
||
Assignee | ||
Comment 15•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Reporter | ||
Comment 16•5 years ago
|
||
Assignee | ||
Comment 17•5 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #16)
"resource://modules/IRC.jsm"
gre are for the m-c special modules
So should we use js modules without gre elsewhere also or here only?
Reporter | ||
Comment 18•5 years ago
|
||
Applies to all. (None of our modules should use gre. It doesn't work either if you do use gre, at least not always.)
Assignee | ||
Comment 19•5 years ago
•
|
||
We can import it like resource:///modules/filename.jsm. I guess resource:///modules/filename.jsm and resource://gre/modules/filename.jsm do the same thing. We are using both the convention at various places in TB. Should I file a follow-up bug to use the uniform convention in TB? Here, I have used resource:///modules/filename.jsm convention in the static registration part in Mail and Chat directory.
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=16c748f7b25edf5b41a1025db71352dd3bc7c8c0
Reporter | ||
Comment 20•5 years ago
|
||
Assignee | ||
Comment 21•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 22•5 years ago
|
||
Please check your own try runs. The X4 is known, but the X1 comes from here quite clearly:
TEST-UNEXPECTED-FAIL | comm/chat/components/src/test/test_logger.js | xpcshell return code: 0
Comment 23•5 years ago
|
||
Assignee | ||
Comment 24•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 25•5 years ago
|
||
Can you please supply a correct commit message. I didn't notice the hyphen, but the system did:
remote: ************************** ERROR ****************************
remote: Rev d9f7fa84e7f2 needs "Bug N" or "No bug" in the commit message.
remote: Khushil Mistry <khushil324@gmail.com>
remote: Bug-1562313 - Convert JavaScript components to use static registration in chat/. r=mkmelin
remote: *************************************************************
Comment 26•5 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/faa7e3cc7838
Convert JavaScript components to use static registration in chat/. r=mkmelin
Comment 27•5 years ago
|
||
Please file bugs like this in the proper component so that interested parties are CCed automatically.
Comment 28•5 years ago
|
||
Oops. I see that the same bug was used for multiple components. That's rather unfortunate. Please CC me on massive changes to chat.
Comment 29•5 years ago
|
||
I backed out the chat changes (https://hg.mozilla.org/comm-central/rev/9ba26fa8d407d7466b79ab338b874e2460aa110e). There's a lot of changes in it that shouldn't be made, I'll do a full review shortly, but some of the things I noticed:
- Private variables are being publicly exported from modules.
- Many changes are made that are unrelated to this bug.
- Many files were renamed and I can't tell if that was done on purpose or not.
- Improper capitalization of variables.
- I suspect that
ClassInfo
needs to be updated for these changes.
Assignee | ||
Comment 30•5 years ago
|
||
Patrick can you review the patch for chat?
Comment 31•5 years ago
|
||
(In reply to Khushil Mistry [:khushil324] from comment #30)
Patrick can you review the patch for chat?
Yes. The gist my complaint is that this bug should make the minimum necessary changes. E.g. file and variable renaming needs to happen in a separate bug. This should keep the diff much smaller (and make it much easier to review).
Reporter | ||
Comment 32•5 years ago
|
||
FWIW, I don't think that is for the most part doable. (Well you could do it, but you'd have to create hacks/wrongness from the start.) E.g. IMCore, the module file should preferably be uppercase, and it's now clearly a module, so should be .jsm not .js. Exporting CoreService, which is super generic sounding (when you're actually using it as module, as a js implemented XPCOM component ). So it wants to export something reasonable, like the patch changes it into IMCore.
That's just a small example: in summary, it doesn't make sense to try to split this up. It could actually be much harder to review in steps.
Comment 33•5 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #32)
FWIW, I don't think that is for the most part doable. (Well you could do it, but you'd have to create hacks/wrongness from the start.) E.g. IMCore, the module file should preferably be uppercase, and it's now clearly a module, so should be .jsm not .js. Exporting CoreService, which is super generic sounding (when you're actually using it as module, as a js implemented XPCOM component ). So it wants to export something reasonable, like the patch changes it into IMCore.
- I'm not implying we don't rename the files from .js to .jsm. I don't care about the extension.
- You've chosen what might be the only example of one that makes sense to rename. I'm talking about the gratuitous renames, like all of the IRC and XMPP, code just to change capitalization.
Reporter | ||
Comment 34•5 years ago
|
||
The IRC wasn't a module but some strange middle-thing between a module and not.
Since it became a module, you really shouldn't have any lower case exports (esp. for constructors). That makes it very difficult to see what's a variable or a class.
Re XMPP, I'm confused. That's a tiny change. Do you suggest we rename the file in two commits to do two renames (and nothing else)? The protocol is also all caps...
Comment 35•5 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #34)
The IRC wasn't a module but some strange middle-thing between a module and not.
Since it became a module, you really shouldn't have any lower case exports (esp. for constructors). That makes it very difficult to see what's a variable or a class.
I don't follow this, sorry. Currently all of that code uses a prefix of irc
. If we want to change it we should do it separately. Whether it is exported via a module or not doesn't make it any harder to tell if it is a class or not.
I also don't understand what you mean by "some strange middle-thing between a module and not". It was not a module. Period. There's no question about that.
Reporter | ||
Comment 36•5 years ago
|
||
It wasn't a module, but it was kind of used as one. In any case, it's one after the patch so it should behave like one. Sure, the irc changes could be separate mostly, and if you want to keep the irc prefix, we can just export an IRC (uppercase) instead and that's doable. You'd still have ugly looking things like new IRC.ircAccount(). Even disregarding ugly or not, that's not a typical js way of doing things.
Assignee | ||
Updated•5 years ago
|
Comment 37•5 years ago
|
||
Assignee | ||
Comment 38•5 years ago
|
||
Assignee | ||
Comment 39•5 years ago
•
|
||
(In reply to Patrick Cloke [:clokep] from comment #37)
Is there any clean-up to the
ClassInfo
implementation from
imXPCOMUtils.jsm after these changes?
I will work on it in the follow up bug.
Assignee | ||
Comment 40•5 years ago
|
||
Assignee | ||
Comment 41•5 years ago
|
||
Reporter | ||
Comment 42•5 years ago
|
||
Assignee | ||
Comment 43•5 years ago
|
||
Comment 44•5 years ago
|
||
The Z1 failure is from bug 1595747.
Reporter | ||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 45•5 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/0f435d155919
Convert JavaScript components to use static registration in mailnews/. r=mkmelin
Comment 46•5 years ago
|
||
Comment 47•5 years ago
|
||
Assignee | ||
Comment 48•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 49•5 years ago
•
|
||
(In reply to Patrick Cloke [:clokep] from comment #47)
Looks good! I think I might have misspoken on my last comment, I think that
we should rename xmpp.jsm to xmpp-base.jsm and then xmpp.js to xmpp.jsm.
This patch renames xmpp.js to xmpp-base.jsm instead, which I think is
confusing since xmpp.jsm is the code used by all XMPP based protocols while
xmpp.js is the generic XMPP protocol. What do you think?
There were few changes only so I did it this way.
Assignee | ||
Updated•5 years ago
|
Comment 50•5 years ago
|
||
Note that splinter seems to be rendering the diff really weird. Looking at the diff locally I see:
- xmpp.jsm -> xmpp-base.jsm
- xmpp.js -> xmpp.jsm
I did a local build and didn't see any issues.
Thanks for fixing this!
Comment 51•5 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/8d558f7fb2cc
Convert javascript components from chat to static registration. r=mkmelin DONTBUILD
Assignee | ||
Comment 52•5 years ago
•
|
||
This patch contains all the components except calStartupService and calBackendLoader and related sub components. CalStartupService will change I guess when we do a deep integration and it also needs certain synchronous calls. For calBackendLoader, I will submit a WIP patch. Some unit tests are failing for that patch as some calBackendLoader components are not loading in time.
Assignee | ||
Comment 53•5 years ago
•
|
||
This is a WIP. The calendar is working fine with this but components are not loading at the right time for unit tests. Geoff or Philipp, if you can give some feedback here, it will be really helpful.
Assignee | ||
Updated•5 years ago
|
Comment 54•5 years ago
|
||
Assignee | ||
Comment 55•5 years ago
•
|
||
(In reply to Paul Morris [:pmorris] (away until Jan 6) from comment #54)
console.log: WebExtensions: Firing profile-after-change listeners for
{e2fda1a4-762b-4020-b5ad-a41df1933103}
[calBackendLoader] Using Lightning's icaljs backend
JavaScript error: resource://calendar/calendar-js/calStartupService.js, line
57: TypeError: Cc['@mozilla.org/calendar/timezone-service;1'] is undefined
console.error: WebExtensions:
Error firing profile-after-change listener for
@mozilla.org/calendar/startup-service;1
JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 215:
TypeError: Cc[aContract] is undefined
JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 215:
TypeError: Cc[aContract] is undefined
JavaScript error: resource://calendar/modules/utils/calDateTimeUtils.jsm,
line 24: TypeError: cal.getTimezoneService(...) is undefined
JavaScript error: resource://calendar/modules/utils/calDateTimeUtils.jsm,
line 38: TypeError: cal.getTimezoneService(...) is undefined
JavaScript error: resource://calendar/modules/utils/calDateTimeUtils.jsm,
line 38: TypeError: cal.getTimezoneService(...) is undefined
JavaScript error: resource://calendar/modules/utils/calDateTimeUtils.jsm,
line 24: TypeError: cal.getTimezoneService(...) is undefined
JavaScript error: resource://calendar/modules/utils/calDateTimeUtils.jsm,
line 24: TypeError: cal.getTimezoneService(...) is undefined
JavaScript error: resource://calendar/modules/utils/calDateTimeUtils.jsm,
line 24: TypeError: cal.getTimezoneService(...) is undefined
JavaScript error: resource://calendar/modules/utils/calDateTimeUtils.jsm,
line 24: TypeError: cal.getTimezoneService(...) is undefined
JavaScript error: resource://calendar/modules/utils/calDateTimeUtils.jsm,
line 24: TypeError: cal.getTimezoneService(...) is undefined
JavaScript error: resource://calendar/modules/utils/calDateTimeUtils.jsm,
line 24: TypeError: cal.getTimezoneService(...) is undefined
JavaScript error: resource://calendar/modules/utils/calViewUtils.jsm, line
159: TypeError: Cc['@mozilla.org/calendar/calendar;1?type=composite'] is
undefined
JavaScript error: resource://calendar/modules/utils/calViewUtils.jsm, line
159: TypeError: Cc['@mozilla.org/calendar/calendar;1?type=composite'] is
undefined
JavaScript error: resource://calendar/modules/utils/calViewUtils.jsm, line
159: TypeError: Cc['@mozilla.org/calendar/calendar;1?type=composite'] is
undefined
JavaScript warning: resource:///modules/matrix/bluebird.js, line 5479:
unreachable code after return statement
JavaScript warning: resource:///modules/matrix/browser_request/index.js,
line 428: unreachable code after return statement
JavaScript error: chrome://calendar/content/today-pane.js, line 95:
TypeError: this.paneViews is null
I am not able to see any of these issues. Can you tell me how to reproduce?Magnus can you also check and if you can find any other issues so that I can tackle them in one go?
Comment 56•5 years ago
|
||
I have serious doubts that this is going to work properly while calendar is still an extension. The namespace resource://calendar
doesn't exist until the extension is loaded, but it's wanted when component registration happens. (I'm not sure when that is, but I'd bet it's pretty early on.)
Plus AIUI you'll only be able to register libical or ical.js which means the user can't switch between them for testing or debugging purposes.
Reporter | ||
Comment 57•5 years ago
|
||
Assignee | ||
Comment 58•5 years ago
•
|
||
On Mac, the WIP patch is also working fine, just unit test failures are there. So I am curious about the above errors.
Magnus, did you find any errors with WIP patch?
Any thoughts on Geoff's comment?
Comment 59•5 years ago
|
||
I tried applying both of the part4 patches and got the same errors in the console that I pasted in above (and calendar UI broken). I was seeing those errors with an artifact build, so I did a regular build (again with both part4 patches) and then I didn't get the errors. So the problem is apparently with artifact builds.
Comment 60•5 years ago
|
||
Correct – static registration changes cannot be made on an artifact build.
Assignee | ||
Comment 61•5 years ago
|
||
Assignee | ||
Comment 62•5 years ago
|
||
Comment 63•5 years ago
|
||
Comment 64•5 years ago
|
||
Comment 65•5 years ago
|
||
(In reply to Paul Morris [:pmorris] from comment #63)
Comment on attachment 9120130 [details] [diff] [review]
Bug-1562313_part-4_convert-calendar-to-static-registration-1.patchReview of attachment 9120130 [details] [diff] [review]:
Given comment 56 and 60, we know that while calendar is still an add-on
these changes will at least break artifact builds (which I and others use
for local development) if not other things.
Slightly important in the overall scheme of things, but worth noting.
So I think we should wait until
bug 1608610 lands before making these changes. Then we avoid any potential
issues.
Is there a way to "temporarily" land this bug, so it might help bug 1608610 to see what might break? Then "unland" it again once tested?
Comment 66•5 years ago
|
||
(In reply to Paul Morris [:pmorris] from comment #63)
Given comment 56 and 60, we know that while calendar is still an add-on
these changes will at least break artifact builds (which I and others use
for local development) if not other things.
That's not quite what I said. You can't make changes to static registration and expect an artifact build to pick them up. Once the changes have landed and built, the artifact build will be fine again.
IOW, static registration components.conf files are part of the build process (just like a .h file is) and a full build needs to happen to pick up any changes.
Assignee | ||
Comment 67•5 years ago
|
||
As discussed with you, Paul, I have made two separate patches: calBackendLoader and one for all other components. This patch is passing all the tests. calBackendLoader patch is causing some test failures.
Assignee | ||
Comment 68•5 years ago
•
|
||
Here, libical unit tests are failing.
In the calBackendLoader, we will load components only if Services.prefs.getBoolPref("calendar.icaljs", false) is true which is to indicate if the build if Nightly or not. We are setting "calendar.icaljs" to false for libical unit tests: https://searchfox.org/comm-central/source/calendar/test/unit/head_libical.js#6. So calBackendLoader components should not load. How can we implement that? What kind of flags should we use in moz.build file? I have added if CONFIG['NIGHTLY_BUILD']: in moz.build file. But for manual switching, what can we do?
Reporter | ||
Comment 69•5 years ago
|
||
Comment 70•5 years ago
|
||
Comment 71•5 years ago
|
||
Assignee | ||
Comment 72•5 years ago
|
||
Assignee | ||
Comment 73•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 74•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/5958d77c395b
Convert most calendar JavaScript components (not calBackendLoader) to static registration. r=pmorris DONTBUILD
Assignee | ||
Comment 75•5 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #69)
I don't think you should do that calendar.icaljs implicit check at build
time.You probably want to have (similar to before) a component that checks which
of the components it should load based on the calendar.icaljs pref (and I
guess unload too).
But will it not be the dynamic registration?
Reporter | ||
Comment 76•5 years ago
|
||
It would. While it would be preferable to get it using static registration, it's not too bad if we have to leave one component with dynamic reg for now.
Assignee | ||
Comment 77•5 years ago
|
||
Fine, let's leave them right now.
We have a few left: https://searchfox.org/comm-central/source/ldap/xpcom/src/nsLDAPProtocolHandler.js#59
https://searchfox.org/comm-central/search?q=XPCOMUtils.generateNSGetFactor&case=true®exp=false&path=mailnews%2F
I guess these are added after the patches are landed. Should I convert them in one patch or you want to leave them right now?
Reporter | ||
Comment 78•5 years ago
|
||
Please take care of them if there's no reason not to.
Assignee | ||
Comment 79•5 years ago
|
||
Assignee | ||
Comment 80•5 years ago
|
||
Magnus, I am not able to find your email for raising the flag of review. Please, review the above patch.
Assignee | ||
Comment 81•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 82•5 years ago
•
|
||
I got the review from Magnus on Matrix and I have updated the suggested changes.
Comment 83•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/c78b6b855a46
Convert JavaScript components to use static registration in ldap/. r=mkmelin DONTBUILD
Reporter | ||
Comment 84•5 years ago
•
|
||
To status is that we're left with two components in calendar: https://searchfox.org/comm-central/search?q=XPCOMUtils.generateNSGetFactor&case=true®exp=false&path=calendar
After bug 978570 (and following removal of libical) those can be removed.
Comment 85•3 years ago
|
||
Note that support for the old system is being removed soon in bug 1770237, so any remaining entries will need to be migrated soon.
Reporter | ||
Comment 86•3 years ago
|
||
Thanks for the heads up!
From a brief look there are a few cases that need fixing:
Reporter | ||
Comment 87•3 years ago
|
||
Reporter | ||
Comment 88•3 years ago
|
||
Port of https://phabricator.services.mozilla.com/D148183
Also fix some other small differences we had to the browser equivalent file.
Reporter | ||
Comment 89•3 years ago
|
||
Doesn't work. And not sure any of this makes sense either...
Reporter | ||
Comment 90•3 years ago
|
||
:kmag - do you have advice on what to do for the cases we have where we (per pref) load one or the other implementation? We use this in some cases where one component is being rewritten in JavaScript. Like https://searchfox.org/comm-central/source/mailnews/local/src/Pop3ModuleLoader.jsm
Will this continue to work?
Comment 91•3 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #90)
:kmag - do you have advice on what to do for the cases we have where we (per pref) load one or the other implementation? We use this in some cases where one component is being rewritten in JavaScript. Like https://searchfox.org/comm-central/source/mailnews/local/src/Pop3ModuleLoader.jsm
Will this continue to work?
Yes, that should continue to work.
Reporter | ||
Comment 92•3 years ago
|
||
Comment 93•3 years ago
|
||
Comment 94•3 years ago
|
||
Comment 95•3 years ago
|
||
Comment 96•3 years ago
|
||
I think that we are done here. The disabled JS account tests are being dealt with in bug 1773772.
Reporter | ||
Comment 97•3 years ago
|
||
Wohoo! \o/
Updated•3 years ago
|
Description
•