Backout changesets 7ff3cd713466, f8ec5977a454 and c7c37390b46b (bug 977026) for b2g bustage on a CLOSED TREE.

This commit is contained in:
Mike Hommey
2014-07-29 14:50:41 +09:00
parent 969b140bd7
commit e0dac91a96
27 changed files with 181 additions and 1560 deletions

View File

@@ -36,18 +36,6 @@
#include "nsIScriptError.h"
#include "nsIXULAppInfo.h"
#include "nsIXULRuntime.h"
#ifdef MOZ_B2G_LOADER
#include "mozilla/XPTInterfaceInfoManager.h"
#endif
#ifdef MOZ_B2G_LOADER
#define XPTONLY_MANIFEST &nsComponentManagerImpl::XPTOnlyManifestManifest
#define XPTONLY_XPT &nsComponentManagerImpl::XPTOnlyManifestXPT
#else
#define XPTONLY_MANIFEST nullptr
#define XPTONLY_XPT nullptr
#endif
using namespace mozilla;
@@ -76,43 +64,36 @@ struct ManifestDirective
(nsChromeRegistry::ManifestProcessingContext& cx,
int lineno, char *const *argv,
bool platform, bool contentaccessible);
#ifdef MOZ_B2G_LOADER
// The function to handle the directive for XPT Only parsing.
void (*xptonlyfunc)(nsComponentManagerImpl::XPTOnlyManifestProcessingContext& cx,
int lineno, char *const * argv);
#else
void *xptonlyfunc;
#endif
bool isContract;
};
static const ManifestDirective kParsingTable[] = {
{ "manifest", 1, false, true, true, false,
&nsComponentManagerImpl::ManifestManifest, nullptr, XPTONLY_MANIFEST },
&nsComponentManagerImpl::ManifestManifest, nullptr },
{ "binary-component", 1, true, false, false, false,
&nsComponentManagerImpl::ManifestBinaryComponent, nullptr, nullptr },
&nsComponentManagerImpl::ManifestBinaryComponent, nullptr },
{ "interfaces", 1, true, false, false, false,
&nsComponentManagerImpl::ManifestXPT, nullptr, XPTONLY_XPT },
&nsComponentManagerImpl::ManifestXPT, nullptr },
{ "component", 2, true, false, false, false,
&nsComponentManagerImpl::ManifestComponent, nullptr, nullptr },
&nsComponentManagerImpl::ManifestComponent, nullptr },
{ "contract", 2, true, false, false, false,
&nsComponentManagerImpl::ManifestContract, nullptr, nullptr, true},
&nsComponentManagerImpl::ManifestContract, nullptr, true},
{ "category", 3, true, false, false, false,
&nsComponentManagerImpl::ManifestCategory, nullptr, nullptr },
&nsComponentManagerImpl::ManifestCategory, nullptr },
{ "content", 2, true, true, true, true,
nullptr, &nsChromeRegistry::ManifestContent, nullptr },
nullptr, &nsChromeRegistry::ManifestContent },
{ "locale", 3, true, true, true, false,
nullptr, &nsChromeRegistry::ManifestLocale, nullptr },
nullptr, &nsChromeRegistry::ManifestLocale },
{ "skin", 3, false, true, true, false,
nullptr, &nsChromeRegistry::ManifestSkin, nullptr },
nullptr, &nsChromeRegistry::ManifestSkin },
{ "overlay", 2, true, true, false, false,
nullptr, &nsChromeRegistry::ManifestOverlay, nullptr },
nullptr, &nsChromeRegistry::ManifestOverlay },
{ "style", 2, false, true, false, false,
nullptr, &nsChromeRegistry::ManifestStyle, nullptr },
nullptr, &nsChromeRegistry::ManifestStyle },
{ "override", 2, true, true, true, false,
nullptr, &nsChromeRegistry::ManifestOverride, nullptr },
nullptr, &nsChromeRegistry::ManifestOverride },
{ "resource", 2, true, true, false, false,
nullptr, &nsChromeRegistry::ManifestResource, nullptr }
nullptr, &nsChromeRegistry::ManifestResource }
};
static const char kWhitespace[] = "\t ";
@@ -145,16 +126,8 @@ struct AutoPR_smprintf_free
} // anonymous namespace
/**
* If we are pre-loading XPTs, this method may do nothing because the
* console service is not initialized.
*/
void LogMessage(const char* aMsg, ...)
{
if (!nsComponentManagerImpl::gComponentManager) {
return;
}
nsCOMPtr<nsIConsoleService> console =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (!console)
@@ -170,10 +143,6 @@ void LogMessage(const char* aMsg, ...)
console->LogMessage(error);
}
/**
* If we are pre-loading XPTs, this method may do nothing because the
* console service is not initialized.
*/
void LogMessageWithContext(FileLocation &aFile,
uint32_t aLineNumber, const char* aMsg, ...)
{
@@ -184,10 +153,6 @@ void LogMessageWithContext(FileLocation &aFile,
if (!formatted)
return;
if (!nsComponentManagerImpl::gComponentManager) {
return;
}
nsCString file;
aFile.GetURIString(file);
@@ -423,23 +388,11 @@ struct CachedDirective
} // anonymous namespace
/**
* For XPT-Only mode, the parser handles only directives of "manifest"
* and "interfaces", and always call the function given by |xptonlyfunc|
* variable of struct |ManifestDirective|.
*
* This function is safe to be called before the component manager is
* ready if aXPTOnly is true for it don't invoke any component during
* parsing.
*/
void
ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOnly, bool aXPTOnly)
ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOnly)
{
nsComponentManagerImpl::ManifestProcessingContext mgrcx(type, file, aChromeOnly);
nsChromeRegistry::ManifestProcessingContext chromecx(type, file);
#ifdef MOZ_B2G_LOADER
nsComponentManagerImpl::XPTOnlyManifestProcessingContext xptonlycx(file);
#endif
nsresult rv;
NS_NAMED_LITERAL_STRING(kPlatform, "platform");
@@ -463,12 +416,7 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
nsAutoString osTarget;
nsAutoString abi;
nsCOMPtr<nsIXULAppInfo> xapp;
if (!aXPTOnly) {
// Avoid to create any component for XPT only mode.
// No xapp means no ID, version, ..., modifiers checking.
xapp = do_GetService(XULAPPINFO_SERVICE_CONTRACTID);
}
nsCOMPtr<nsIXULAppInfo> xapp (do_GetService(XULAPPINFO_SERVICE_CONTRACTID));
if (xapp) {
nsAutoCString s;
rv = xapp->GetID(s);
@@ -568,10 +516,9 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
for (const ManifestDirective* d = kParsingTable;
d < ArrayEnd(kParsingTable);
++d) {
if (!strcmp(d->directive, token) &&
(!aXPTOnly || d->xptonlyfunc)) {
directive = d;
break;
if (!strcmp(d->directive, token)) {
directive = d;
break;
}
}
@@ -630,9 +577,8 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
CheckStringFlag(kABI, wtoken, abi, stABI) ||
CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, stGeckoVersion)) {
CheckVersionFlag(kGeckoVersion, wtoken, geckoVersion, stGeckoVersion))
continue;
}
#if defined(MOZ_WIDGET_ANDROID)
bool tablet = false;
@@ -673,11 +619,6 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
stABI == eBad)
continue;
#ifdef MOZ_B2G_LOADER
if (aXPTOnly) {
directive->xptonlyfunc(xptonlycx, line, argv);
} else
#endif /* MOZ_B2G_LOADER */
if (directive->regfunc) {
if (GeckoProcessType_Default != XRE_GetProcessType())
continue;
@@ -695,7 +636,7 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
(nsChromeRegistry::gChromeRegistry->*(directive->regfunc))
(chromecx, line, argv, platform, contentAccessible);
}
else if (directive->mgrfunc && (directive->ischrome || !aChromeOnly)) {
else if (directive->ischrome || !aChromeOnly) {
if (directive->isContract) {
CachedDirective* cd = contracts.AppendElement();
cd->lineno = line;
@@ -705,9 +646,6 @@ ParseManifest(NSLocationType type, FileLocation &file, char* buf, bool aChromeOn
else
(nsComponentManagerImpl::gComponentManager->*(directive->mgrfunc))
(mgrcx, line, argv);
} else {
LogMessageWithContext(file, line,
"No valid manifest directive.");
}
}