Fix: CLI: state load / profile persistence not usable in v0.7.6 (#268)

* Fix: CLI: state load / profile persistence not usable in v0.7.6

This PR addresses issue #259

* Fix issues identified in code review
This commit is contained in:
Chris Tate
2026-01-25 13:45:17 -06:00
committed by GitHub
parent ae09fdd431
commit 79863a5180
10 changed files with 439 additions and 134 deletions
+14
View File
@@ -819,6 +819,7 @@ export class BrowserManager {
const cdpEndpoint = options.cdpUrl ?? (options.cdpPort ? String(options.cdpPort) : undefined);
const hasExtensions = !!options.extensions?.length;
const hasProfile = !!options.profile;
const hasStorageState = !!options.storageState;
if (hasExtensions && cdpEndpoint) {
throw new Error('Extensions cannot be used with CDP connection');
@@ -828,6 +829,18 @@ export class BrowserManager {
throw new Error('Profile cannot be used with CDP connection');
}
if (hasStorageState && hasProfile) {
throw new Error(
'Storage state cannot be used with profile (profile is already persistent storage)'
);
}
if (hasStorageState && hasExtensions) {
throw new Error(
'Storage state cannot be used with extensions (extensions require persistent context)'
);
}
if (this.isLaunched()) {
const needsRelaunch =
(!cdpEndpoint && this.cdpEndpoint !== null) ||
@@ -912,6 +925,7 @@ export class BrowserManager {
userAgent: options.userAgent,
...(options.proxy && { proxy: options.proxy }),
ignoreHTTPSErrors: options.ignoreHTTPSErrors ?? false,
...(options.storageState && { storageState: options.storageState }),
});
}