Skip to content

chrome: [wip]为 Chromium 运行器添加禁用 Web 安全策略参数#314

Open
zzcr wants to merge 2 commits intodevfrom
zzc/feat-add-chrome-args-0206
Open

chrome: [wip]为 Chromium 运行器添加禁用 Web 安全策略参数#314
zzcr wants to merge 2 commits intodevfrom
zzc/feat-add-chrome-args-0206

Conversation

@zzcr
Copy link
Member

@zzcr zzcr commented Feb 6, 2026

Pull Request (OpenTiny NEXT-SDKs)

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build-related changes
  • CI-related changes
  • Documentation-related changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Added action buttons to the side panel for custom operations and conversation export, along with an enhanced welcome section.
  • Chores

    • Updated development build configuration to improve browser compatibility during development workflows.

@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Walkthrough

Added a new Chromium launch argument --disable-web-security and retained --user-data-dir=./.wxt/chrome-data in Next‑Wxt config; updated the sidepanel App.vue to import Welcome from @opentiny/tiny-robot and expose operations and welcome slots with two header buttons and a welcome block.

Changes

Cohort / File(s) Summary
Chromium Configuration
packages/next-wxt/wxt.config.ts
Replaced single chromiumArgs entry with a two-item array: --disable-web-security and --user-data-dir=./.wxt/chrome-data.
Sidepanel UI
packages/next-wxt/entrypoints/sidepanel/App.vue
Added import Welcome from @opentiny/tiny-robot; introduced #operations slot with two buttons and a #welcome slot containing a welcome heading. No core logic changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibbled code beneath the moonlight,

Tweaked a flag and added a welcome sight.
Two buttons now atop the pane,
Chrome keeps its data, rules relax a lane.
Hops of joy for this small bite! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title focuses on adding a web security disable parameter to Chromium, but the actual changes include unrelated UI modifications (Welcome slot import and template changes in App.vue). Revise the title to either focus solely on the Chromium configuration change, or update it to reflect all changes: e.g., 'feat: Add Chromium web security disable option and custom header slots'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch zzc/feat-add-chrome-args-0206

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/next-wxt/wxt.config.ts`:
- Around line 16-19: The shared config currently forces '--disable-web-security'
in runner.chromiumArgs which is unsafe; change this to be opt-in by checking an
environment variable (e.g., WXT_DISABLE_WEB_SECURITY) before adding the flag to
chromiumArgs in wxt.config (reference runner.chromiumArgs and chromiumArgs
array), defaulting to not include the flag; also add a short inline comment
explaining the opt-in and update any local README or dev docs to mention how to
enable WXT_DISABLE_WEB_SECURITY for individual developers and why it should not
be enabled globally.

Comment on lines +16 to +19
chromiumArgs: [
'--disable-web-security', // 禁用 Web 安全策略
'--user-data-dir=./.wxt/chrome-data' // 设置用户数据目录
]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Unconditionally disabling web security for all developers is risky — consider making it opt-in.

Even though runner.chromiumArgs only affects wxt dev, committing --disable-web-security to the shared config means:

  1. Masked production bugs: CORS and same-origin violations that would surface in real browsers will be silently suppressed during development, leading to surprises at release time.
  2. Developer exposure: Any dev browsing untrusted sites in the same Chromium instance is vulnerable to cross-origin attacks.
  3. No stated rationale: The PR description doesn't explain which specific scenario requires disabling web security. If it's for a specific API/CORS workaround, that context should be documented.

Consider gating this behind an environment variable so individual developers can opt in when needed:

🛡️ Suggested opt-in approach
   runner: {
-    chromiumArgs: [
-      '--disable-web-security', // 禁用 Web 安全策略
-      '--user-data-dir=./.wxt/chrome-data' // 设置用户数据目录
-    ]
+    chromiumArgs: [
+      // 需要禁用 Web 安全策略时,设置环境变量 DISABLE_WEB_SECURITY=true
+      ...(process.env.DISABLE_WEB_SECURITY === 'true' ? ['--disable-web-security'] : []),
+      '--user-data-dir=./.wxt/chrome-data' // 设置用户数据目录
+    ]
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
chromiumArgs: [
'--disable-web-security', // 禁用 Web 安全策略
'--user-data-dir=./.wxt/chrome-data' // 设置用户数据目录
]
chromiumArgs: [
// 需要禁用 Web 安全策略时,设置环境变量 DISABLE_WEB_SECURITY=true
...(process.env.DISABLE_WEB_SECURITY === 'true' ? ['--disable-web-security'] : []),
'--user-data-dir=./.wxt/chrome-data' // 设置用户数据目录
]
🤖 Prompt for AI Agents
In `@packages/next-wxt/wxt.config.ts` around lines 16 - 19, The shared config
currently forces '--disable-web-security' in runner.chromiumArgs which is
unsafe; change this to be opt-in by checking an environment variable (e.g.,
WXT_DISABLE_WEB_SECURITY) before adding the flag to chromiumArgs in wxt.config
(reference runner.chromiumArgs and chromiumArgs array), defaulting to not
include the flag; also add a short inline comment explaining the opt-in and
update any local README or dev docs to mention how to enable
WXT_DISABLE_WEB_SECURITY for individual developers and why it should not be
enabled globally.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@packages/next-wxt/entrypoints/sidepanel/App.vue`:
- Around line 214-222: The operations and welcome slots currently contain
placeholder markup; replace the dead <button> placeholders in the template
`#operations` with real handlers or remove them: either wire the buttons to the
existing methods (e.g., add `@click` handlers that call exportConversation() or
customOperation()) or guard them behind a feature flag so they don't render in
production; and replace the raw <h1> in the `#welcome` slot with the imported
Welcome component (use <Welcome />) so the actual component is rendered instead
of static text; locate the slots named "operations" and "welcome" in App.vue and
update them accordingly.
- Line 8: The import list includes Welcome but the component isn't used; either
remove Welcome from the import statement that currently lists
TrSuggestionPillButton, TrDropdownMenu, Welcome, or actually use it in the
template (for example replace the plain <h1> inside the `#welcome` slot with the
<Welcome/> component) and update any component registrations if necessary;
modify the import/usage for Welcome accordingly so there are no unused imports.

