1
0
Fork 0
firefox/docs/code-quality/lint/linters/eslint-plugin-mozilla/rules/use-services.rst
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

21 lines
650 B
ReStructuredText

use-services
============
Requires the use of ``Services`` rather than ``Cc[].getService()`` where a
service is already defined in ``Services``.
Examples of incorrect code for this rule:
-----------------------------------------
.. code-block:: js
Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(Components.interfaces.nsIAppStartup);
Examples of correct code for this rule:
---------------------------------------
.. code-block:: js
Services.wm.addListener()
Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator)