Files
palemoon27/chrome/nsChromeRegistryContent.cpp
T
roytam1 c0011dadb2 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1160013 CachePushStreamChild should hold the parent DOM object alive. r=baku (07626c5e44)
- Bug 1179772 Make Cache API honor devtools SW testing flag in SW itself. r=ehsan (4d915be43c)
- Bug 1181577 Delay creation of QuotaInitRunnable until Cache Context actually started. r=ehsan (9991aafa07)
- Bug 1210128 Ensure Cache API context internal state is consistent when shutdown during initialization. r=janv (25fbcf3136)
- Bug 1138916 Fix Cache::MatchAll() assertion in WorkerFeature handling. r=baku (73fe25803b)
- Bug 1186312 - Cache API should not accept system principals for child processes. r=bkelly (c140f627f8)
- align (acb75b3a8d)
- Bug 1215290 Cache API should store unfiltered Response URL. r=ehsan (55238dd04a)
- Bug 1217501 P4 Fill headers before setting guard when reading response from Cache. r=ehsan (787cb31d84)
- bits of  Bug 1202902 (82e2e451cc)
- Bug 1147329 - Handle in-process case for Cut/Copy/Paste feature. r=kanru (66cabbf705)
- Bug 1199161 - Add selectedTextContent to CaretStateChangedEvent. r=kanru, sr=smaug (5eb99e303b)
- Bug 1217515 - Clean up the way touch event support is configured. r=roc (24a7db4a42)
- Bug 1216937 - Assign default URL for mozbrowseropenwindow event. r=smaug (fc7aaa533b)
- Bug 1101115, implement nsChromeRegistryContent::IsLocaleRTL so that file directory view works in e10s rtl mode, r=bsmedberg (c0eb12391f)
- Bug 1186787 (part 1) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators. r=froydnj. (2508253415)
- Bug 1186787 (part 2) - Replace nsBaseHashtable::EnumerateRead() calls in chrome/ with iterators. r=froydnj. (193c37c478)
- Bug 1170207 - allow overrides of chrome://../skin/ URIs with other chrome://../skin/ URIs within skin manifests, r=bsmedberg (3c24e2006c)
- Bug 1210463 - part 3 - Remove the very obsolete NS_IMPL_MOZILLA192_NSGETMODULE. r=froydnj (c7300c145b)
- Bug 1210463 - part 1 - Remove some unneeded null checks on new in ModuleUtils. r=froydnj (73affb8e34)
- Bug 1210463 - part 2 - Use some smart pointers in ModuleUtils.h. r=froydnj (f5eeb12cb3)
- Bug 1210463 - part 2 - Use some smart pointers in ModuleUtils.h. r=froydnj (788f944a41)
- Bug 1215143 - FF Android VR returns orientation that is 90deg off on x-axis. r=vlad (fc0d86c800)
- Bug 1166667 - Remove LangGroupFromUnicodeRange due to unused. r=jfkthame (e3bb039e41)
- Bug 1119062 - enable unicode-range in release builds. r=dbaron (8d48c7ab14)
- bits of 1117227 in headers (ad920e2094)
- Bug 1220020. Recompute the current animated geometry root when a child scroll frame forces us to be layerized, and therefore turns us into an animated geometry root. r=mstange (4cfb015eb7)
- Bug 1220114. Part 1. Change ScrollFrameHelper::DecideScrollableLayer to recompute the current animated geometry root any time mWillBuildScrollableLayer changes in addition to when usingDisplayPort changes. r=mstange (9e8512babe)
- Bug 1220114. Part 2. If a scroll frame is forced to layerize because of an active descendant scroll frame then set a displayport on the ancestor scroll frame so that next paint we don't have to force layerization after the fact and we can do a fully proper paint. r=mstange (a3d7734f75)
- Bug 1228357 - When saving/restoring a scrollframe's state, only save/restore resolution for the root scrollframe. r=roc (7018d5bcae)
- Bug 1224307 - Fix page scrolling for non-full-width fixed headers/footers [r=tn]  Please enter the commit message for your changes. Lines starting (55eebe3d49)
- Bug 1081272 - Include position and transform when computing header/footer size [r=tn] (c91104a099)
- Bug 1145546: take auto-direction into account in GetScrolledRect, r=jfkthame (a5bf400639)
- spaces (4a2918cb4c)
- Bug 1225376 part 1 - [css-align] Don't compute left/right to start in the style system anymore (due to pending spec change). Map the used value instead (in layout). r=dholbert (677b9eba16)
- Bug 1225376 part 2 - [css-align] Add mochitests for align/justify-items/self/content computed values. (580ef62eb6)
- Bug 1225376 part 3 - [css-grid] Crashtest. (3e5b06dce4)
- Bug 1148515 - Do the scrollbar thumb layer wrapping in nsSliderFrameso that the thumb's event region is wrapped, too. r=tn (0ff596193e)
- Bug 1133732. Header include got missed in rebase. on CLOSED TREE (b870504066)
- Bug 1133732. Make button box frames listen for blurs so they de-activate on blur. r=smaug (5c6274f99d)
- Bug 1170052 part 1: Refactor nsImageBoxFrame::PaintImage() so its final failure case is an early return. r=seth (7308f3f32e)
- Bug 1170052 part 2: Support object-fit & object-position on XUL <image src=""> elements. r=seth (74ab4c8813)
- Bug 1170052 part 3: Add scripts to generate reftests for object-fit/object-position applied to XUL <image>. (NPOTB) (5b1e1b6b90)
- Bug 1170052 part 4: Add reftests for object-fit/object-position on XUL <image> element (as modified copies of existing <img> tests). (test-only) (7f678646e8)
- Bug 1170052 part 5: Mark new reftests as "skip-if(Mulet)" to avoid impacting reftest chunking on that platform in a way that makes SVG reftests fail mysteriously. (d6c7e5ff05)
- Bug 1170052 part 6: Skip new XUL reftests on B2G Emulator as well, since XUL reftests trigger error pages on that platform. (3f4ddeddcd)
- Bug 1194493 - Ensure the 'mVertical' flag is set appropriately on the nsFontMetrics we use to draw text for an nsTextBoxFrame. r=smontagu (a6eed3f9b8)
- Bug 1155359 - Set NS_FRAME_IS_BIDI on nsTextBoxFrame if text direction is set to RTL r=roc (2715d47271)
- crash reporter (015ee49944)
2023-03-20 16:03:44 +08:00

