Changes to component registration for mobile-browser from bug 568691.

This commit is contained in:
Benjamin Smedberg 2010-06-29 17:02:25 -04:00
Родитель 27258d649e
Коммит 00d18e1107
19 изменённых файлов: 40 добавлений и 168 удалений

Просмотреть файл

@ -108,52 +108,39 @@ AboutGeneric.prototype = {
function AboutFirstrun() {}
AboutFirstrun.prototype = {
__proto__: AboutGeneric.prototype,
classDescription: "About Firstrun",
contractID: "@mozilla.org/network/protocol/about;1?what=firstrun",
classID: Components.ID("{077ea23e-0f22-4168-a744-8e444b560197}")
}
function AboutFennec() {}
AboutFennec.prototype = {
__proto__: AboutGeneric.prototype,
classDescription: "About Fennec",
contractID: "@mozilla.org/network/protocol/about;1?what=fennec",
classID: Components.ID("{842a6d11-b369-4610-ba66-c3b5217e82be}")
}
function AboutFirefox() {}
AboutFirefox.prototype = {
__proto__: AboutGeneric.prototype,
classDescription: "About Firefox",
contractID: "@mozilla.org/network/protocol/about;1?what=firefox",
classID: Components.ID("{dd40c467-d206-4f22-9215-8fcc74c74e38}")
}
function AboutRights() {}
AboutRights.prototype = {
__proto__: AboutGeneric.prototype,
classDescription: "About Rights",
contractID: "@mozilla.org/network/protocol/about;1?what=rights",
classID: Components.ID("{3b988fbf-ec97-4e1c-a5e4-573d999edc9c}")
}
function AboutCertError() {}
AboutCertError.prototype = {
__proto__: AboutGeneric.prototype,
classDescription: "About Certificate Error",
contractID: "@mozilla.org/network/protocol/about;1?what=certerror",
classID: Components.ID("{972efe64-8ac0-4e91-bdb0-22835d987815}")
}
function AboutHome() {}
AboutHome.prototype = {
__proto__: AboutGeneric.prototype,
classDescription: "About Home",
contractID: "@mozilla.org/network/protocol/about;1?what=home",
classID: Components.ID("{b071364f-ab68-4669-a9db-33fca168271a}")
}
function NSGetModule(compMgr, fileSpec)
XPCOMUtils.generateModule([AboutFirstrun, AboutFennec, AboutRights,
AboutCertError, AboutFirefox, AboutHome]);
const components = [AboutFirstrun, AboutFennec, AboutRights,
AboutCertError, AboutFirefox, AboutHome];
const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);

Просмотреть файл

