Open Bug 1477576 Opened 2 years ago Updated 1 year ago

[meta] Get rid of unnecessary/unused XPCOM component registrations

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set

Tracking

()

People

(Reporter: kmag, Unassigned)

References

(Depends on 2 open bugs, Blocks 2 open bugs)

Details

(Keywords: meta, Whiteboard: [overhead:50K])

Right now, on average, each component registration uses about 300 bytes. We have almost 700 of them. That adds up to significant overhead.

Lots of them can be easily gotten rid of. Many are only ever used from C++. Those can be replaced with singleton getters and constructors. Some are, for reasons that defy explanation, implemented in and used only by JS. Those can be replaced with, well, JS. A lot of them are just entirely unused.

All of the following registrations can be gotten rid of with minimal effort:

@mozilla.org/accessibleRetrieval;1

@mozilla.org/addons/policy-service;1
@mozilla.org/addons/remote-tag-service;1

@mozilla.org/audiochannel/service;1
@mozilla.org/audiochannelagent;1

@mozilla.org/autoconfiguration;1

@mozilla.org/browser/feeds/result-service;1
@mozilla.org/browser/livemark-service;2
@mozilla.org/browser/session-history-transaction;1

@mozilla.org/categorymanager;1

@mozilla.org/content/post-content-iterator;1
@mozilla.org/content/pre-content-iterator;1
@mozilla.org/content/subtree-content-iterator;1

@mozilla.org/cookieService;1

@mozilla.org/cspservice;1

@mozilla.org/cycle-collector-logger;1

@mozilla.org/dirIndex;1
@mozilla.org/dirIndexParser;1

@mozilla.org/dom/sessionStorage-manager;1
@mozilla.org/dom/storagemanager;1
@mozilla.org/dom/window-controller;1

@mozilla.org/editor/editingcontroller;1
@mozilla.org/editor/editingsession;1
@mozilla.org/editor/editorcontroller;1
@mozilla.org/editor/editordocstatecontroller;1

@mozilla.org/editor/htmleditor;1
@mozilla.org/editor/htmleditorcontroller;1
@mozilla.org/editor/texteditor;1
@mozilla.org/editor/txtsrvfiltermail;1

@mozilla.org/embedcomp/appstartup-notifier;1
@mozilla.org/embedcomp/base-command-controller;1
@mozilla.org/embedcomp/command-manager;1
@mozilla.org/embedcomp/controller-command-group;1
@mozilla.org/embedcomp/controller-command-table;1
@mozilla.org/embedcomp/find;1

@mozilla.org/embedding/browser/nsWebBrowser;1

@mozilla.org/embeddor.implemented/bookmark-charset-resolver;1

@mozilla.org/feed-entry;1
@mozilla.org/feed-generator;1
@mozilla.org/feed-person;1
@mozilla.org/feed-processor;1
@mozilla.org/feed-result;1
@mozilla.org/feed-textconstruct;1
@mozilla.org/feed;1

@mozilla.org/geolocation/service;1

@mozilla.org/gfx/devicecontextspec;1
@mozilla.org/gfx/printsession;1

@mozilla.org/image/loader;1
@mozilla.org/image/request;1

@mozilla.org/intl/collation;1
@mozilla.org/intl/utf8converterservice;1

@mozilla.org/js/xpc/ContextStack;1
@mozilla.org/js/xpc/ID;1
@mozilla.org/js/xpc/XPConnect;1

@mozilla.org/login-manager/crypto/SDR;1
@mozilla.org/login-manager/loginInfo;1
@mozilla.org/login-manager/prompter;1
@mozilla.org/login-manager/storage/json;1

@mozilla.org/network/application-cache-namespace;1
@mozilla.org/network/application-cache;1
@mozilla.org/network/background-channel-registrar;1
@mozilla.org/network/content-sniffer;1
@mozilla.org/network/file-stream;1
@mozilla.org/network/http-channel-auth-provider;1
@mozilla.org/network/request-context-service;1
@mozilla.org/network/request-observer-proxy;1
@mozilla.org/network/socket-provider-service;1
@mozilla.org/network/sync-stream-listener;1
@mozilla.org/server/jshttp;1

