зеркало из https://github.com/mozilla/gecko-dev.git
Bug 936835 - Adding script runners or messing with mLinksToUpdate during FlushPendingLinkUpdates is not allowed. r=bz
This commit is contained in:
Родитель
794b2d6bd9
Коммит
ddad8f2f25
|
@ -2390,6 +2390,14 @@ protected:
|
|||
// caches.
|
||||
bool mDidDocumentOpen;
|
||||
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* This is true while FlushPendingLinkUpdates executes. Calls to
|
||||
* [Un]RegisterPendingLinkUpdate will assert when this is true.
|
||||
*/
|
||||
bool mIsLinkUpdateRegistrationsForbidden;
|
||||
#endif
|
||||
|
||||
// The document's script global object, the object from which the
|
||||
// document can get its script context and scope. This is the
|
||||
// *inner* window object.
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "nsDocument.h"
|
||||
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
@ -8812,6 +8813,7 @@ nsIDocument::EnumerateFreezableElements(FreezableElementEnumerator aEnumerator,
|
|||
void
|
||||
nsIDocument::RegisterPendingLinkUpdate(Link* aLink)
|
||||
{
|
||||
MOZ_ASSERT(!mIsLinkUpdateRegistrationsForbidden);
|
||||
mLinksToUpdate.PutEntry(aLink);
|
||||
mHasLinksToUpdate = true;
|
||||
}
|
||||
|
@ -8819,6 +8821,7 @@ nsIDocument::RegisterPendingLinkUpdate(Link* aLink)
|
|||
void
|
||||
nsIDocument::UnregisterPendingLinkUpdate(Link* aLink)
|
||||
{
|
||||
MOZ_ASSERT(!mIsLinkUpdateRegistrationsForbidden);
|
||||
if (!mHasLinksToUpdate)
|
||||
return;
|
||||
|
||||
|
@ -8835,10 +8838,14 @@ EnumeratePendingLinkUpdates(nsPtrHashKey<Link>* aEntry, void* aData)
|
|||
void
|
||||
nsIDocument::FlushPendingLinkUpdates()
|
||||
{
|
||||
MOZ_ASSERT(!mIsLinkUpdateRegistrationsForbidden);
|
||||
if (!mHasLinksToUpdate)
|
||||
return;
|
||||
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
#ifdef DEBUG
|
||||
AutoRestore<bool> saved(mIsLinkUpdateRegistrationsForbidden);
|
||||
mIsLinkUpdateRegistrationsForbidden = true;
|
||||
#endif
|
||||
mLinksToUpdate.EnumerateEntries(EnumeratePendingLinkUpdates, nullptr);
|
||||
mLinksToUpdate.Clear();
|
||||
mHasLinksToUpdate = false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче