Bug 1285898 - [e10s-multi] fixup PContent ordering via immediate event dispatch. r=baku
This commit is contained in:
@@ -3046,7 +3046,7 @@ ContentChild::RecvDispatchLocalStorageChange(const nsString& aDocumentURI,
|
|||||||
{
|
{
|
||||||
Storage::DispatchStorageEvent(Storage::LocalStorage,
|
Storage::DispatchStorageEvent(Storage::LocalStorage,
|
||||||
aDocumentURI, aKey, aOldValue, aNewValue,
|
aDocumentURI, aKey, aOldValue, aNewValue,
|
||||||
aPrincipal, aIsPrivate, nullptr);
|
aPrincipal, aIsPrivate, nullptr, true);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ Storage::BroadcastChangeNotification(const nsSubstring& aKey,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DispatchStorageEvent(GetType(), mDocumentURI, aKey, aOldValue, aNewValue,
|
DispatchStorageEvent(GetType(), mDocumentURI, aKey, aOldValue, aNewValue,
|
||||||
mPrincipal, mIsPrivate, this);
|
mPrincipal, mIsPrivate, this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
@@ -242,7 +242,8 @@ Storage::DispatchStorageEvent(StorageType aStorageType,
|
|||||||
const nsAString& aNewValue,
|
const nsAString& aNewValue,
|
||||||
nsIPrincipal* aPrincipal,
|
nsIPrincipal* aPrincipal,
|
||||||
bool aIsPrivate,
|
bool aIsPrivate,
|
||||||
Storage* aStorage)
|
Storage* aStorage,
|
||||||
|
bool aImmediateDispatch)
|
||||||
{
|
{
|
||||||
StorageEventInit dict;
|
StorageEventInit dict;
|
||||||
dict.mBubbles = false;
|
dict.mBubbles = false;
|
||||||
@@ -266,7 +267,12 @@ Storage::DispatchStorageEvent(StorageType aStorageType,
|
|||||||
? u"localStorage"
|
? u"localStorage"
|
||||||
: u"sessionStorage",
|
: u"sessionStorage",
|
||||||
aIsPrivate);
|
aIsPrivate);
|
||||||
|
|
||||||
|
if (aImmediateDispatch) {
|
||||||
|
Unused << r->Run();
|
||||||
|
} else {
|
||||||
NS_DispatchToMainThread(r);
|
NS_DispatchToMainThread(r);
|
||||||
|
}
|
||||||
|
|
||||||
// If we are in the parent process and we have the principal, we want to
|
// If we are in the parent process and we have the principal, we want to
|
||||||
// broadcast this event to every other process.
|
// broadcast this event to every other process.
|
||||||
|
|||||||
@@ -131,6 +131,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// aStorage can be null if this method is called by ContentChild.
|
// aStorage can be null if this method is called by ContentChild.
|
||||||
|
//
|
||||||
|
// aImmediateDispatch is for use by (main-thread) IPC code so that PContent
|
||||||
|
// ordering can be maintained. Without this, the event would be enqueued and
|
||||||
|
// run in a future turn of the event loop, potentially allowing other PContent
|
||||||
|
// Recv* methods to trigger script that wants to assume our localstorage
|
||||||
|
// changes have already been applied. This is the case for message manager
|
||||||
|
// messages which are used by ContentTask testing logic and webextensions.
|
||||||
static void
|
static void
|
||||||
DispatchStorageEvent(StorageType aStorageType,
|
DispatchStorageEvent(StorageType aStorageType,
|
||||||
const nsAString& aDocumentURI,
|
const nsAString& aDocumentURI,
|
||||||
@@ -139,7 +146,8 @@ public:
|
|||||||
const nsAString& aNewValue,
|
const nsAString& aNewValue,
|
||||||
nsIPrincipal* aPrincipal,
|
nsIPrincipal* aPrincipal,
|
||||||
bool aIsPrivate,
|
bool aIsPrivate,
|
||||||
Storage* aStorage);
|
Storage* aStorage,
|
||||||
|
bool aImmediateDispatch);
|
||||||
|
|
||||||
void
|
void
|
||||||
ApplyEvent(StorageEvent* aStorageEvent);
|
ApplyEvent(StorageEvent* aStorageEvent);
|
||||||
|
|||||||
Reference in New Issue
Block a user