@mozilla.org/offlinecacheupdate;1

@mozilla.org/passwordmanager/authpromptfactory;1

@mozilla.org/peerconnection;1

@mozilla.org/power/powermanagerservice;1

@mozilla.org/pref-relativefile;1

@mozilla.org/presentation/datachanneltransport;1

@mozilla.org/properties;1

@mozilla.org/redirectchannelregistrar;1

@mozilla.org/remote-web-navigation;1

@mozilla.org/remote/marionette;1

@mozilla.org/nsGeneratingKeypairInfoDialogs;1
@mozilla.org/nsTokenDialogs;1
@mozilla.org/security/keyobject;1
@mozilla.org/security/psmdownload;1
@mozilla.org/securityconsole/message;1

@mozilla.org/spellchecker;1

@mozilla.org/synth-voice-registry;1

@mozilla.org/toolkit/disk-space-watcher;1
@mozilla.org/toolkit/native-app-support;1
@mozilla.org/toolkit/remote-service;1

@mozilla.org/transactionmanager;1

@mozilla.org/udp-socket-child;1

@mozilla.org/uriclassifierservice
@mozilla.org/url-classifier/jslib;1

@mozilla.org/userinfo;1

@mozilla.org/chrome/chrome-native-theme;1
@mozilla.org/widget/appshell/gtk;1
@mozilla.org/widget/bidikeyboard;1
@mozilla.org/widget/image-to-gdk-pixbuf;1
@mozilla.org/widget/printdialog-service;1
@mozilla.org/widget/window/gtk;1
@mozilla.org/widgets/child_window/gtk;1

@mozilla.org/thread-pool;1
@mozilla.org/xpcom/error-service;1

@mozilla.org/xre/runtime;1

@mozilla.org/layout/form-processor;1

@mozilla.org/layout/xul-boxobject-menu;1
@mozilla.org/layout/xul-boxobject-tree;1
@mozilla.org/layout/xul-boxobject;1

@mozilla.org/svg/svg-document;1
@mozilla.org/xml/xml-document;1
@mozilla.org/xul/xul-controllers;1
@mozilla.org/xul/xul-sort-service;1


And I have ideas about how to get rid of:

@mozilla.org/supports-PRBool;1
@mozilla.org/supports-PRInt16;1
@mozilla.org/supports-PRInt32;1
@mozilla.org/supports-PRInt64;1
@mozilla.org/supports-PRTime;1
@mozilla.org/supports-PRUint16;1
@mozilla.org/supports-PRUint32;1
@mozilla.org/supports-PRUint64;1
@mozilla.org/supports-PRUint8;1
@mozilla.org/supports-char;1
@mozilla.org/supports-cstring;1
@mozilla.org/supports-double;1
@mozilla.org/supports-float;1
@mozilla.org/supports-id;1
@mozilla.org/supports-interface-pointer;1
@mozilla.org/supports-string;1
Depends on: 1477578
Depends on: 1477667
Depends on: 1483541
Depends on: 1483557
Depends on: 1483650
Depends on: 1484109
Depends on: 1484118
Depends on: 1484135
Depends on: 1484137
Depends on: 1315460
Depends on: 1484394
Depends on: 1484848
Depends on: 1485247
Depends on: 1485493
Depends on: 1485494
Depends on: 1485870
Depends on: 1485871
Depends on: 1488111
Depends on: 1488112
Depends on: 1488115
Depends on: 1488235
Depends on: 1488236
Depends on: 1488238
Depends on: 1488305
Depends on: 1488306
Depends on: 1488401
Depends on: 1488349
Depends on: 1488659
Depends on: 1488784
Depends on: 1489018
Depends on: 1489095
Depends on: 1489111
Depends on: 1489147
Depends on: 1489024
Depends on: 1489362
Depends on: 1489365
Depends on: 1489571
Depends on: 1489617
Depends on: 1489690
Depends on: 1489786
Depends on: 1489787
Depends on: 1489790
Depends on: 1489793
Depends on: 1489812
Depends on: 1489915
Depends on: 1489916
Depends on: 1489917
No longer depends on: 1489095
No longer depends on: 1489111
Depends on: 1491005
Depends on: 1491019
Depends on: 1491558
Depends on: 1491560
Depends on: 1491561
Depends on: 1491569
Depends on: 1491574
Depends on: 1491576
Depends on: 1491588
Depends on: 1491594
Depends on: 1491595
Depends on: 1491605
Depends on: 1492039
Depends on: 1492142
Depends on: 1492584
Depends on: 1501404
Kris, any chance you could regenerate the list in comment 0?  That list is now quite stale and it's a lot of work to fish for new things from it.  (BTW I've also found quite a few XPCOM classes that should have been on that list but weren't while looking around, FWIW.)

