navigate module exposes several useful APIs for navigation, but they are coupled to the marionette driver.
The goal of this bug is to extract most of the logic of the
waitForNavigationCompleted helper (searchfox) from navigate.js and move it to the shared Navigate.jsm module.
The features of the helper should remain similar:
- it should accept a
callbackFn which triggers the navigation
- it should support the various webdriver PageLoad strategies:
The main task here is to remove any usage of the marionette driver, so that the helper can be used from BiDi (and potentially CDP).
In remote/marionette/navigate.js, we might keep a
waitForNavigationCompleted wrapper which will have to translate the usual arguments used for marionette's helper to arguments compatible with the new version in remote/shared/Navigate.jsm. Or we can update existing call sites, depending on how verbose this will be.
In terms of tests, we can probably still rely on the existing coverage from marionette tests.
This bug was initially spawned from Bug 1664165 which aimed both at moving the helper to shared/Navigate.jsm and migrate it to use webprogresslistener. It's not clear if webprogresslistener can be used at the moment for the
eager PageLoadStrategy so we are splitting out this refactor to unblock other bugs in the milestone.