Backed out 12 changesets (bug 1425458) for mochitest failures on WorkerPrivate.cpp on a CLOSED TREE

Backed out changeset 11997de13778 (bug 1425458)
Backed out changeset 100b9d4f36bc (bug 1425458)
Backed out changeset a29e9dbb8c42 (bug 1425458)
Backed out changeset b96d58fd945c (bug 1425458)
Backed out changeset f140da44ba68 (bug 1425458)
Backed out changeset af56400233d9 (bug 1425458)
Backed out changeset 7034af4332e4 (bug 1425458)
Backed out changeset f70500179140 (bug 1425458)
Backed out changeset 793bbfc23257 (bug 1425458)
Backed out changeset 2efb375a8ffc (bug 1425458)
Backed out changeset 07e781e37451 (bug 1425458)
Backed out changeset e875f3702a5f (bug 1425458)
This commit is contained in:
Brindusan Cristian
2018-01-24 20:47:48 +02:00
parent 8a9d1b744c
commit 1153f2c09e
90 changed files with 472 additions and 1364 deletions

View File

@@ -118,24 +118,64 @@ PerformanceMainThread::AddEntry(nsIHttpChannel* channel,
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoString initiatorType;
nsAutoString entryName;
UniquePtr<PerformanceTimingData> performanceTimingData(
PerformanceTimingData::Create(timedChannel, channel, 0, initiatorType,
entryName));
if (!performanceTimingData) {
// Check if resource timing is prefed off.
if (!nsContentUtils::IsResourceTimingEnabled()) {
return;
}
// The PerformanceResourceTiming object will use the PerformanceTimingData
// object to get all the required timings.
RefPtr<PerformanceResourceTiming> performanceEntry =
new PerformanceResourceTiming(Move(performanceTimingData), this,
entryName);
// Don't add the entry if the buffer is full
if (IsResourceEntryLimitReached()) {
return;
}
performanceEntry->SetInitiatorType(initiatorType);
InsertResourceEntry(performanceEntry);
if (channel && timedChannel) {
nsAutoCString name;
nsAutoString initiatorType;
nsCOMPtr<nsIURI> originalURI;
timedChannel->GetInitiatorType(initiatorType);
// According to the spec, "The name attribute must return the resolved URL
// of the requested resource. This attribute must not change even if the
// fetch redirected to a different URL."
channel->GetOriginalURI(getter_AddRefs(originalURI));
originalURI->GetSpec(name);
NS_ConvertUTF8toUTF16 entryName(name);
bool reportTiming = true;
timedChannel->GetReportResourceTiming(&reportTiming);
if (!reportTiming) {
#ifdef DEBUG_jwatt
NS_WARNING(
nsPrintfCString("Not reporting CORS resource: %s", name.get()).get());
#endif
return;
}
// The nsITimedChannel argument will be used to gather all the timings.
// The nsIHttpChannel argument will be used to check if any cross-origin
// redirects occurred.
// The last argument is the "zero time" (offset). Since we don't want
// any offset for the resource timing, this will be set to "0" - the
// resource timing returns a relative timing (no offset).
RefPtr<PerformanceTiming> performanceTiming =
new PerformanceTiming(this, timedChannel, channel,
0);
// The PerformanceResourceTiming object will use the PerformanceTiming
// object to get all the required timings.
RefPtr<PerformanceResourceTiming> performanceEntry =
new PerformanceResourceTiming(performanceTiming, this, entryName, channel);
// If the initiator type had no valid value, then set it to the default
// ("other") value.
if (initiatorType.IsEmpty()) {
initiatorType = NS_LITERAL_STRING("other");
}
performanceEntry->SetInitiatorType(initiatorType);
InsertResourceEntry(performanceEntry);
}
}
// To be removed once bug 1124165 lands
@@ -285,15 +325,11 @@ void
PerformanceMainThread::EnsureDocEntry()
{
if (!mDocEntry && nsContentUtils::IsPerformanceNavigationTimingEnabled()) {
UniquePtr<PerformanceTimingData> timing(
new PerformanceTimingData(mChannel, nullptr, 0));
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
if (httpChannel) {
timing->SetPropertiesFromHttpChannel(httpChannel);
}
mDocEntry = new PerformanceNavigationTiming(Move(timing), this);
RefPtr<PerformanceTiming> timing =
new PerformanceTiming(this, mChannel, nullptr, 0);
mDocEntry = new PerformanceNavigationTiming(timing, this,
httpChannel);
}
}