Remove resource://gre/modules/Battery.jsm
Categories
(Toolkit :: General, enhancement, P5)
Tracking
()
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: florian, Assigned: Felipe, Mentored)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
resource://gre/modules/Battery.jsm was introduced in bug 978857, and is only referenced by toolkit/modules/tests/browser/browser_Battery.js which tests it. It was meant as a test helper, so it should be packaged using TESTING_JS_MODULES instead of EXTRA_JS_MODULES. But given that no other test seems to be using it, I think we could also just remove it. Yoric, you r+'ed this file in bug 978857, how do you feel about us removing it?
Well, it was meant to be used by bug 978857, which would still be useful.
Reporter | ||
Comment 2•7 years ago
|
||
(In reply to David Teller [:Yoric] (please use "needinfo") from comment #1) > Well, it was meant to be used by bug 978857, which would still be useful. Wrong bug number I assume.
Sorry, it was bug 506975.
Reporter | ||
Comment 4•7 years ago
|
||
Ok, let's package it using TESTING_JS_MODULES then.
Assignee | ||
Comment 5•6 years ago
|
||
navigator.battery was removed in bug 1259335. Battery.jsm was only a stub implementation to return fake values during tests, but the navigator.battery API itself is totally gone now. In this case, I think we can remove this file, right?
Assignee | ||
Comment 6•6 years ago
|
||
Hmm I got confused, navigator.battery was non-standard, but navigator.getBattery() is still available for privileged code
I still think that bug 506975 would be useful for our energy use.
Comment 8•5 years ago
|
||
(In reply to Florian Quèze [:florian] (PTO until Jan 2) from comment #4) > Ok, let's package it using TESTING_JS_MODULES then. Can we still do this? Can you maybe write up a brief description of how to do this and make this a mentored bug?
Reporter | ||
Comment 9•5 years ago
|
||
Battery.jsm is currently packaged at https://searchfox.org/mozilla-central/rev/ecf61f8f3904549f5d65a8a511dbd7ea4fd1a51d/toolkit/modules/moz.build#186 We should move this line to the TESTING_JS_MODULES section a few lines above. The url to import in the code will then become "resource://testing-common/Battery.jsm" instead of the current "resource://gre/modules/Battery.jsm" used at https://searchfox.org/mozilla-central/source/toolkit/modules/tests/browser/browser_Battery.js#5 After doing this change, the file will no longer be shipped as part of Firefox, so it'll no longer be reported as unreferenced, ie https://searchfox.org/mozilla-central/rev/ecf61f8f3904549f5d65a8a511dbd7ea4fd1a51d/browser/base/content/test/static/browser_all_files_referenced.js#147-148 should be removed.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 10•5 years ago
|
||
So I propose that we go back on the decision and fully remove this Battery.jsm module. Its purpose was to be a wrapper around navigator.getBattery() that all code should use in order to allow testing to provide fake values for it. However, there are some issues:
-
I'm inspecting code across the tree to remove usage of the hiddenDOMWindow (bug 1527219). This module should probably be fixed to use an existing browser window instead of the hidden window
-
navigator.getBattery() got deprecated and unexposed to web content, so there really is no reason for this to be tied to navigator or a window. If someone needs this functionality in the future, it would be better if it got converted to a normal internal component instead of needing a window to use it.. And, in that case, there are other ways to create a mock component to override it on tests..
Given this, are you ok if we remove it? It would be easy to bring it back from history if needed (and hopefully, if someone does that, to rewrite it slightly to not use the hidden window)
No objection from me.
Assignee | ||
Comment 12•5 years ago
|
||
Thanks!
Assignee | ||
Comment 13•5 years ago
|
||
Comment 14•5 years ago
|
||
Pushed by fgomes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3607e50ad27a Remove unused Battery.jsm. r=Yoric
Comment 15•5 years ago
|
||
Backed out changeset 3607e50ad27a (bug 1351078) for build bustage. CLOSED TREE
Log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=229926252&repo=autoland&lineNumber=1520
Push with failures:
https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&classifiedState=unclassified&revision=3607e50ad27a07aea93c2e8b81d8ae05d34fc148
Backout:
https://hg.mozilla.org/integration/autoland/rev/176ff7c8871e7df2977659d1f7c9107241bb6318
Assignee | ||
Comment 16•5 years ago
|
||
Sorry, I just forgot to remove the deleted test file from browser.ini
Comment 17•5 years ago
|
||
Pushed by fgomes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f79d064a028c Remove unused Battery.jsm. r=Yoric
Comment 18•5 years ago
|
||
bugherder |
Comment 19•5 years ago
|
||
bugherder |
Comment 20•5 years ago
|
||
== Change summary for alert #19615 (as of Mon, 25 Feb 2019 07:28:01 GMT) ==
Improvements:
2% tp5o_webext responsiveness linux64 pgo e10s stylo 1.49 -> 1.46
For up to date results, see: https://treeherder.mozilla.org/perf.html#/alerts?id=19615
Description
•