diff options
Diffstat (limited to 'docshell/build')
-rw-r--r-- | docshell/build/moz.build | 28 | ||||
-rw-r--r-- | docshell/build/nsDocShellCID.h | 90 | ||||
-rw-r--r-- | docshell/build/nsDocShellModule.cpp | 228 |
3 files changed, 346 insertions, 0 deletions
diff --git a/docshell/build/moz.build b/docshell/build/moz.build new file mode 100644 index 000000000..130ec8736 --- /dev/null +++ b/docshell/build/moz.build @@ -0,0 +1,28 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +EXPORTS += [ + 'nsDocShellCID.h', +] + +SOURCES += [ + 'nsDocShellModule.cpp', +] + +LOCAL_INCLUDES += [ + '/docshell/base', + '/docshell/shistory', + '/uriloader/base', + '/uriloader/exthandler', + '/uriloader/prefetch', +] + +include('/ipc/chromium/chromium-config.mozbuild') + +FINAL_LIBRARY = 'xul' + +if CONFIG['MOZ_DEVTOOLS'] == 'all': + DEFINES['MOZ_DEVTOOLS_ALL'] = True diff --git a/docshell/build/nsDocShellCID.h b/docshell/build/nsDocShellCID.h new file mode 100644 index 000000000..85080c3cb --- /dev/null +++ b/docshell/build/nsDocShellCID.h @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsDocShellCID_h__ +#define nsDocShellCID_h__ + +#define NS_GLOBALHISTORY2_CONTRACTID "@mozilla.org/browser/global-history;2" + +/** + * A contract for a service that will track download history. This can be + * overridden by embedders if they would like to track additional information + * about downloads. + * + * @implements nsIDownloadHistory + */ +#define NS_DOWNLOADHISTORY_CONTRACTID "@mozilla.org/browser/download-history;1" + +/** + * A contract that can be used to get a service that provides + * meta-information about nsIWebNavigation objects' capabilities. + * @implements nsIWebNavigationInfo + */ +#define NS_WEBNAVIGATION_INFO_CONTRACTID "@mozilla.org/webnavigation-info;1" + +/** + * Class and contract ID for the docshell. This is the container for a web + * navigation context. It implements too many interfaces to count, and the + * exact ones keep changing; if they stabilize somewhat that will get + * documented. + */ +#define NS_DOCSHELL_CID \ + { 0xf1eac762, 0x87e9, 0x11d3, \ + { 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c } } +#define NS_DOCSHELL_CONTRACTID "@mozilla.org/docshell/html;1" + +/** + * Contract ID to obtain the IHistory interface. This is a non-scriptable + * interface used to interact with history in an asynchronous manner. + */ +#define NS_IHISTORY_CONTRACTID "@mozilla.org/browser/history;1" + +/** + * A contract for a service that is used for finding + * platform-specific applications for handling particular URLs. + * + * @implements nsIExternalURLHandlerService + */ +#define NS_EXTERNALURLHANDLERSERVICE_CONTRACTID \ + "@mozilla.org/uriloader/external-url-handler-service;1" + +/** + * An observer service topic that can be listened to to catch creation + * of content browsing areas (both toplevel ones and subframes). The + * subject of the notification will be the nsIWebNavigation being + * created. At this time the additional data wstring is not defined + * to be anything in particular. + */ +#define NS_WEBNAVIGATION_CREATE "webnavigation-create" + +/** + * An observer service topic that can be listened to to catch creation + * of chrome browsing areas (both toplevel ones and subframes). The + * subject of the notification will be the nsIWebNavigation being + * created. At this time the additional data wstring is not defined + * to be anything in particular. + */ +#define NS_CHROME_WEBNAVIGATION_CREATE "chrome-webnavigation-create" + +/** + * An observer service topic that can be listened to to catch destruction + * of content browsing areas (both toplevel ones and subframes). The + * subject of the notification will be the nsIWebNavigation being + * destroyed. At this time the additional data wstring is not defined + * to be anything in particular. + */ +#define NS_WEBNAVIGATION_DESTROY "webnavigation-destroy" + +/** + * An observer service topic that can be listened to to catch destruction + * of chrome browsing areas (both toplevel ones and subframes). The + * subject of the notification will be the nsIWebNavigation being + * destroyed. At this time the additional data wstring is not defined + * to be anything in particular. + */ +#define NS_CHROME_WEBNAVIGATION_DESTROY "chrome-webnavigation-destroy" + +#endif // nsDocShellCID_h__ diff --git a/docshell/build/nsDocShellModule.cpp b/docshell/build/nsDocShellModule.cpp new file mode 100644 index 000000000..1e62e1479 --- /dev/null +++ b/docshell/build/nsDocShellModule.cpp @@ -0,0 +1,228 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "mozilla/ModuleUtils.h" +#include "nsDocShellCID.h" + +#include "nsDocShell.h" +#include "nsDefaultURIFixup.h" +#include "nsWebNavigationInfo.h" +#include "nsAboutRedirector.h" +#include "nsCDefaultURIFixup.h" + +// uriloader +#include "nsURILoader.h" +#include "nsDocLoader.h" +#include "nsOSHelperAppService.h" +#include "nsExternalProtocolHandler.h" +#include "nsPrefetchService.h" +#include "nsOfflineCacheUpdate.h" +#include "nsLocalHandlerApp.h" +#include "ContentHandlerService.h" +#ifdef MOZ_ENABLE_DBUS +#include "nsDBusHandlerApp.h" +#endif +#if defined(MOZ_WIDGET_ANDROID) +#include "nsExternalSharingAppService.h" +#include "nsExternalURLHandlerService.h" +#endif + +// session history +#include "nsSHEntry.h" +#include "nsSHEntryShared.h" +#include "nsSHistory.h" +#include "nsSHTransaction.h" + +// download history +#include "nsDownloadHistory.h" + +using mozilla::dom::ContentHandlerService; + +static bool gInitialized = false; + +// The one time initialization for this module +static nsresult +Initialize() +{ + NS_PRECONDITION(!gInitialized, "docshell module already initialized"); + if (gInitialized) { + return NS_OK; + } + gInitialized = true; + + nsresult rv = nsSHistory::Startup(); + NS_ENSURE_SUCCESS(rv, rv); + + return NS_OK; +} + +static void +Shutdown() +{ + nsSHistory::Shutdown(); + nsSHEntryShared::Shutdown(); + gInitialized = false; +} + +// docshell +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDocShell, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDefaultURIFixup) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWebNavigationInfo, Init) + +// uriloader +NS_GENERIC_FACTORY_CONSTRUCTOR(nsURILoader) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDocLoader, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsOSHelperAppService, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalProtocolHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefetchService, Init) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsOfflineCacheUpdateService, + nsOfflineCacheUpdateService::GetInstance) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsOfflineCacheUpdate) +NS_GENERIC_FACTORY_CONSTRUCTOR(PlatformLocalHandlerApp_t) +#ifdef MOZ_ENABLE_DBUS +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDBusHandlerApp) +#endif +#if defined(MOZ_WIDGET_ANDROID) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalSharingAppService) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalURLHandlerService) +#endif +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ContentHandlerService, Init) + +// session history +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSHEntry) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSHTransaction) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSHistory) + +// download history +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadHistory) + +NS_DEFINE_NAMED_CID(NS_DOCSHELL_CID); +NS_DEFINE_NAMED_CID(NS_DEFAULTURIFIXUP_CID); +NS_DEFINE_NAMED_CID(NS_WEBNAVIGATION_INFO_CID); +NS_DEFINE_NAMED_CID(NS_ABOUT_REDIRECTOR_MODULE_CID); +NS_DEFINE_NAMED_CID(NS_URI_LOADER_CID); +NS_DEFINE_NAMED_CID(NS_DOCUMENTLOADER_SERVICE_CID); +NS_DEFINE_NAMED_CID(NS_EXTERNALHELPERAPPSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_EXTERNALPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_PREFETCHSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_OFFLINECACHEUPDATESERVICE_CID); +NS_DEFINE_NAMED_CID(NS_OFFLINECACHEUPDATE_CID); +NS_DEFINE_NAMED_CID(NS_LOCALHANDLERAPP_CID); +#ifdef MOZ_ENABLE_DBUS +NS_DEFINE_NAMED_CID(NS_DBUSHANDLERAPP_CID); +#endif +#if defined(MOZ_WIDGET_ANDROID) +NS_DEFINE_NAMED_CID(NS_EXTERNALSHARINGAPPSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_EXTERNALURLHANDLERSERVICE_CID); +#endif +NS_DEFINE_NAMED_CID(NS_SHENTRY_CID); +NS_DEFINE_NAMED_CID(NS_SHTRANSACTION_CID); +NS_DEFINE_NAMED_CID(NS_SHISTORY_CID); +NS_DEFINE_NAMED_CID(NS_SHISTORY_INTERNAL_CID); +NS_DEFINE_NAMED_CID(NS_DOWNLOADHISTORY_CID); +NS_DEFINE_NAMED_CID(NS_CONTENTHANDLERSERVICE_CID); + +const mozilla::Module::CIDEntry kDocShellCIDs[] = { + { &kNS_DOCSHELL_CID, false, nullptr, nsDocShellConstructor }, + { &kNS_DEFAULTURIFIXUP_CID, false, nullptr, nsDefaultURIFixupConstructor }, + { &kNS_WEBNAVIGATION_INFO_CID, false, nullptr, nsWebNavigationInfoConstructor }, + { &kNS_ABOUT_REDIRECTOR_MODULE_CID, false, nullptr, nsAboutRedirector::Create }, + { &kNS_URI_LOADER_CID, false, nullptr, nsURILoaderConstructor }, + { &kNS_DOCUMENTLOADER_SERVICE_CID, false, nullptr, nsDocLoaderConstructor }, + { &kNS_EXTERNALHELPERAPPSERVICE_CID, false, nullptr, nsOSHelperAppServiceConstructor }, + { &kNS_CONTENTHANDLERSERVICE_CID, false, nullptr, ContentHandlerServiceConstructor, + mozilla::Module::CONTENT_PROCESS_ONLY }, + { &kNS_EXTERNALPROTOCOLHANDLER_CID, false, nullptr, nsExternalProtocolHandlerConstructor }, + { &kNS_PREFETCHSERVICE_CID, false, nullptr, nsPrefetchServiceConstructor }, + { &kNS_OFFLINECACHEUPDATESERVICE_CID, false, nullptr, nsOfflineCacheUpdateServiceConstructor }, + { &kNS_OFFLINECACHEUPDATE_CID, false, nullptr, nsOfflineCacheUpdateConstructor }, + { &kNS_LOCALHANDLERAPP_CID, false, nullptr, PlatformLocalHandlerApp_tConstructor }, +#ifdef MOZ_ENABLE_DBUS + { &kNS_DBUSHANDLERAPP_CID, false, nullptr, nsDBusHandlerAppConstructor }, +#endif +#if defined(MOZ_WIDGET_ANDROID) + { &kNS_EXTERNALSHARINGAPPSERVICE_CID, false, nullptr, nsExternalSharingAppServiceConstructor }, + { &kNS_EXTERNALURLHANDLERSERVICE_CID, false, nullptr, nsExternalURLHandlerServiceConstructor }, +#endif + { &kNS_SHENTRY_CID, false, nullptr, nsSHEntryConstructor }, + { &kNS_SHTRANSACTION_CID, false, nullptr, nsSHTransactionConstructor }, + { &kNS_SHISTORY_CID, false, nullptr, nsSHistoryConstructor }, + { &kNS_SHISTORY_INTERNAL_CID, false, nullptr, nsSHistoryConstructor }, + { &kNS_DOWNLOADHISTORY_CID, false, nullptr, nsDownloadHistoryConstructor }, + { nullptr } +}; + +const mozilla::Module::ContractIDEntry kDocShellContracts[] = { + { "@mozilla.org/docshell;1", &kNS_DOCSHELL_CID }, + { NS_URIFIXUP_CONTRACTID, &kNS_DEFAULTURIFIXUP_CID }, + { NS_WEBNAVIGATION_INFO_CONTRACTID, &kNS_WEBNAVIGATION_INFO_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "about", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "addons", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "buildconfig", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "checkerboard", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, +#ifdef MOZ_CRASHREPORTER + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashes", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, +#endif + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "credits", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, +#ifdef MOZ_DEVTOOLS_ALL + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "debugging", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, +#endif + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "license", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "logo", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "memory", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "mozilla", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "networking", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "newaddon", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "performance", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "plugins", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "serviceworkers", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, +#ifndef ANDROID + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "profiles", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, +#endif + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "srcdoc", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "support", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "telemetry", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "webrtc", &kNS_ABOUT_REDIRECTOR_MODULE_CID }, + { NS_URI_LOADER_CONTRACTID, &kNS_URI_LOADER_CID }, + { NS_DOCUMENTLOADER_SERVICE_CONTRACTID, &kNS_DOCUMENTLOADER_SERVICE_CID }, + { NS_HANDLERSERVICE_CONTRACTID, &kNS_CONTENTHANDLERSERVICE_CID, mozilla::Module::CONTENT_PROCESS_ONLY }, + { NS_EXTERNALHELPERAPPSERVICE_CONTRACTID, &kNS_EXTERNALHELPERAPPSERVICE_CID }, + { NS_EXTERNALPROTOCOLSERVICE_CONTRACTID, &kNS_EXTERNALHELPERAPPSERVICE_CID }, + { NS_MIMESERVICE_CONTRACTID, &kNS_EXTERNALHELPERAPPSERVICE_CID }, + { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"default", &kNS_EXTERNALPROTOCOLHANDLER_CID }, + { NS_PREFETCHSERVICE_CONTRACTID, &kNS_PREFETCHSERVICE_CID }, + { NS_OFFLINECACHEUPDATESERVICE_CONTRACTID, &kNS_OFFLINECACHEUPDATESERVICE_CID }, + { NS_OFFLINECACHEUPDATE_CONTRACTID, &kNS_OFFLINECACHEUPDATE_CID }, + { NS_LOCALHANDLERAPP_CONTRACTID, &kNS_LOCALHANDLERAPP_CID }, +#ifdef MOZ_ENABLE_DBUS + { NS_DBUSHANDLERAPP_CONTRACTID, &kNS_DBUSHANDLERAPP_CID }, +#endif +#if defined(MOZ_WIDGET_ANDROID) + { NS_EXTERNALSHARINGAPPSERVICE_CONTRACTID, &kNS_EXTERNALSHARINGAPPSERVICE_CID }, + { NS_EXTERNALURLHANDLERSERVICE_CONTRACTID, &kNS_EXTERNALURLHANDLERSERVICE_CID }, +#endif + { NS_SHENTRY_CONTRACTID, &kNS_SHENTRY_CID }, + { NS_SHTRANSACTION_CONTRACTID, &kNS_SHTRANSACTION_CID }, + { NS_SHISTORY_CONTRACTID, &kNS_SHISTORY_CID }, + { NS_SHISTORY_INTERNAL_CONTRACTID, &kNS_SHISTORY_INTERNAL_CID }, + { NS_DOWNLOADHISTORY_CONTRACTID, &kNS_DOWNLOADHISTORY_CID }, + { nullptr } +}; + +static const mozilla::Module kDocShellModule = { + mozilla::Module::kVersion, + kDocShellCIDs, + kDocShellContracts, + nullptr, + nullptr, + Initialize, + Shutdown +}; + +NSMODULE_DEFN(docshell_provider) = &kDocShellModule; |