mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1397702 - StorageObserver should use nsTObserverArray for the sink in order to support removal when iterating. r=mccr8
This commit is contained in:
parent
f9e2e7cfbc
commit
84764f515b
@ -140,8 +140,9 @@ StorageObserver::Notify(const char* aTopic,
|
||||
const nsAString& aOriginAttributesPattern,
|
||||
const nsACString& aOriginScope)
|
||||
{
|
||||
for (uint32_t i = 0; i < mSinks.Length(); ++i) {
|
||||
StorageObserverSink* sink = mSinks[i];
|
||||
nsTObserverArray<StorageObserverSink*>::ForwardIterator iter(mSinks);
|
||||
while (iter.HasMore()) {
|
||||
StorageObserverSink* sink = iter.GetNext();
|
||||
sink->Observe(aTopic, aOriginAttributesPattern, aOriginScope);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "nsIObserver.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -64,7 +64,7 @@ private:
|
||||
nsCOMPtr<nsIEventTarget> mBackgroundThread;
|
||||
|
||||
// Weak references
|
||||
nsTArray<StorageObserverSink*> mSinks;
|
||||
nsTObserverArray<StorageObserverSink*> mSinks;
|
||||
nsCOMPtr<nsITimer> mDBThreadStartDelayTimer;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user