Bug 1396228 - Filter out by type if the type if specified for PerformanceEntry.getEntries. r?baku
MozReview-Commit-ID: 4XManqN8BVY
--- a/dom/performance/PerformanceObserverEntryList.cpp
+++ b/dom/performance/PerformanceObserverEntryList.cpp
@@ -85,15 +85,23 @@ PerformanceObserverEntryList::GetEntries
void
PerformanceObserverEntryList::GetEntriesByName(
const nsAString& aName,
const Optional<nsAString>& aEntryType,
nsTArray<RefPtr<PerformanceEntry>>& aRetval)
{
aRetval.Clear();
+ const bool typePassed = aEntryType.WasPassed();
for (const RefPtr<PerformanceEntry>& entry : mEntries) {
- if (entry->GetName().Equals(aName)) {
- aRetval.AppendElement(entry);
+ if (!entry->GetName().Equals(aName)) {
+ continue;
}
+
+ if (typePassed &&
+ !entry->GetEntryType().Equals(aEntryType.Value())) {
+ continue;
+ }
+
+ aRetval.AppendElement(entry);
}
aRetval.Sort(PerformanceEntryComparator());
}
deleted file mode 100644
--- a/testing/web-platform/meta/performance-timeline/po-getentries.any.js.ini
+++ /dev/null
@@ -1,11 +0,0 @@
-[po-getentries.any.html]
- type: testharness
- [getEntries, getEntriesByType and getEntriesByName work]
- expected: FAIL
-
-
-[po-getentries.any.worker.html]
- type: testharness
- [getEntries, getEntriesByType and getEntriesByName work]
- expected: FAIL
-