| window_manager.py |
const [handle, resolve] = arguments;
const { NavigableManager } = ChromeUtils.importESModule(
"chrome://remote/content/shared/NavigableManager.sys.mjs"
);
const isLoaded = window =>
window?.document.readyState === "complete" &&
!window?.document.isUncommittedInitialDocument;
const browsingContext = NavigableManager.getBrowsingContextById(handle);
const targetWindow = browsingContext?.window;
if (isLoaded(targetWindow)) {
resolve();
} else {
const onLoad = () => {
if (isLoaded(targetWindow)) {
targetWindow.removeEventListener("load", onLoad);
resolve();
} else {
dump(`** Target window not loaded yet. Waiting for the next "load" event\n`);
}
};
targetWindow.addEventListener("load", onLoad);
}
|
8710 |