import TinyUser from '@opentiny/vue-user'
import { useCustomMarketMcpServers } from './composable/useCustomMarketMcpServers'
import { TrSuggestionPillButton, TrDropdownMenu } from '@opentiny/tiny-robot'
import { TrSuggestionPillButton, TrDropdownMenu, Welcome } from '@opentiny/tiny-robot'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Welcome is imported but never used.

The Welcome component is added to the import but is not referenced anywhere in the template or script. If the #welcome slot (line 220) was intended to use this component, it currently renders a plain <h1> instead.

Proposed fix: remove unused import
-import { TrSuggestionPillButton, TrDropdownMenu, Welcome } from '@opentiny/tiny-robot'
+import { TrSuggestionPillButton, TrDropdownMenu } from '@opentiny/tiny-robot'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { TrSuggestionPillButton, TrDropdownMenu, Welcome } from '@opentiny/tiny-robot'
import { TrSuggestionPillButton, TrDropdownMenu } from '@opentiny/tiny-robot'
🤖 Prompt for AI Agents
In `@packages/next-wxt/entrypoints/sidepanel/App.vue` at line 8, The import list
includes Welcome but the component isn't used; either remove Welcome from the
import statement that currently lists TrSuggestionPillButton, TrDropdownMenu,
Welcome, or actually use it in the template (for example replace the plain <h1>
inside the `#welcome` slot with the <Welcome/> component) and update any component
registrations if necessary; modify the import/usage for Welcome accordingly so
there are no unused imports.

Comment on lines +214 to +222
<template #operations>
<!-- 自定义头部操作按钮 -->
<button>自定义操作</button>
<!-- 或者保留默认功能,添加额外按钮 -->
<button>导出对话</button>
</template>
<template #welcome>
<h1>欢迎使用</h1>
</template>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Placeholder slots with non-functional buttons — not ready for merge.

These slots look like scaffolding/example code rather than a production implementation:

  1. Lines 216 & 218: Both <button> elements lack @click handlers, meaning they render but do nothing. The inline comments (lines 215, 217) read like developer notes ("自定义头部操作按钮", "或者保留默认功能,添加额外按钮").
  2. Line 221: The #welcome slot renders a bare <h1> instead of using the imported Welcome component.

If these are intentional examples for a WIP branch, consider guarding them behind a feature flag or removing them until the functionality is implemented. Shipping dead buttons degrades the user experience.

🤖 Prompt for AI Agents
In `@packages/next-wxt/entrypoints/sidepanel/App.vue` around lines 214 - 222, The
operations and welcome slots currently contain placeholder markup; replace the
dead <button> placeholders in the template `#operations` with real handlers or
remove them: either wire the buttons to the existing methods (e.g., add `@click`
handlers that call exportConversation() or customOperation()) or guard them
behind a feature flag so they don't render in production; and replace the raw
<h1> in the `#welcome` slot with the imported Welcome component (use <Welcome />)
so the actual component is rendered instead of static text; locate the slots
named "operations" and "welcome" in App.vue and update them accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments