Files
palemoon27/docshell/build/nsDocShellModule.cpp
T
roytam1 664ef9175d import changes from `dev' branch of rmottola/Arctic-Fox:
- enable shadow warnings (93e0fb3cf8)
- more bits of  Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS (f07e6eca96)
- Bug 1111892 - Ensure gdk_ungrab_pointer is always called in the correct process r=jimm (8bf40d8add)
- Bug 1220344 - remote some of nsSystemInfo to make it e10s ready on Android r=nchen,froydnj (365e961dfb)
- bug 1190018 - External protocol handlers don't work in e10s r=mrbkap (ff4567d517)
- Bug 1225618 - Do not capture stacks for cycle collection timeline markers; r=vporof (d734ca9d26)
- Bug 1218315 - Replace NS_LITERAL_STRING(...).get() with MOZ_UTF16(...) on xpcom. r=nfroyd (5cff917319)
- Bug 1218315 - Use L"..." instead of MOZ_UTF16(...) for MSVS2015. r=nfroyd (9f8b88f428)
- Bug 1199592 - support TV device type in UA string. r=fabrice. (2eecf7f3b4)
- Bug 1215723 - Part 1: Make DataStorage a singleton for each file name; r=keeler (be2e5947f1)
- Bug 1167693 - Ensure device and vendor IDs are zero-padded. r=mstange (6e583cbf71)
- Bug 1186817 - Replace nsBaseHashtable::EnumerateRead() calls in security/ with iterators. r=keeler (4a14f547a7)
- Bug 1215723 - Part 2: Initialize DataStorage items in the content process from the data in the parent; r=keeler (3a4d3ec7d5)
- Bug 1215723 - Part 3: Propagate updates to DataStorage from the parent process to the content processes; r=keeler (2140b412eb)
- Bug 1215723 - Part 4: Make isSecureHost and isSecureURI usable from the content process; r=keeler (c8b786ca1b)
- Bug 1215723 - Part 5: Add an automated test; r=keeler (012e820385)
- Bug 1154184 - Don't use Linux sandbox gtest dir if not building tests. r=gps (2993e27d44)
- Bug 930258 - Part 1: The file broker, and unit tests for it. r=kang f=froydnj (d3e8cab30d)
- Bug 930258 - Part 2: seccomp-bpf integration. r=kang (a40ef5e566)
- Bug 930258 - Part 3: a file broker policy for the B2G emulator. r=kang (2c0c3d55cf)
- Bug 930258 - Part 4: the PContent changes that connect the broker to its sandboxed client. r=kang r=billm (1206c3a20c)
- Bug 1168251 - Do a partial recursion when doing make -C some/path compile. r=gps (a6733048fc)
- Bug 1194951 - Suppress warnings in third-party code: pocketsphinx and sphinxbase. r=kdavis (4f679d6a1e)
- Bug 1195186 - Build media/pocketsphinx in unified mode. r=kdavis (6e6bb419e0)
- Bug 1203005 - Remove all traces of -Wdeclaration-after-statement. r=glandium. (a66d7a4760)
- bits of  Bug 1211568, land NSS_3_21_RTM (6b81926cd3)
- Bug 947753 - Make sure nsChildView::ComputeShouldAccelerate returns true even if it's called before layout lets the window know about whether it's transparent. r=smichaud (0d2980b44f)
- Bug 1162649 - Don't call setOpaque:NO or setHasShadow:NO for non-popup windows;r=mstange (6353bd2e96)
- Backed out changeset 2e731191c692 (bug 1189565) for causing bug 1201053 a=backout (e4bc37c823)
- Bug 1174703 - Add GLContextEAGL and GLContextProviderEAGL as an OpenGL provider for iOS. r=jgilbert (64c6538d7d)
- Bug 1184402 - Reset format usage authority on context lose/restore. r=jgilbert (3df2278888)
- more dupes... hackish (f432375460)
- Bug 1007975 - div with display:table exposes table semantics r=surkov (f3b389dcce)
- Bug 1159034 - Test uninitialized buffer data. - r=dvander Bug 1147441 - Add SharedArrayBuffer support to WebGL and WebGL 2. r=jgilbert, r=bzbarsky (a151e77beb)
- Bug 1184402 - Part 1: Rename GetInfo() to GetUsage() for obtaining FormatUsageInfo. r=jgilbert (efbfe39a2e)
- Bug 1184402 - Part 2: Added luminance float effective formats (2cb792990d)
- Bug 1184402 - Part 3: Add WebGL1 formats when enabling extensions. r=jgilbert (aba6beb541)
- Bug 1184402 - Part 4: Use WebGLFormat for validation in RenderbufferStorage_base. r=jgilbert (704c86386f)
- Bug 1193070 - Implement GetFramebufferAttachmentParameter. r=jgilbert (ef51efdce1)
- Bug 1188195 - always initialize WebGL2 BlitFramebuffer src/dst formats to some value. r=jgilbert (694a4d87a1)
- Bug 1143876 - Treat invalidate-framebuffer as optional for WebGL2. - r=kamidphish (53d8ef5a3f)
- Bug 1170845 - Remove WebGL2() exclusion on instanced draw divisor check. r=jgilbert (cd8d1375b3)
- Bug 1192989 - Simplify handling by ifdefing in all.js. - r=kamidphish (32a26b46c8)
- Bug 1179556 - Only call EnsureColorAttachPoints with a color attachment. r=jgilbert (8791f2e34a)
- Bug 1170893 - Return null for invalid internal format. r=kamidphish (425657b6b6)
- Bug 1225782 - Removes GlobalPropertiesAreOwn(). r=bz (a6ca6fd503)
- Bug 1225381 - ensure mozCurrentTransform is finite. r=jmuizelaar (c009040dca)
- Bug 1223740 - enforce max surface size for DrawTargetSkia. r=bas (505fe7ac3b)
- Bug 1059014 (part 2) - Remove support for reflow on zoom event pending. r=dbaron. (be2ae37e94)
- Bug 1059014 (part 3) - Remove support for pausing and resuming painting. r=dbaron. (35979215f3)
2023-02-06 08:55:00 +08:00

222 lines
9.4 KiB
C++

/* -*- 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 "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 },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "plugins", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "mozilla", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "logo", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "buildconfig", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "license", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "memory", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "performance", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "addons", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "newaddon", &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 "networking", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "webrtc", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "srcdoc", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "serviceworkers", &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;