зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1285036 - Part 5: Consolidate the readystatechange-firing code into a function named FireReadyStateChange(). r=baku
This commit is contained in:
Родитель
fbc2d5f34d
Коммит
1bc65bb8d9
|
@ -1272,16 +1272,13 @@ XMLHttpRequestMainThread::GetLoadGroup() const
|
|||
}
|
||||
|
||||
nsresult
|
||||
XMLHttpRequestMainThread::CreateReadystatechangeEvent(nsIDOMEvent** aDOMEvent)
|
||||
XMLHttpRequestMainThread::FireReadystatechangeEvent()
|
||||
{
|
||||
RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
|
||||
event.forget(aDOMEvent);
|
||||
|
||||
(*aDOMEvent)->InitEvent(kLiteralString_readystatechange, false, false);
|
||||
|
||||
event->InitEvent(kLiteralString_readystatechange, false, false);
|
||||
// We assume anyone who managed to call CreateReadystatechangeEvent is trusted
|
||||
(*aDOMEvent)->SetTrusted(true);
|
||||
|
||||
event->SetTrusted(true);
|
||||
DispatchDOMEvent(nullptr, event, nullptr, nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3118,11 +3115,7 @@ XMLHttpRequestMainThread::ChangeState(State aState, bool aBroadcast)
|
|||
if (aBroadcast && (!mFlagSynchronous ||
|
||||
aState == State::opened ||
|
||||
aState == State::done)) {
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
rv = CreateReadystatechangeEvent(getter_AddRefs(event));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
DispatchDOMEvent(nullptr, event, nullptr, nullptr);
|
||||
rv = FireReadystatechangeEvent();
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -520,9 +520,9 @@ public:
|
|||
JS::MutableHandle<JS::Value> aRetval,
|
||||
ErrorResult& aRv) override;
|
||||
|
||||
// This creates a trusted readystatechange event, which is not cancelable and
|
||||
// This fires a trusted readystatechange event, which is not cancelable and
|
||||
// doesn't bubble.
|
||||
nsresult CreateReadystatechangeEvent(nsIDOMEvent** aDOMEvent);
|
||||
nsresult FireReadystatechangeEvent();
|
||||
void DispatchProgressEvent(DOMEventTargetHelper* aTarget,
|
||||
const ProgressEventType aType,
|
||||
bool aLengthComputable,
|
||||
|
|
Загрузка…
Ссылка в новой задаче