Bug 1450266 P7 Make XMLHttpRequestMainThread check for a valid inner window before dispatching events. r=baku r=smaug

This commit is contained in:
Ben Kelly 2018-04-03 17:10:17 -07:00
Родитель a32ccf78b7
Коммит 9bd4654613
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -1325,6 +1325,10 @@ XMLHttpRequestMainThread::DispatchOrStoreEvent(DOMEventTargetHelper* aTarget,
MOZ_ASSERT(aTarget); MOZ_ASSERT(aTarget);
MOZ_ASSERT(aEvent); MOZ_ASSERT(aEvent);
if (NS_FAILED(CheckInnerWindowCorrectness())) {
return;
}
if (mEventDispatchingSuspended) { if (mEventDispatchingSuspended) {
PendingEvent* event = mPendingEvents.AppendElement(); PendingEvent* event = mPendingEvents.AppendElement();
event->mTarget = aTarget; event->mTarget = aTarget;
@ -1352,6 +1356,10 @@ XMLHttpRequestMainThread::ResumeEventDispatching()
nsTArray<PendingEvent> pendingEvents; nsTArray<PendingEvent> pendingEvents;
pendingEvents.SwapElements(mPendingEvents); pendingEvents.SwapElements(mPendingEvents);
if (NS_FAILED(CheckInnerWindowCorrectness())) {
return;
}
for (uint32_t i = 0; i < pendingEvents.Length(); ++i) { for (uint32_t i = 0; i < pendingEvents.Length(); ++i) {
bool dummy; bool dummy;
pendingEvents[i].mTarget->DispatchEvent(pendingEvents[i].mEvent, &dummy); pendingEvents[i].mTarget->DispatchEvent(pendingEvents[i].mEvent, &dummy);