mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
revert(browser): remove extraArgs config
This commit is contained in:
@@ -70,7 +70,6 @@ function buildSandboxBrowserResolvedConfig(params: {
|
||||
noSandbox: false,
|
||||
attachOnly: true,
|
||||
defaultProfile: DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME,
|
||||
extraArgs: [],
|
||||
profiles: {
|
||||
[DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME]: {
|
||||
cdpPort: params.cdpPort,
|
||||
|
||||
@@ -217,11 +217,6 @@ export async function launchOpenClawChrome(
|
||||
// Stealth: hide navigator.webdriver from automation detection (#80)
|
||||
args.push("--disable-blink-features=AutomationControlled");
|
||||
|
||||
// Append user-configured extra arguments (e.g., stealth flags, window size)
|
||||
if (resolved.extraArgs.length > 0) {
|
||||
args.push(...resolved.extraArgs);
|
||||
}
|
||||
|
||||
// Always open a blank tab to ensure a target exists.
|
||||
args.push("about:blank");
|
||||
|
||||
|
||||
@@ -149,37 +149,4 @@ describe("browser config", () => {
|
||||
expect(resolveProfile(resolved, "chrome")).toBe(null);
|
||||
expect(resolved.defaultProfile).toBe("openclaw");
|
||||
});
|
||||
|
||||
it("defaults extraArgs to empty array when not provided", () => {
|
||||
const resolved = resolveBrowserConfig(undefined);
|
||||
expect(resolved.extraArgs).toEqual([]);
|
||||
});
|
||||
|
||||
it("passes through valid extraArgs strings", () => {
|
||||
const resolved = resolveBrowserConfig({
|
||||
extraArgs: ["--no-sandbox", "--disable-gpu"],
|
||||
});
|
||||
expect(resolved.extraArgs).toEqual(["--no-sandbox", "--disable-gpu"]);
|
||||
});
|
||||
|
||||
it("filters out empty strings and whitespace-only entries from extraArgs", () => {
|
||||
const resolved = resolveBrowserConfig({
|
||||
extraArgs: ["--flag", "", " ", "--other"],
|
||||
});
|
||||
expect(resolved.extraArgs).toEqual(["--flag", "--other"]);
|
||||
});
|
||||
|
||||
it("filters out non-string entries from extraArgs", () => {
|
||||
const resolved = resolveBrowserConfig({
|
||||
extraArgs: ["--flag", 42, null, undefined, true, "--other"] as unknown as string[],
|
||||
});
|
||||
expect(resolved.extraArgs).toEqual(["--flag", "--other"]);
|
||||
});
|
||||
|
||||
it("defaults extraArgs to empty array when set to non-array", () => {
|
||||
const resolved = resolveBrowserConfig({
|
||||
extraArgs: "not-an-array" as unknown as string[],
|
||||
});
|
||||
expect(resolved.extraArgs).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,7 +31,6 @@ export type ResolvedBrowserConfig = {
|
||||
attachOnly: boolean;
|
||||
defaultProfile: string;
|
||||
profiles: Record<string, BrowserProfileConfig>;
|
||||
extraArgs: string[];
|
||||
};
|
||||
|
||||
export type ResolvedBrowserProfile = {
|
||||
@@ -197,10 +196,6 @@ export function resolveBrowserConfig(
|
||||
? DEFAULT_BROWSER_DEFAULT_PROFILE_NAME
|
||||
: DEFAULT_OPENCLAW_BROWSER_PROFILE_NAME);
|
||||
|
||||
const extraArgs = Array.isArray(cfg?.extraArgs)
|
||||
? cfg.extraArgs.filter((a): a is string => typeof a === "string" && a.trim().length > 0)
|
||||
: [];
|
||||
|
||||
return {
|
||||
enabled,
|
||||
evaluateEnabled,
|
||||
@@ -217,7 +212,6 @@ export function resolveBrowserConfig(
|
||||
attachOnly,
|
||||
defaultProfile,
|
||||
profiles,
|
||||
extraArgs,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,4 @@ export type BrowserConfig = {
|
||||
profiles?: Record<string, BrowserProfileConfig>;
|
||||
/** Default snapshot options (applied by the browser tool/CLI when unset). */
|
||||
snapshotDefaults?: BrowserSnapshotDefaults;
|
||||
/**
|
||||
* Additional Chrome launch arguments.
|
||||
* Useful for stealth flags, window size overrides, or custom user-agent strings.
|
||||
* Example: ["--window-size=1920,1080", "--disable-infobars"]
|
||||
*/
|
||||
extraArgs?: string[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user