diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-04-29 14:44:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-29 14:44:02 +0200 |
commit | dc35e5c26dfa8c7fe6d27f7bc96f7a6e3c02de9b (patch) | |
tree | 56d8df17bdaa6a4558c7b0ed887c9302766f347a /dom/performance/PerformanceObserver.cpp | |
parent | 65a580a4efedf51cc542fff8c12b487a2113b987 (diff) | |
parent | bdb4ff581677ad1cd411b55a68c87534f9a64882 (diff) | |
download | UXP-dc35e5c26dfa8c7fe6d27f7bc96f7a6e3c02de9b.tar UXP-dc35e5c26dfa8c7fe6d27f7bc96f7a6e3c02de9b.tar.gz UXP-dc35e5c26dfa8c7fe6d27f7bc96f7a6e3c02de9b.tar.lz UXP-dc35e5c26dfa8c7fe6d27f7bc96f7a6e3c02de9b.tar.xz UXP-dc35e5c26dfa8c7fe6d27f7bc96f7a6e3c02de9b.zip |
Merge pull request #292 from janekptacijarabaci/js_dom_performance-observer_1
moebius#157: The Performance Observer (improvements)
Diffstat (limited to 'dom/performance/PerformanceObserver.cpp')
-rw-r--r-- | dom/performance/PerformanceObserver.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/dom/performance/PerformanceObserver.cpp b/dom/performance/PerformanceObserver.cpp index 11dd30ac2..d02acfb09 100644 --- a/dom/performance/PerformanceObserver.cpp +++ b/dom/performance/PerformanceObserver.cpp @@ -114,12 +114,13 @@ PerformanceObserver::Notify() RefPtr<PerformanceObserverEntryList> list = new PerformanceObserverEntryList(this, mQueuedEntries); + mQueuedEntries.Clear(); + ErrorResult rv; mCallback->Call(this, *list, *this, rv); if (NS_WARN_IF(rv.Failed())) { rv.SuppressException(); } - mQueuedEntries.Clear(); } void @@ -170,6 +171,17 @@ PerformanceObserver::Observe(const PerformanceObserverInit& aOptions, mEntryTypes.SwapElements(validEntryTypes); mPerformance->AddObserver(this); + + if (aOptions.mBuffered) { + for (auto entryType : mEntryTypes) { + nsTArray<RefPtr<PerformanceEntry>> existingEntries; + mPerformance->GetEntriesByType(entryType, existingEntries); + if (!existingEntries.IsEmpty()) { + mQueuedEntries.AppendElements(existingEntries); + } + } + } + mConnected = true; } |