mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1852891 - [bidi] Move browsingContext awaitNavigation navigated.finally to try / finally r=webdriver-reviewers,whimboo
Depends on D191609 Differential Revision: https://phabricator.services.mozilla.com/D195440
This commit is contained in:
parent
6550258c08
commit
2d15a436fe
@ -1264,28 +1264,8 @@ class BrowsingContextModule extends Module {
|
||||
}
|
||||
|
||||
const navigated = listener.start();
|
||||
navigated.finally(async () => {
|
||||
if (listener.isStarted) {
|
||||
listener.stop();
|
||||
}
|
||||
|
||||
if (wait === WaitCondition.Interactive) {
|
||||
await this.messageHandler.eventsDispatcher.off(
|
||||
"browsingContext._documentInteractive",
|
||||
contextDescriptor,
|
||||
onDocumentInteractive
|
||||
);
|
||||
} else if (
|
||||
wait === WaitCondition.Complete &&
|
||||
shouldWaitForNavigationRequest
|
||||
) {
|
||||
// We still need to make sure the navigation request has been received
|
||||
// before performing the cleanup.
|
||||
await onNavigationRequestCompleted;
|
||||
await unsubscribeNavigationListeners();
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
const navigationId = lazy.registerNavigationId({
|
||||
contextDetails: { context: webProgress.browsingContext },
|
||||
});
|
||||
@ -1310,6 +1290,24 @@ class BrowsingContextModule extends Module {
|
||||
navigation: navigationId,
|
||||
url,
|
||||
};
|
||||
} finally {
|
||||
if (listener.isStarted) {
|
||||
listener.stop();
|
||||
}
|
||||
|
||||
if (wait === WaitCondition.Interactive) {
|
||||
await this.messageHandler.eventsDispatcher.off(
|
||||
"browsingContext._documentInteractive",
|
||||
contextDescriptor,
|
||||
onDocumentInteractive
|
||||
);
|
||||
} else if (
|
||||
wait === WaitCondition.Complete &&
|
||||
shouldWaitForNavigationRequest
|
||||
) {
|
||||
await unsubscribeNavigationListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user