single-file-cli 2.7.1 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.sh +1 -1
- package/deno.json +1 -1
- package/lib/cdp-client.js +14 -10
- package/lib/single-file-archive.js +5 -5
- package/lib/single-file-bundle.js +1 -1
- package/lib/version.js +1 -1
- package/options.js +1 -0
- package/package.json +1 -1
- package/test/e2e/html-at-media-url.test.js +96 -0
- package/test/e2e/slow-response.test.js +45 -0
package/build.sh
CHANGED
package/deno.json
CHANGED
package/lib/cdp-client.js
CHANGED
|
@@ -618,17 +618,20 @@ async function waitForPageReadyState({ Page }, state, { options, debugMessages }
|
|
|
618
618
|
|
|
619
619
|
function createLifecycleEventHandler(state, timeoutState, resolve, cleanup, { options, debugMessages }) {
|
|
620
620
|
return ({ params }) => {
|
|
621
|
-
const { frameId, name } = params;
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
621
|
+
const { frameId, loaderId, name } = params;
|
|
622
|
+
// the frame keeps its ID across documents: the events of the blank page,
|
|
623
|
+
// whose network goes idle while the server has not answered yet, would
|
|
624
|
+
// satisfy the wait and the page would be captured as soon as it commits
|
|
625
|
+
if (frameId !== state.topFrameId || loaderId !== state.loaderId) {
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
logData(["Detecting lifecycle event", name], { options, debugMessages });
|
|
629
|
+
const stateIndex = NETWORK_STATES.indexOf(name);
|
|
630
|
+
if (stateIndex != -1 && (state.reachedStateIndex == -1 || stateIndex < state.reachedStateIndex)) {
|
|
631
|
+
state.reachedStateIndex = stateIndex;
|
|
628
632
|
}
|
|
629
|
-
const shouldResolve =
|
|
630
|
-
(name
|
|
631
|
-
(timeoutState.timeoutId && NETWORK_STATES.indexOf(name) < NETWORK_STATES.indexOf(options.browserWaitUntil)));
|
|
633
|
+
const shouldResolve = name === options.browserWaitUntil ||
|
|
634
|
+
(timeoutState.timeoutId && NETWORK_STATES.indexOf(name) < NETWORK_STATES.indexOf(options.browserWaitUntil));
|
|
632
635
|
if (shouldResolve) {
|
|
633
636
|
// the delay is restarted when the page reaches a further state, so
|
|
634
637
|
// that it is captured once it stopped settling
|
|
@@ -660,6 +663,7 @@ function createFrameNavigatedHandler(state, timeoutState, reject, cleanup, { opt
|
|
|
660
663
|
clearTimeout(timeoutState.timeoutId);
|
|
661
664
|
timeoutState.timeoutId = undefined;
|
|
662
665
|
state.reachedStateIndex = -1;
|
|
666
|
+
state.loaderId = frame.loaderId;
|
|
663
667
|
}
|
|
664
668
|
}
|
|
665
669
|
};
|