зеркало из https://github.com/mozilla/gecko-dev.git
Bug 801304 Part 1 - Keep track of suspended event queues in nsIDocument, r=smaug.
--HG-- extra : rebase_source : 312b0e15d40c7e11ba2c4a6bdadcfefb1300999f
This commit is contained in:
Родитель
1b714ffa18
Коммит
d0f7b1b700
|
@ -286,6 +286,7 @@
|
|||
#include "nsHTMLTags.h"
|
||||
#include "NodeUbiReporting.h"
|
||||
#include "nsICookieService.h"
|
||||
#include "mozilla/net/ChannelEventQueue.h"
|
||||
#include "mozilla/net/RequestContextService.h"
|
||||
#include "StorageAccessPermissionRequest.h"
|
||||
|
||||
|
@ -8580,6 +8581,22 @@ void nsIDocument::UnsuppressEventHandlingAndFireEvents(bool aFireEvents) {
|
|||
} else {
|
||||
FireOrClearDelayedEvents(documents, false);
|
||||
}
|
||||
|
||||
if (!EventHandlingSuppressed()) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsTArray<RefPtr<net::ChannelEventQueue>> queues;
|
||||
mSuspendedQueues.SwapElements(queues);
|
||||
for (net::ChannelEventQueue* queue : queues) {
|
||||
queue->Resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsIDocument::AddSuspendedChannelEventQueue(
|
||||
net::ChannelEventQueue* aQueue) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(EventHandlingSuppressed());
|
||||
mSuspendedQueues.AppendElement(aQueue);
|
||||
}
|
||||
|
||||
nsISupports* nsIDocument::GetCurrentContentSink() {
|
||||
|
|
|
@ -210,6 +210,12 @@ enum class CallerType : uint32_t;
|
|||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
class ChannelEventQueue;
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
// Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ \
|
||||
|
@ -2442,6 +2448,14 @@ class nsIDocument : public nsINode,
|
|||
UpdateFrameRequestCallbackSchedulingState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Note a ChannelEventQueue which has been suspended on the document's behalf
|
||||
* to prevent XHRs from running content scripts while event handling is
|
||||
* suppressed. The document is responsible for resuming the queue after
|
||||
* event handling is unsuppressed.
|
||||
*/
|
||||
void AddSuspendedChannelEventQueue(mozilla::net::ChannelEventQueue* aQueue);
|
||||
|
||||
/**
|
||||
* Increment https://html.spec.whatwg.org/#ignore-destructive-writes-counter
|
||||
*/
|
||||
|
@ -4025,6 +4039,10 @@ class nsIDocument : public nsINode,
|
|||
|
||||
uint32_t mEventsSuppressed;
|
||||
|
||||
// Any XHR ChannelEventQueues that were suspended on this document while
|
||||
// events were suppressed.
|
||||
nsTArray<RefPtr<mozilla::net::ChannelEventQueue>> mSuspendedQueues;
|
||||
|
||||
/**
|
||||
* https://html.spec.whatwg.org/#ignore-destructive-writes-counter
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче