Convert devtools/client/performance-new/popup/background.jsm.js to a commonjs module
Categories
(DevTools :: Performance Tools (Profiler/Timeline), task, P3)
Tracking
(Not tracked)
People
(Reporter: hexagonrecursion, Assigned: julienw)
References
Details
Attachments
(1 obsolete file)
According to Bug 1182194 JavaScript code modules should be converted to commonjs. I'll submit a patch to convert devtools/client/performance-new/popup/background.jsm.js
Reporter | ||
Comment 1•3 years ago
|
||
Updated•3 years ago
|
Comment 2•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'DevTools::Performance Tools (Profiler/Timeline)' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Assignee | ||
Comment 3•3 years ago
•
|
||
Thanks for the patch, I'll try to look at it shortly!
We already had bug 1592907 for this topic, you may want to look at it. Indeed I outlined there some issues to take care when doing this work.
Assignee | ||
Updated•3 years ago
|
Reporter | ||
Comment 4•3 years ago
|
||
I have replaced ChromeUtils.import("resource://gre/modules/Services.jsm")
with require("Services")
and removed ChromeUtils.import("resource://gre/modules/osfile.jsm")
as it was apparently unused. Tests still pass.
Reporter | ||
Comment 5•3 years ago
|
||
Hi, Julien. Given the lack of response (besides yours) to my comment in chat I don't think anyone knows whether require()
or ChromeUtils.import()
is preferable when importing jsm from commonjs. Let's find out! If we merge this and no one complains - we did good. If someone complains - we fix it. Both methods are currently in use: require(), ChromeUtils().
Pick your poison and I'll brew it for you unless you have a better idea.
Assignee | ||
Comment 6•3 years ago
|
||
I think both are working the same, so let's not overthink this too much :-) Maybe Julian will have some more comments, let's see.
Comment 8•3 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:hexagonrecursion, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee | ||
Comment 9•3 years ago
|
||
yes, I need to have a final look and land this.
I keep my need info.
Updated•2 years ago
|
Assignee | ||
Comment 11•2 years ago
|
||
I admit that because this is more a "cleanup" patch it's not in my priority list. But I'll try to spend a few hours on this.
Reporter | ||
Comment 12•2 years ago
|
||
I'll rebase or redo this, but I might not be able to find time to work on this until Monday. Sorry. I wonder if I could somehow split this into smaller and easier to review chunks.
Comment 13•2 years ago
|
||
FWIW, I attempted to rebase and it seems fine (+ had to fix a few new call sites for helpers from the background module). Pushed to try, let's see if we have a green one: https://treeherder.mozilla.org/#/jobs?repo=try&revision=193d42cc8b723007ee8db80011c132fdb2bdd735
And we should still try to land r+'d patches without too much delay, otherwise it takes a lot more time because we need to re-review, rebase etc... :)
Reporter | ||
Comment 14•2 years ago
|
||
I have redone my patch and submitted it to try. https://treeherder.mozilla.org/jobs?repo=try&revision=2476a0baabf08acfbc8a5d8a65818205921a55bb . Intermittent bugs are making things difficult. For reference: this is a "clean" commit I grabbed from mozilla-central.
Reporter | ||
Comment 15•2 years ago
|
||
Sorry: forgot to post the link to the clean commit: https://treeherder.mozilla.org/jobs?repo=try&revision=193d42cc8b723007ee8db80011c132fdb2bdd735
I see that try did not like my patch. I will investigate later
Comment 16•2 years ago
|
||
(In reply to Andrey Bienkowski from comment #15)
Sorry: forgot to post the link to the clean commit: https://treeherder.mozilla.org/jobs?repo=try&revision=193d42cc8b723007ee8db80011c132fdb2bdd735
I see that try did not like my patch. I will investigate later
The link above is my try push (which had some mistakes apparently), not to a clean central commit. But yes, we have existing intermittents.
Reporter | ||
Comment 17•2 years ago
|
||
Good catch! I posted the wrong link https://treeherder.mozilla.org/jobs?repo=try&revision=a47bf8ba596f346029005b459ab95bdf77c55c64 - 12 intermittents
Assignee | ||
Comment 18•2 years ago
|
||
Thanks!
I retriggered a few of the intermittents that seemed the most concerning to me (about devtools/client/performance-new/test/browser/browser_devtools-record-capture.js
). Let's see how this goes.
Assignee | ||
Comment 19•2 years ago
|
||
(In reply to Julien Wajsberg [:julienw] from comment #18)
Thanks!
I retriggered a few of the intermittents that seemed the most concerning to me (aboutdevtools/client/performance-new/test/browser/browser_devtools-record-capture.js
). Let's see how this goes.
This looks good, these are green now!
Reporter | ||
Comment 20•2 years ago
|
||
- My commit fails to lint -- fixed
- As helpfully pointed out by typescript (source-test-node-devtools-tests)
resource://devtools/shared/Loader.jsm
is nowresource://devtools/shared/loader/Loader.jsm
-- fixed
A new try push: https://treeherder.mozilla.org/jobs?repo=try&revision=b8c0a455f0dafa606d5fcb3c5630a5aa6c72a424
Reporter | ||
Comment 21•2 years ago
|
||
- In devtools/client/performance-new/test/browser/head.js I used require before it is defined -- fixed
Reporter | ||
Comment 22•2 years ago
•
|
||
Now I get:
Mozilla crash reason: Missing chrome or resource URLs: resource://devtools/client/performance-new/popup/background.js
I have figured it out. The above error is from my local tests. It turns out that I am supposed to rerun mach build
after changing a moz.build file.
There are still errors:
https://treeherder.mozilla.org/jobs?repo=try&revision=3a64c656c8a769e0a47c4cd19661c421c7dfd355
Reporter | ||
Comment 23•2 years ago
|
||
- The following hack that was required to make typescript work with JSM was breaking commonjs exports:
// Provide a fake module.exports for the JSM to be properly read by TypeScript.
/** @type {any} */ (this).module = { exports: {} };
https://treeherder.mozilla.org/#/jobs?repo=try&revision=e632c637427c948c069796f2bd5ae84daf8da385
Reporter | ||
Comment 24•2 years ago
|
||
Fixed: lint errors
Fixed: ReferenceError: require is not defined at /builds/worker/workspace/build/tests/xpcshell/tests/devtools/client/performance-new/test/xpcshell/head.js:12
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7e9c96496b0136e8abd36371597120143b83a75a
Reporter | ||
Comment 25•2 years ago
|
||
There are some failures:
- TEST-UNEXPECTED-FAIL | devtools/client/performance-new/test/browser/browser_devtools-record-capture.js | Uncaught exception in test - at chrome://mochitests/content/browser/devtools/client/performance-new/test/browser/helpers.js:405 - Error: The fake frontend indicated that there was an error injecting the profile.
- TEST-UNEXPECTED-FAIL | devtools/client/storage/test/browser_storage_indexeddb_duplicate_names.js | There is correct number of rows in indexedDB > https://test1.example.org - Got 5, expected 6
- TEST-UNEXPECTED-FAIL | devtools/client/performance/test/browser_perf-calltree-js-categories.js | A category node with the text
Gecko
is displayed in the tree. - - TEST-UNEXPECTED-FAIL | devtools/client/debugger/test/mochitest/browser_dbg-quick-open.js | Test timed out -
- TEST-UNEXPECTED-FAIL | devtools/client/inspector/animation/test/browser_animation_pause-resume-button_end-time.js | The playState of animation [0] should be running - Got "paused", expected "running"
- TEST-UNEXPECTED-FAIL | devtools/client/webconsole/test/browser/browser_webconsole_scroll.js | The console stayed scrolled to the top - Got 2543, expected +0
- TEST-UNEXPECTED-FAIL | devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_devtoolstoolbox_navigate_reload_button.js | leaked 2 window(s) until shutdown [url = about:devtools-toolbox?id=376&type=tab]
- TEST-UNEXPECTED-FAIL | devtools/client/aboutdebugging/test/browser/browser_aboutdebugging_devtoolstoolbox_navigate_reload_button.js | leaked 2 window(s) until shutdown [url = about:devtools-toolbox?id=376&type=tab]
- TEST-UNEXPECTED-FAIL | devtools/client/netmonitor/test/browser_net_timing-division.js | Test timed out -
- TEST-UNEXPECTED-FAIL | devtools/client/webconsole/test/browser/browser_webconsole_warning_group_multiples.js | Test timed out -
I suspect they might be intermittents, but something is broken and I don't have permission to repeat jobs.
Reporter | ||
Comment 26•2 years ago
|
||
I have found a bug (race condition) at https://searchfox.org/mozilla-central/source/devtools/client/performance-new/test/browser/helpers.js#394. This was making it difficult to reproduce one of the failures above locally. I'll report this as a separate bug.
Comment hidden (spam) |
Comment 28•2 years ago
|
||
The bug assignee is inactive on Bugzilla, so the assignee is being reset.
Updated•1 year ago
|
Updated•1 year ago
|
Assignee | ||
Comment 29•1 year ago
|
||
I had a look at this yesterday. I rebased the patch but didn't finish it yet. Indeed I realized we probably don't want to do this now, instead we'll want to convert it to an ESM directly when we'll convert the rest of the codebase.
Also the file is now used in other places and changing this file would make it necessary to load the devtools' Loader.sys.mjs
as well, which can be possibly costly and brings some distraction in the other codebase.
In this case I believe the drawbacks outweight the advantages, so I'm gonna close this bug.
Updated•1 year ago
|
Description
•