316 lines
8.5 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 sts=2 sw=2 et 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 "RegistryMessageUtils.h"
#include "nsChromeRegistryContent.h"
#include "nsString.h"
#include "nsNetUtil.h"
#include "nsIResProtocolHandler.h"
nsChromeRegistryContent::nsChromeRegistryContent()
{
}
void
nsChromeRegistryContent::RegisterRemoteChrome(
const InfallibleTArray<ChromePackage>& aPackages,
const InfallibleTArray<SubstitutionMapping>& aSubstitutions,
const InfallibleTArray<OverrideMapping>& aOverrides,
const nsACString& aLocale,
bool aReset)
{
MOZ_ASSERT(aReset || mLocale.IsEmpty(),
"RegisterChrome twice?");
if (aReset) {
mPackagesHash.Clear();
mOverrideTable.Clear();
// XXX Can't clear resources.
}
for (uint32_t i = aPackages.Length(); i > 0; ) {
--i;
RegisterPackage(aPackages[i]);
}
for (uint32_t i = aSubstitutions.Length(); i > 0; ) {
--i;
RegisterSubstitution(aSubstitutions[i]);
}
for (uint32_t i = aOverrides.Length(); i > 0; ) {
--i;
RegisterOverride(aOverrides[i]);
}
mLocale = aLocale;
}
void
nsChromeRegistryContent::RegisterPackage(const ChromePackage& aPackage)
{
nsCOMPtr<nsIIOService> io (do_GetIOService());
if (!io)
return;
nsCOMPtr<nsIURI> content, locale, skin;
if (aPackage.contentBaseURI.spec.Length()) {
nsresult rv = NS_NewURI(getter_AddRefs(content),
aPackage.contentBaseURI.spec,
aPackage.contentBaseURI.charset.get(),
nullptr, io);
if (NS_FAILED(rv))
return;
}
if (aPackage.localeBaseURI.spec.Length()) {
nsresult rv = NS_NewURI(getter_AddRefs(locale),
aPackage.localeBaseURI.spec,
aPackage.localeBaseURI.charset.get(),
nullptr, io);
if (NS_FAILED(rv))
return;
}
if (aPackage.skinBaseURI.spec.Length()) {
nsCOMPtr<nsIURI> skinBaseURI;
nsresult rv = NS_NewURI(getter_AddRefs(skin),
aPackage.skinBaseURI.spec,
aPackage.skinBaseURI.charset.get(),
nullptr, io);
if (NS_FAILED(rv))
return;
}
PackageEntry* entry = new PackageEntry;
entry->flags = aPackage.flags;
entry->contentBaseURI = content;
entry->localeBaseURI = locale;
entry->skinBaseURI = skin;
mPackagesHash.Put(aPackage.package, entry);
}
void
nsChromeRegistryContent::RegisterSubstitution(const SubstitutionMapping& aSubstitution)
{
nsCOMPtr<nsIIOService> io (do_GetIOService());
if (!io)
return;
nsCOMPtr<nsIProtocolHandler> ph;
nsresult rv = io->GetProtocolHandler(aSubstitution.scheme.get(), getter_AddRefs(ph));
if (NS_FAILED(rv))
return;
nsCOMPtr<nsISubstitutingProtocolHandler> sph (do_QueryInterface(ph));
if (!sph)
return;
nsCOMPtr<nsIURI> resolvedURI;
if (aSubstitution.resolvedURI.spec.Length()) {
nsresult rv = NS_NewURI(getter_AddRefs(resolvedURI),
aSubstitution.resolvedURI.spec,
aSubstitution.resolvedURI.charset.get(),
nullptr, io);
if (NS_FAILED(rv))
return;
}
rv = sph->SetSubstitution(aSubstitution.path, resolvedURI);
if (NS_FAILED(rv))
return;
}
void
nsChromeRegistryContent::RegisterOverride(const OverrideMapping& aOverride)
{
nsCOMPtr<nsIIOService> io (do_GetIOService());
if (!io)
return;
nsCOMPtr<nsIURI> chromeURI, overrideURI;
nsresult rv = NS_NewURI(getter_AddRefs(chromeURI),
aOverride.originalURI.spec,
aOverride.originalURI.charset.get(),
nullptr, io);
if (NS_FAILED(rv))
return;
rv = NS_NewURI(getter_AddRefs(overrideURI), aOverride.overrideURI.spec,
aOverride.overrideURI.charset.get(), nullptr, io);
if (NS_FAILED(rv))
return;
mOverrideTable.Put(chromeURI, overrideURI);
}
nsIURI*
nsChromeRegistryContent::GetBaseURIFromPackage(const nsCString& aPackage,
const nsCString& aProvider,
const nsCString& aPath)
{
PackageEntry* entry;
if (!mPackagesHash.Get(aPackage, &entry)) {
return nullptr;
}
if (aProvider.EqualsLiteral("locale")) {
return entry->localeBaseURI;
}
else if (aProvider.EqualsLiteral("skin")) {
return entry->skinBaseURI;
}
else if (aProvider.EqualsLiteral("content")) {
return entry->contentBaseURI;
}
return nullptr;
}
nsresult
nsChromeRegistryContent::GetFlagsFromPackage(const nsCString& aPackage,
uint32_t* aFlags)
{
PackageEntry* entry;
if (!mPackagesHash.Get(aPackage, &entry)) {
return NS_ERROR_FAILURE;
}
*aFlags = entry->flags;
return NS_OK;
}
// All functions following only make sense in chrome, and therefore assert
#define CONTENT_NOTREACHED() \
NS_NOTREACHED("Content should not be calling this")
#define CONTENT_NOT_IMPLEMENTED() \
CONTENT_NOTREACHED(); \
return NS_ERROR_NOT_IMPLEMENTED;
NS_IMETHODIMP
nsChromeRegistryContent::GetLocalesForPackage(const nsACString& aPackage,
nsIUTF8StringEnumerator* *aResult)
{
CONTENT_NOT_IMPLEMENTED();
}
NS_IMETHODIMP
nsChromeRegistryContent::CheckForOSAccessibility()
{
CONTENT_NOT_IMPLEMENTED();
}
NS_IMETHODIMP
nsChromeRegistryContent::CheckForNewChrome()
{
CONTENT_NOT_IMPLEMENTED();
}
NS_IMETHODIMP
nsChromeRegistryContent::IsLocaleRTL(const nsACString& aPackage,
bool *aResult)
{
if (aPackage != nsDependentCString("global")) {
NS_ERROR("Packages other than global unavailable");
return NS_ERROR_NOT_AVAILABLE;
}
*aResult = GetDirectionForLocale(mLocale);
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistryContent::GetSelectedLocale(const nsACString& aPackage,
nsACString& aLocale)
{
if (aPackage != nsDependentCString("global")) {
NS_ERROR("Uh-oh, caller wanted something other than 'some local'");
return NS_ERROR_NOT_AVAILABLE;
}
aLocale = mLocale;
return NS_OK;
}
NS_IMETHODIMP
nsChromeRegistryContent::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData)
{
CONTENT_NOT_IMPLEMENTED();
}
NS_IMETHODIMP
nsChromeRegistryContent::GetStyleOverlays(nsIURI *aChromeURL,
nsISimpleEnumerator **aResult)
{
CONTENT_NOT_IMPLEMENTED();
}
NS_IMETHODIMP
nsChromeRegistryContent::GetXULOverlays(nsIURI *aChromeURL,
nsISimpleEnumerator **aResult)
{
CONTENT_NOT_IMPLEMENTED();
}
nsresult nsChromeRegistryContent::UpdateSelectedLocale()
{
CONTENT_NOT_IMPLEMENTED();
}
void
nsChromeRegistryContent::ManifestContent(ManifestProcessingContext& cx,
int lineno, char *const * argv,
int flags)
{
CONTENT_NOTREACHED();
}
void
nsChromeRegistryContent::ManifestLocale(ManifestProcessingContext& cx,
int lineno,
char *const * argv, int flags)
{
CONTENT_NOTREACHED();
}
void
nsChromeRegistryContent::ManifestSkin(ManifestProcessingContext& cx,
int lineno,
char *const * argv, int flags)
{
CONTENT_NOTREACHED();
}
void
nsChromeRegistryContent::ManifestOverlay(ManifestProcessingContext& cx, int lineno,
char *const * argv, int flags)
{
CONTENT_NOTREACHED();
}
void
nsChromeRegistryContent::ManifestStyle(ManifestProcessingContext& cx,
int lineno,
char *const * argv, int flags)
{
CONTENT_NOTREACHED();
}
void
nsChromeRegistryContent::ManifestOverride(ManifestProcessingContext& cx,
int lineno,
char *const * argv, int flags)
{
CONTENT_NOTREACHED();
}
void
nsChromeRegistryContent::ManifestResource(ManifestProcessingContext& cx,
int lineno,
char *const * argv, int flags)
{
CONTENT_NOTREACHED();
}