Use XPCOMUtils.defineLazyPreferenceGetter instead of Services.prefs.addObserver
Categories
(Remote Protocol :: Marionette, enhancement, P3)
Tracking
(firefox72 fixed)
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: whimboo, Assigned: rgpt)
Details
Attachments
(1 file)
For lazy addition and probably better performance in the near future we should flip to make use of `XPCOMUtils.defineLazyPreferenceGetter` in marionette.js: https://dxr.mozilla.org/mozilla-central/rev/085cdfb90903d4985f0de1dc7786522d9fb45596/testing/marionette/components/marionette.js#282 Here the definition of the lazy helper: https://dxr.mozilla.org/mozilla-central/rev/085cdfb90903d4985f0de1dc7786522d9fb45596/js/xpconnect/loader/XPCOMUtils.jsm#411 > * Defines a getter on a specified object for preference value. The > * preference is read the first time that the property is accessed, > * and is thereafter kept up-to-date using a preference observer.
Reporter | ||
Comment 1•4 years ago
|
||
Rishi, is that something you might want to have a look at? I know it's Javascript and not Python but it would give you actually a chance to work on the Marionette server component, which is in Firefox.
Assignee | ||
Comment 2•4 years ago
|
||
@whimboo, i got the part that for performance we are going to use lazy addition and XPCOM expose such functions but i am little unaware on working of Services and XPCOMutil which is a part of xpconnect (which is a bridge between XPCOM and JS).
Also what should be the default value while using XPCOMUtils.defineLazyPreferenceGetter for this preference and after making change i can verify this by simple running one of marionette-test cases right as marionette server would run in that case or do i have to check preference in some other way.
Reporter | ||
Comment 3•4 years ago
|
||
The required work for this bug is all JS and all part of the above mentioned marionette.js
file. There is nothing in Services, XPCOMUtils, or other files where changes are necessary.
In regards of the default value, you can find it a couple lines above:
https://dxr.mozilla.org/mozilla-central/rev/085cdfb90903d4985f0de1dc7786522d9fb45596/testing/marionette/components/marionette.js#279
The new API smoothly combines both cases into a single routine. So no need to explicitly read the pref during start-up, and observing it as long as Firefox is running.
Let me know if you have questions, and we can discuss those on IRC. Please note that I will not be around next week on Monday and Tuesday.
Assignee | ||
Comment 4•4 years ago
|
||
Reporter | ||
Updated•4 years ago
|
Updated•4 years ago
|
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d0220841f74b [marionette] Use defineLazyPreferenceGetter for observing "marionette.enabled" preference. r=whimboo,ato
Comment 6•4 years ago
|
||
bugherder |
Updated•8 months ago
|
Description
•