mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1462605 - PerformanceNavigationTiming.name must be the value of the address of the current document, r=valentin
This commit is contained in:
parent
828b2d9eef
commit
5840b63b8a
@ -12,6 +12,35 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace {
|
||||
|
||||
void
|
||||
GetURLSpecFromChannel(nsITimedChannel* aChannel, nsAString& aSpec)
|
||||
{
|
||||
aSpec.AssignLiteral("document");
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aChannel);
|
||||
if (!channel) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = channel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) || !uri) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString spec;
|
||||
rv = uri->GetSpec(spec);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return;
|
||||
}
|
||||
|
||||
aSpec = NS_ConvertUTF8toUTF16(spec);
|
||||
}
|
||||
|
||||
} // anonymous
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(PerformanceMainThread)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PerformanceMainThread,
|
||||
@ -293,7 +322,10 @@ PerformanceMainThread::EnsureDocEntry()
|
||||
timing->SetPropertiesFromHttpChannel(httpChannel);
|
||||
}
|
||||
|
||||
mDocEntry = new PerformanceNavigationTiming(Move(timing), this);
|
||||
nsAutoString name;
|
||||
GetURLSpecFromChannel(mChannel, name);
|
||||
|
||||
mDocEntry = new PerformanceNavigationTiming(Move(timing), this, name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,9 +339,12 @@ PerformanceMainThread::CreateDocumentEntry(nsITimedChannel* aChannel)
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoString name;
|
||||
GetURLSpecFromChannel(aChannel, name);
|
||||
|
||||
UniquePtr<PerformanceTimingData> timing(
|
||||
new PerformanceTimingData(aChannel, nullptr, 0));
|
||||
mDocEntry = new PerformanceNavigationTiming(Move(timing), this);
|
||||
mDocEntry = new PerformanceNavigationTiming(Move(timing), this, name);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -30,12 +30,13 @@ public:
|
||||
// performance.timing object for which timestamps are absolute and has a
|
||||
// zeroTime initialized to navigationStart
|
||||
PerformanceNavigationTiming(UniquePtr<PerformanceTimingData>&& aPerformanceTiming,
|
||||
Performance* aPerformance)
|
||||
: PerformanceResourceTiming(Move(aPerformanceTiming), aPerformance,
|
||||
NS_LITERAL_STRING("document")) {
|
||||
SetEntryType(NS_LITERAL_STRING("navigation"));
|
||||
SetInitiatorType(NS_LITERAL_STRING("navigation"));
|
||||
}
|
||||
Performance* aPerformance,
|
||||
const nsAString& aName)
|
||||
: PerformanceResourceTiming(Move(aPerformanceTiming), aPerformance, aName)
|
||||
{
|
||||
SetEntryType(NS_LITERAL_STRING("navigation"));
|
||||
SetInitiatorType(NS_LITERAL_STRING("navigation"));
|
||||
}
|
||||
|
||||
DOMHighResTimeStamp Duration() const override
|
||||
{
|
||||
|
@ -1,5 +1 @@
|
||||
prefs: [privacy.reduceTimerPrecision:false]
|
||||
[nav2_test_redirect_server.html]
|
||||
[Navigation Timing 2 WPT]
|
||||
expected: FAIL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user