mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1925188 - Don't abort pending promise by screen.orientation.lock during change event. r=dom-core,edgar
We should clear pending orientation lock promise in document before change event is dispatched. After that, we should resolve this promise. Differential Revision: https://phabricator.services.mozilla.com/D225945
This commit is contained in:
parent
83916cbffc
commit
355f5977be
@ -802,15 +802,18 @@ ScreenOrientation::DispatchChangeEventAndResolvePromise() {
|
||||
RefPtr<ScreenOrientation> self = this;
|
||||
return NS_NewRunnableFunction(
|
||||
"dom::ScreenOrientation::DispatchChangeEvent", [self, doc]() {
|
||||
DebugOnly<nsresult> rv = self->DispatchTrustedEvent(u"change"_ns);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "DispatchTrustedEvent failed");
|
||||
RefPtr<Promise> pendingPromise;
|
||||
if (doc) {
|
||||
Promise* pendingPromise = doc->GetOrientationPendingPromise();
|
||||
pendingPromise = doc->GetOrientationPendingPromise();
|
||||
if (pendingPromise) {
|
||||
pendingPromise->MaybeResolveWithUndefined();
|
||||
doc->ClearOrientationPendingPromise();
|
||||
}
|
||||
}
|
||||
DebugOnly<nsresult> rv = self->DispatchTrustedEvent(u"change"_ns);
|
||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "DispatchTrustedEvent failed");
|
||||
if (pendingPromise) {
|
||||
pendingPromise->MaybeResolveWithUndefined();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,11 @@
|
||||
[Unlocking the screen orientation after a change event must not abort]
|
||||
expected:
|
||||
if (os == "mac") and debug: [FAIL, NOTRUN]
|
||||
if (os == "android"): PASS
|
||||
FAIL
|
||||
|
||||
[Re-locking the screen orientation after a change event fires must not abort]
|
||||
expected:
|
||||
if (os == "mac") and debug: [FAIL, TIMEOUT]
|
||||
if (os == "android"): PASS
|
||||
FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user