Bug 1461851 - Properly add the source URL in the profiler metadata. r=glandium

MozReview-Commit-ID: 53M4bGolmJk

--HG--
extra : rebase_source : f0da66755c92d2937f5fad1f5784f9a81829c951
This commit is contained in:
Panos Astithas 2018-05-15 16:44:44 -07:00
Родитель 570031d38c
Коммит f041fb6e3c
10 изменённых файлов: 48 добавлений и 9 удалений

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

@ -39,6 +39,11 @@ def main(output, file):
if 'Crash Reporter:serverurl' not in appdata:
appdata['Crash Reporter:serverurl'] = ''
if 'App:sourcerepository' in appdata and 'App:sourcestamp' in appdata:
appdata['App:sourceurl'] = '"%(App:sourcerepository)s/rev/%(App:sourcestamp)s"' % appdata
else:
appdata['App:sourceurl'] = 'NULL'
output.write('''#include "mozilla/XREAppData.h"
static const mozilla::StaticXREAppData sAppData = {
"%(App:vendor)s",
@ -52,7 +57,9 @@ def main(output, file):
"%(Gecko:minversion)s",
"%(Gecko:maxversion)s",
"%(Crash Reporter:serverurl)s",
%(App:profile)s
%(App:profile)s,
NULL, // UAName
%(App:sourceurl)s
};''' % appdata)

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

@ -2705,7 +2705,8 @@ ContentChild::RecvUnlinkGhosts()
mozilla::ipc::IPCResult
ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID,
const nsCString& name, const nsCString& UAName,
const nsCString& ID, const nsCString& vendor)
const nsCString& ID, const nsCString& vendor,
const nsCString& sourceURL)
{
mAppInfo.version.Assign(version);
mAppInfo.buildID.Assign(buildID);
@ -2713,6 +2714,7 @@ ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID,
mAppInfo.UAName.Assign(UAName);
mAppInfo.ID.Assign(ID);
mAppInfo.vendor.Assign(vendor);
mAppInfo.sourceURL.Assign(sourceURL);
return IPC_OK();
}

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

@ -100,6 +100,7 @@ public:
nsCString UAName;
nsCString ID;
nsCString vendor;
nsCString sourceURL;
};
nsresult
@ -418,7 +419,8 @@ public:
virtual mozilla::ipc::IPCResult RecvAppInfo(const nsCString& version, const nsCString& buildID,
const nsCString& name, const nsCString& UAName,
const nsCString& ID, const nsCString& vendor) override;
const nsCString& ID, const nsCString& vendor,
const nsCString& sourceURL) override;
virtual mozilla::ipc::IPCResult RecvRemoteType(const nsString& aRemoteType) override;

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

@ -2319,9 +2319,10 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority)
nsCString UAName(gAppData->UAName);
nsCString ID(gAppData->ID);
nsCString vendor(gAppData->vendor);
nsCString sourceURL(gAppData->sourceURL);
// Sending all information to content process.
Unused << SendAppInfo(version, buildID, name, UAName, ID, vendor);
Unused << SendAppInfo(version, buildID, name, UAName, ID, vendor, sourceURL);
}
// Send the child its remote type. On Mac, this needs to be sent prior

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

@ -480,7 +480,7 @@ child:
async ShutdownA11y();
async AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName,
nsCString ID, nsCString vendor);
nsCString ID, nsCString vendor, nsCString sourceURL);
/**
* Send the remote type associated with the content process.

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

@ -715,6 +715,19 @@ nsXULAppInfo::GetUAName(nsACString& aResult)
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetSourceURL(nsACString& aResult)
{
if (XRE_IsContentProcess()) {
ContentChild* cc = ContentChild::GetSingleton();
aResult = cc->GetAppInfo().sourceURL;
return NS_OK;
}
aResult.Assign(gAppData->sourceURL);
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetLogConsoleErrors(bool *aResult)
{

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

@ -1566,10 +1566,6 @@ StreamMetaJSCustomObject(PSLockRef aLock, SpliceableJSONWriter& aWriter,
aWriter.IntProperty("version", 10);
#if defined(MOZ_SOURCE_URL)
aWriter.StringProperty("sourceURL", "@MOZ_SOURCE_URL@");
#endif
// The "startTime" field holds the number of milliseconds since midnight
// January 1, 1970 GMT. This grotty code computes (Now - (Now -
// ProcessStartTime)) to convert CorePS::ProcessStartTime() into that form.
@ -1660,6 +1656,10 @@ StreamMetaJSCustomObject(PSLockRef aLock, SpliceableJSONWriter& aWriter,
res = appInfo->GetAppBuildID(string);
if (!NS_FAILED(res))
aWriter.StringProperty("appBuildID", string.Data());
res = appInfo->GetSourceURL(string);
if (!NS_FAILED(res))
aWriter.StringProperty("sourceURL", string.Data());
}
// We should avoid collecting extension metadata for profiler while XPCOM is

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

@ -188,6 +188,11 @@ public:
*/
CharPtr UAName;
/**
* The URL to the source revision for this build of the application.
*/
CharPtr sourceURL;
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
/**
* Chromium sandbox BrokerServices.
@ -229,6 +234,7 @@ struct StaticXREAppData
const char* crashReporterURL;
const char* profile;
const char* UAName;
const char* sourceURL;
};
} // namespace mozilla

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

@ -25,6 +25,7 @@ XREAppData::operator=(const StaticXREAppData& aOther)
crashReporterURL = aOther.crashReporterURL;
profile = aOther.profile;
UAName = aOther.UAName;
sourceURL = aOther.sourceURL;
return *this;
}
@ -47,6 +48,7 @@ XREAppData::operator=(const XREAppData& aOther)
crashReporterURL = aOther.crashReporterURL;
profile = aOther.profile;
UAName = aOther.UAName;
sourceURL = aOther.sourceURL;
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
sandboxBrokerServices = aOther.sandboxBrokerServices;
sandboxPermissionsService = aOther.sandboxPermissionsService;

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

@ -50,4 +50,10 @@ interface nsIXULAppInfo : nsIPlatformInfo
* @returns an empty string if XREAppData.UAName is not set.
*/
readonly attribute ACString UAName;
/**
* @see XREAppData.sourceURL
* @returns an empty string if XREAppData.sourceURL is not set.
*/
readonly attribute ACString sourceURL;
};