use-services¶
Requires the use of Services.jsm
rather than Cc[].getService()
where a
service is already defined in Services.jsm
.
Examples of incorrect code for this rule:¶
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:¶
Services.wm.addListener()
Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator)