Bug 1396228 - Filter out by type if the type if specified for PerformanceEntry.getEntries. r=baku

MozReview-Commit-ID: 4XManqN8BVY

--HG--
extra : rebase_source : 2fefe77e5fcadbd4e5632d557e554e8356c1ef52
This commit is contained in:
Hiroyuki Ikezoe 2017-09-02 21:42:00 +09:00
parent 8ae5e3226b
commit 8f3ef222fd
2 changed files with 10 additions and 13 deletions

View File

@ -90,10 +90,18 @@ PerformanceObserverEntryList::GetEntriesByName(
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());
}

View File

@ -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