@ -69,7 +69,6 @@ function getPref(func, preference, defaultValue) {
// -----------------------------------------------------------------------
const PREF_ADDON_UPDATE_ENABLED = "extensions.autoupdate.enabled";
const PREF_ADDON_UPDATE_INTERVAL = "extensions.autoupdate.interval";
var gNeedsRestart = false;
@ -77,16 +76,10 @@ function AddonUpdateService() {}
AddonUpdateService.prototype = {
classDescription: "Add-on auto-update management",
contractID: "@mozilla.org/browser/addon-update-service;1",
classID: Components.ID("{93c8824c-9b87-45ae-bc90-5b82a1e4d877}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback]),
_xpcom_categories: [{ category: "update-timer",
value: "@mozilla.org/browser/addon-update-service;1," +
"getService,auto-addon-background-update-timer," +
PREF_ADDON_UPDATE_INTERVAL + ",86400" }],
notify: function aus_notify(aTimer) {
if (aTimer && !getPref("getBoolPref", PREF_ADDON_UPDATE_ENABLED, true))
return;
@ -152,7 +145,5 @@ UpdateCheckListener.prototype = {
}
};
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([AddonUpdateService]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([AddonUpdateService]);

Просмотреть файл

@ -46,8 +46,6 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
function AlertsService() { }
AlertsService.prototype = {
classDescription: "Mobile Alerts Service",
contractID: "@mozilla.org/system-alerts-service;1",
classID: Components.ID("{fe33c107-82a4-41d6-8c64-5353267e04c9}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAlertsService]),
@ -58,6 +56,4 @@ AlertsService.prototype = {
}
};
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([AlertsService]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([AlertsService]);

Просмотреть файл

@ -237,8 +237,6 @@ function AutoCompleteCache() {
}
AutoCompleteCache.prototype = {
classDescription: "AutoComplete Cache",
contractID: "@mozilla.org/autocomplete/search;1?name=history",
classID: Components.ID("{a65f9dca-62ab-4b36-a870-972927c78b56}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteSearch, Ci.nsIObserver, Ci.nsISupportsWeakReference]),
@ -310,17 +308,10 @@ BookmarkObserver.prototype = {
onItemVisited: function() {},
onItemMoved: function() {},
classDescription: "Bookmark observer used to update autocomplete cache",
classID: Components.ID("f570982e-4f15-48ab-b6a0-ed851ac551b2"),
contractID: "@mozilla.org/browser/autocomplete-observer;1",
// Registering in this category makes us get initialized only when
// the listener would be notified.
_xpcom_categories: [{ category: "bookmark-observers" }],
QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarkObserver])
};
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([AutoCompleteCache, BookmarkObserver]);
}
const components = [AutoCompleteCache, BookmarkObserver];
const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);

Просмотреть файл

@ -93,14 +93,8 @@ BrowserCLH.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
// XPCOMUtils factory
classDescription: "Command Line Handler",
contractID: "@mozilla.org/mobile/browser-clh;1",
classID: Components.ID("{be623d20-d305-11de-8a39-0800200c9a66}"),
_xpcom_categories: [{ category: "command-line-handler", entry: "m-browser" }],
};
var components = [ BrowserCLH ];
function NSGetModule(compMgr, fileSpec) {
return XPCOMUtils.generateModule(components);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);

Просмотреть файл

@ -55,18 +55,10 @@ function BrowserStartup() {
BrowserStartup.prototype = {
// for XPCOM
classDescription: "Mobile Browser Glue Service",
classID: Components.ID("{1d542abc-c88b-4636-a4ef-075b49806317}"),
contractID: "@mozilla.org/mobile/browser-startup;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
// get this contractID registered for certain categories via XPCOMUtils
_xpcom_categories: [
// make BrowserStartup a startup observer
{ category: "app-startup", service: true }
],
_xpcom_factory: BrowserStartupServiceFactory,
_init: function () {
@ -147,24 +139,4 @@ BrowserStartup.prototype = {
}
};
function BrowserStyleSheets() { }
BrowserStyleSheets.prototype = {
// This isn't a real component, we're just using categories to
// automatically add our stylesheets during module registration.
classDescription: "Mobile Browser Content Stylesheets",
classID: Components.ID("9e899d1c-dd83-44e9-ab01-3180b2c5b2b1"),
contractID: "@mozilla.org/mobile/browser-stylesheets;1",
QueryInterface: XPCOMUtils.generateQI([]),
_xpcom_categories: [{ category: "agent-style-sheets",
entry: "browser content stylesheet",
value: "chrome://browser/content/content.css"},
{ category: "agent-style-sheets",
entry: "browser cursor stylesheet",
value: "chrome://browser/content/cursor.css"}]
};
function NSGetModule(compMgr, fileSpec)
XPCOMUtils.generateModule([BrowserStartup, BrowserStyleSheets]);
const NSGetFactory = XPCOMUtils.generateNSGetFactory([BrowserStartup]);

Просмотреть файл

@ -44,9 +44,7 @@ function ContentDispatchChooser() {}
ContentDispatchChooser.prototype =
{
classDescription: "Used to handle different types of content",
classID: Components.ID("5a072a22-1e66-4100-afc1-07aed8b62fc5"),
contractID: "@mozilla.org/content-dispatch-chooser;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentDispatchChooser]),
@ -70,8 +68,5 @@ ContentDispatchChooser.prototype =
}
};
function NSGetModule(aCompMgr, aFileSpec)
{
return XPCOMUtils.generateModule([ContentDispatchChooser]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentDispatchChooser]);

Просмотреть файл

@ -48,16 +48,10 @@ const NS_APP_CACHE_PARENT_DIR = "cachePDir";
function DirectoryProvider() {}
DirectoryProvider.prototype = {
classDescription: "Directory Provider for special browser folders and files",
contractID: "@mozilla.org/browser/directory-provider;1",
classID: Components.ID("{ef0f7a87-c1ee-45a8-8d67-26f586e46a4b}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider]),
_xpcom_categories: [
{ category: "xpcom-directory-providers", entry: "browser-directory-provider" }
],
getFile: function(prop, persistent) {
if (prop == NS_APP_CACHE_PARENT_DIR) {
let dirsvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
@ -87,7 +81,5 @@ DirectoryProvider.prototype = {
}
};
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([DirectoryProvider]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([DirectoryProvider]);

Просмотреть файл

@ -46,8 +46,6 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
function DownloadManagerUI() { }
DownloadManagerUI.prototype = {
classDescription: "Download Manager UI",
contractID: "@mozilla.org/download-manager-ui;1",
classID: Components.ID("{93db15b1-b408-453e-9a2b-6619e168324a}"),
show: function show(aWindowContext, aID, aReason) {
@ -79,6 +77,4 @@ DownloadManagerUI.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDownloadManagerUI])
};
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([DownloadManagerUI]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadManagerUI]);

Просмотреть файл

@ -10,9 +10,7 @@ const kCountBeforeWeRemember = 5;
function GeolocationPrompt() {}
GeolocationPrompt.prototype = {
classDescription: "Geolocation Prompting Component",
classID: Components.ID("{C6E8C44D-9F39-4AF7-BCC0-76E38A8310F5}"),
contractID: "@mozilla.org/geolocation/prompt;1",
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGeolocationPrompt]),
@ -105,6 +103,4 @@ GeolocationPrompt.prototype = {
//module initialization
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([GeolocationPrompt]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([GeolocationPrompt]);

Просмотреть файл

@ -48,8 +48,6 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
function HelperAppLauncherDialog() { }
HelperAppLauncherDialog.prototype = {
classDescription: "HelperApp Launcher Dialog",
contractID: "@mozilla.org/helperapplauncherdialog;1",
classID: Components.ID("{e9d277a0-268a-4ec2-bb8c-10fdf3e44611}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIHelperAppLauncherDialog]),
@ -261,6 +259,4 @@ HelperAppLauncherDialog.prototype = {
}
};
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([HelperAppLauncherDialog]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([HelperAppLauncherDialog]);

Просмотреть файл

@ -54,6 +54,7 @@ EXTRA_PP_COMPONENTS = \
$(NULL)
EXTRA_COMPONENTS = \
MobileComponents.manifest \
BrowserStartup.js \
GeolocationPrompt.js \
AlertsService.js \

Просмотреть файл

@ -41,8 +41,6 @@ function PromptService() {
}
PromptService.prototype = {
classDescription: "Mobile Prompt Service",
contractID: "@mozilla.org/prompter;1",
classID: Components.ID("{9a61149b-2276-4a0a-b79c-be994ad106cf}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPromptFactory, Ci.nsIPromptService, Ci.nsIPromptService2]),
@ -571,15 +569,4 @@ XPCOMUtils.defineLazyGetter(PromptUtils, "bundle", function () {
return bundleService.createBundle("chrome://global/locale/commonDialogs.properties");
});
// Wrapper using the old embedding contractID, since it's already common in
// the addon ecosystem.
function EmbedPrompter() {}
EmbedPrompter.prototype = new PromptService();
EmbedPrompter.prototype.classDescription = "EmbedPrompter";
EmbedPrompter.prototype.contractID = "@mozilla.org/embedcomp/prompt-service;1"; // NS_PROMPTSERVICE_CONTRACTID
EmbedPrompter.prototype.classID = Components.ID("{ea13ce5b-9164-4df9-8713-9c1a0774f25e}");
//module initialization
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([PromptService, EmbedPrompter]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([PromptService]);

Просмотреть файл

@ -70,12 +70,8 @@ const STATE_QUITTING = -1;
function SessionStore() { }
SessionStore.prototype = {
classDescription: "Browser Session Store",
contractID: "@mozilla.org/mobile/sessionstore;1",
classID: Components.ID("{90c3dfaf-4245-46d3-9bc1-1d8251ff8c01}"),
_xpcom_categories: [{ category: "app-startup", service: true }],
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener, Ci.nsIObserver, Ci.nsISupportsWeakReference]),
_windows: {},
@ -411,6 +407,4 @@ SessionStore.prototype = {
}
};
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([SessionStore]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStore]);

Просмотреть файл

@ -49,8 +49,6 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY = "JavaScript global property";
var gStrBundleService = null;
function srGetStrBundle(path) {
if (!gStrBundleService) {
@ -175,14 +173,6 @@ Sidebar.prototype = {
// XPCOMUtils stuff
classID: Components.ID("{22117140-9c6e-11d3-aaf1-00805f8a4905}"),
className: "Sidebar JS Component",
contractID: "@mozilla.org/sidebar;1",
_xpcom_categories: [{ category: JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY,
entry: "sidebar"},
{ category: JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY,
entry: "external"}]
}
};
function NSGetModule(compMgr, fileSpec) {
return XPCOMUtils.generateModule([Sidebar]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([Sidebar]);

Просмотреть файл

@ -46,8 +46,6 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
function WebInstallPrompt() { }
WebInstallPrompt.prototype = {
classDescription: "XPInstall Dialog Service",
contractID: "@mozilla.org/addons/web-install-prompt;1",
classID: Components.ID("{c1242012-27d8-477e-a0f1-0b098ffc329b}"),
QueryInterface: XPCOMUtils.generateQI([Ci.amIWebInstallPrompt]),
@ -80,6 +78,4 @@ WebInstallPrompt.prototype = {
}
};
function NSGetModule(aCompMgr, aFileSpec) {
return XPCOMUtils.generateModule([WebInstallPrompt]);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory([WebInstallPrompt]);

Просмотреть файл

@ -55,7 +55,7 @@
#include "nsStringAPI.h"
#include "nsIPhoneSupport.h"
#include "nsIGenericFactory.h"
#include "mozilla/ModuleUtils.h"
class nsPhoneSupport : public nsIPhoneSupport
{
@ -441,16 +441,22 @@ nsPhoneSupport::RestoreDefaultBrowser()
#define nsPhoneSupport_ContractID "@mozilla.org/phone/support;1"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPhoneSupport)
NS_DEFINE_NAMED_CID(nsPhoneSupport_CID);
static const nsModuleComponentInfo components[] =
{
{ "Phone Support",
nsPhoneSupport_CID,
nsPhoneSupport_ContractID,
nsPhoneSupportConstructor,
nsnull,
nsnull
}
static const mozilla::Module::CIDEntry kPhoneCIDs[] = {
{ &knsPhoneSupport_CID, false, NULL, nsPhoneSupportConstructor },
{ NULL }
};
NS_IMPL_NSGETMODULE(nsPhoneSupportModule, components)
static const mozilla::Module::ContractIDEntry kPhoneContracts[] = {
{ nsPhoneSupport_ContractID, &knsPhoneSupport_CID },
{ NULL }
};
static const mozilla::Module kPhoneModule = {
mozilla::Module::kVersion,
kPhoneCIDs,
kPhoneContracts
};
NSMODULE_DEFN(nsPhoneSupportModule) = &kPhoneModule;

Просмотреть файл

@ -44,6 +44,7 @@ include $(DEPTH)/config/autoconf.mk
MODULE = protocols
EXTRA_COMPONENTS = nsTelProtocolHandler.manifest
EXTRA_PP_COMPONENTS = nsTelProtocolHandler.js
ifdef WINCE

Просмотреть файл

@ -1,11 +1,6 @@
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const kSCHEME = "tel";
const kPROTOCOL_NAME = "Tel Protocol";
const kPROTOCOL_CONTRACTID = "@mozilla.org/network/protocol;1?name=" + kSCHEME;
const kPROTOCOL_CID = Components.ID("d4bc06cc-fa9f-48ce-98e4-5326ca96ba28");
// Mozilla defined
const kSIMPLEURI_CONTRACTID = "@mozilla.org/network/simple-uri;1";
@ -22,12 +17,10 @@ function TelProtocol()
TelProtocol.prototype =
{
classDescription: "Handler for tel URIs",
classID: Components.ID(kPROTOCOL_CID),
classID: Components.ID("d4bc06cc-fa9f-48ce-98e4-5326ca96ba28"),
contractID: kPROTOCOL_CONTRACTID,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]),
scheme: kSCHEME,
defaultPort: -1,
protocolFlags: Ci.nsIProtocolHandler.URI_NORELATIVE |
@ -89,9 +82,7 @@ TelProtocol.prototype =
};
var components = [TelProtocol];
function NSGetModule(compMgr, fileSpec) {
return XPCOMUtils.generateModule(components);
}
const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
#ifdef WINCE
function nsWinceTelChannel(URI, phoneNumber)