Thanks!
Flags: needinfo?(kmaglione+bmo)
Depends on: 1502774
Unfortunately, it was a pretty manual process, with some code to spit out every contract ID that was registered on Linux, and then me individually checking how they were used. Here's the original list filtered to only include contracts that are still in Cc in my latest m-c build, though:


@mozilla.org/accessibleRetrieval;1

@mozilla.org/addons/policy-service;1

@mozilla.org/browser/livemark-service;2

@mozilla.org/categorymanager;1

@mozilla.org/cookieService;1

@mozilla.org/cspservice;1

@mozilla.org/embedding/browser/nsWebBrowser;1

@mozilla.org/feed-entry;1
@mozilla.org/feed-generator;1
@mozilla.org/feed-person;1
@mozilla.org/feed-processor;1
@mozilla.org/feed-result;1
@mozilla.org/feed-textconstruct;1
@mozilla.org/feed;1

@mozilla.org/gfx/devicecontextspec;1
@mozilla.org/gfx/printsession;1

@mozilla.org/image/loader;1
@mozilla.org/image/request;1

@mozilla.org/login-manager/crypto/SDR;1
@mozilla.org/login-manager/loginInfo;1
@mozilla.org/login-manager/prompter;1
@mozilla.org/login-manager/storage/json;1

@mozilla.org/passwordmanager/authpromptfactory;1

@mozilla.org/peerconnection;1

@mozilla.org/power/powermanagerservice;1

@mozilla.org/presentation/datachanneltransport;1

@mozilla.org/remote-web-navigation;1

@mozilla.org/remote/marionette;1

@mozilla.org/nsGeneratingKeypairInfoDialogs;1
@mozilla.org/nsTokenDialogs;1
@mozilla.org/security/keyobject;1
@mozilla.org/security/psmdownload;1
@mozilla.org/securityconsole/message;1

@mozilla.org/synth-voice-registry;1

@mozilla.org/toolkit/remote-service;1

@mozilla.org/udp-socket-child;1

@mozilla.org/uriclassifierservice
@mozilla.org/url-classifier/jslib;1

@mozilla.org/userinfo;1

@mozilla.org/widget/appshell/gtk;1
@mozilla.org/widget/image-to-gdk-pixbuf;1
@mozilla.org/widget/printdialog-service;1

@mozilla.org/xpcom/error-service;1

@mozilla.org/xre/runtime;1

@mozilla.org/layout/form-processor;1
Flags: needinfo?(kmaglione+bmo)
Depends on: 1503214
Depends on: 1504438
Depends on: 1504439
Depends on: 1504450
Depends on: 1504551
Depends on: 1504557
Depends on: 1504566
Depends on: 1504574
Depends on: 1508352
You need to log in before you can comment on or make changes to this bug.