mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 23:38:38 +09:00
Issue #2053 - Part 4a: Align IsPerformanceTimingAttribute to user-timing spec
Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1772417
This commit is contained in:
parent
3b57ba1415
commit
4fc9cde7c1
5 changed files with 32 additions and 26 deletions
|
|
@ -300,6 +300,28 @@ Performance::ClearMarks(const Optional<nsAString>& aName)
|
|||
ClearUserEntries(aName, NS_LITERAL_STRING("mark"));
|
||||
}
|
||||
|
||||
// To be removed once bug 1124165 lands
|
||||
bool
|
||||
Performance::IsPerformanceTimingAttribute(const nsAString& aName) const
|
||||
{
|
||||
// Note that toJSON is added to this list due to bug 1047848
|
||||
static const char* attributes[] =
|
||||
{"navigationStart", "unloadEventStart", "unloadEventEnd", "redirectStart",
|
||||
"redirectEnd", "fetchStart", "domainLookupStart", "domainLookupEnd",
|
||||
"connectStart", "secureConnectionStart", "connectEnd", "requestStart", "responseStart",
|
||||
"responseEnd", "domLoading", "domInteractive",
|
||||
"domContentLoadedEventStart", "domContentLoadedEventEnd", "domComplete",
|
||||
"loadEventStart", "loadEventEnd", nullptr};
|
||||
|
||||
for (uint32_t i = 0; attributes[i]; ++i) {
|
||||
if (aName.EqualsASCII(attributes[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DOMHighResTimeStamp
|
||||
Performance::ConvertMarkToTimestampWithString(const nsAString& aName,
|
||||
ErrorResult& aRv)
|
||||
|
|
|
|||
|
|
@ -117,7 +117,9 @@ public:
|
|||
|
||||
virtual nsITimedChannel* GetChannel() const = 0;
|
||||
|
||||
virtual bool IsPerformanceTimingAttribute(const nsAString& aName)
|
||||
bool IsPerformanceTimingAttribute(const nsAString& aName) const;
|
||||
|
||||
virtual bool IsGlobalObjectWindow() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,28 +177,6 @@ PerformanceMainThread::AddEntry(nsIHttpChannel* channel,
|
|||
}
|
||||
}
|
||||
|
||||
// To be removed once bug 1124165 lands
|
||||
bool
|
||||
PerformanceMainThread::IsPerformanceTimingAttribute(const nsAString& aName)
|
||||
{
|
||||
// Note that toJSON is added to this list due to bug 1047848
|
||||
static const char* attributes[] =
|
||||
{"navigationStart", "unloadEventStart", "unloadEventEnd", "redirectStart",
|
||||
"redirectEnd", "fetchStart", "domainLookupStart", "domainLookupEnd",
|
||||
"connectStart", "secureConnectionStart", "connectEnd", "requestStart", "responseStart",
|
||||
"responseEnd", "domLoading", "domInteractive",
|
||||
"domContentLoadedEventStart", "domContentLoadedEventEnd", "domComplete",
|
||||
"loadEventStart", "loadEventEnd", nullptr};
|
||||
|
||||
for (uint32_t i = 0; attributes[i]; ++i) {
|
||||
if (aName.EqualsASCII(attributes[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DOMHighResTimeStamp
|
||||
PerformanceMainThread::GetPerformanceTimingFromString(const nsAString& aProperty)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ public:
|
|||
const Optional<nsAString>& aEntryType,
|
||||
nsTArray<RefPtr<PerformanceEntry>>& aRetval) override;
|
||||
|
||||
bool IsGlobalObjectWindow() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
~PerformanceMainThread();
|
||||
|
||||
|
|
@ -67,8 +72,6 @@ protected:
|
|||
|
||||
void InsertUserEntry(PerformanceEntry* aEntry) override;
|
||||
|
||||
bool IsPerformanceTimingAttribute(const nsAString& aName) override;
|
||||
|
||||
DOMHighResTimeStamp
|
||||
GetPerformanceTimingFromString(const nsAString& aTimingName) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ already_AddRefed<PerformanceMark> PerformanceMark::Constructor(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (performance->IsPerformanceTimingAttribute(aMarkName)) {
|
||||
if (performance->IsGlobalObjectWindow() &&
|
||||
performance->IsPerformanceTimingAttribute(aMarkName)) {
|
||||
aRv.ThrowTypeError<MSG_PMO_INVALID_TIMING_ATTR>();
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue