/* -*- 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/. */
PerformanceResourceTiming::PerformanceResourceTiming(
UniquePtr<PerformanceTimingData>&& aPerformanceTiming,
Performance* aPerformance, const nsAString& aName)
: PerformanceEntry(aPerformance->GetParentObject(), aName, u"resource"_ns),
mTimingData(std::move(aPerformanceTiming)),
mPerformance(aPerformance) {
MOZ_RELEASE_ASSERT(mTimingData);
MOZ_ASSERT(aPerformance, "Parent performance object should be provided"); if (NS_IsMainThread()) { // Used to check if an addon content script has access to this timing. // We don't need it in workers, and ignore mOriginalURI if null.
NS_NewURI(getter_AddRefs(mOriginalURI), aName);
}
}
DOMHighResTimeStamp PerformanceResourceTiming::StartTime() const { // Force the start time to be the earliest of: // - RedirectStart // - WorkerStart // - AsyncOpen // Ignore zero values. The RedirectStart and WorkerStart values // can come from earlier redirected channels prior to the AsyncOpen // time being recorded. if (mCachedStartTime.isNothing()) {
DOMHighResTimeStamp redirect =
mTimingData->RedirectStartHighRes(mPerformance);
redirect = redirect ? redirect : DBL_MAX;
nsTArray<nsCOMPtr<nsIServerTiming>> serverTimingArray =
mTimingData->GetServerTiming();
uint32_t length = serverTimingArray.Length(); for (uint32_t index = 0; index < length; ++index) {
nsCOMPtr<nsIServerTiming> serverTiming = serverTimingArray.ElementAt(index);
MOZ_ASSERT(serverTiming);
aRetval.AppendElement( new PerformanceServerTiming(GetParentObject(), serverTiming));
}
}
nsITimedChannel::BodyInfoAccess
PerformanceResourceTiming::BodyInfoAccessAllowedForCaller(
nsIPrincipal& aCaller) const { // If the addon has permission to access the cross-origin resource, // allow it full access to the bodyInfo. if (mOriginalURI &&
BasePrincipal::Cast(&aCaller)->AddonAllowsLoad(mOriginalURI)) { return nsITimedChannel::BodyInfoAccess::ALLOW_ALL;
}
// Check if the addon has permission to access the cross-origin resource. return mOriginalURI &&
BasePrincipal::Cast(&aCaller)->AddonAllowsLoad(mOriginalURI);
}
// Only report cross-origin redirect if the addon has <all_urls> permission. return BasePrincipal::Cast(&aCaller)->AddonHasPermission(
nsGkAtoms::all_urlsPermission);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.