Skip to content

fix(webview): avoid data url placeholder for child accounts (#884)#891

Merged
senamakel merged 2 commits intotinyhumansai:mainfrom
M3gA-Mind:fix/884-webview-placeholder-about-blank
Apr 24, 2026
Merged

fix(webview): avoid data url placeholder for child accounts (#884)#891
senamakel merged 2 commits intotinyhumansai:mainfrom
M3gA-Mind:fix/884-webview-placeholder-about-blank

Conversation

@M3gA-Mind
Copy link
Copy Markdown
Contributor

@M3gA-Mind M3gA-Mind commented Apr 24, 2026

Summary by CodeRabbit

  • Refactor

    • Updated the webview placeholder to use a URL fragment-based marker and removed title-based fallback, improving how webviews are identified and scoped to accounts.
  • Tests

    • Added unit tests verifying the new placeholder URL format and account-scoped target matching behavior.

Closes #884

@M3gA-Mind M3gA-Mind requested a review from a team April 24, 2026 16:11
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: eff18b4f-e323-43be-bf11-41c69b96c4cf

📥 Commits

Reviewing files that changed from the base of the PR and between 2d6f831 and 481a29a.

📒 Files selected for processing (1)
  • app/src-tauri/src/cdp/session.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src-tauri/src/cdp/session.rs

📝 Walkthrough

Walkthrough

Replaces the webview placeholder from a data:text/html URL to an about:blank#... URL with account markers in the fragment, updates CDP target selection to match by URL suffix (fragment) instead of title, and swaps the exported placeholder_data_url for placeholder_url.

Changes

Cohort / File(s) Summary
CDP public API & session logic
app/src-tauri/src/cdp/mod.rs, app/src-tauri/src/cdp/session.rs
Public API: remove placeholder_data_url, add placeholder_url. Implement about:blank#... placeholder format and a URL-suffix target matcher (target_matches_account_url). Update target selection to use URL matching. Add unit tests for placeholder format and matching.
Webview consumer
app/src-tauri/src/webview_accounts/mod.rs
Replace call to cdp::placeholder_data_url(...) with cdp::placeholder_url(...) for CEF webview initial URL; comments reformatted only.

Sequence Diagram(s)

sequenceDiagram
    participant Webview
    participant App (Caller)
    participant CDP_Session
    participant Browser_Targets

    App->>CDP_Session: call placeholder_url(account_id)
    CDP_Session-->>App: "about:blank#placeholder-{account_id}"
    App->>Webview: load URL "about:blank#placeholder-{account_id}"
    Webview->>Browser_Targets: create/load target with URL fragment
    CDP_Session->>Browser_Targets: list targets
    CDP_Session->>Browser_Targets: match target by URL suffix "#...{account_id}"
    Browser_Targets-->>CDP_Session: matched target
    CDP_Session->>App: attach to matched target
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I swapped the data for a tiny hash,
about:blank now carries the stash,
Fragments hop, accounts align,
CDP finds the target fine—
Hooray, a cleaner little cache! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing data URL placeholders with an about:blank approach for child account webviews.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/src-tauri/src/cdp/session.rs`:
- Around line 52-56: The match is too permissive in target_matches_account_url:
instead of matching target_url.ends_with(&marker) (which can hit non-placeholder
paths), require the fragment boundary by checking for a leading '#' before the
marker; update the check in target_matches_account_url to test for a suffix like
"#{marker}" (or build marker_with_hash = format!("#{}", marker)) and keep the
existing fragment comparison (fragment) as-is so only fragment-based
placeholders match.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7376ffb5-99ec-40bf-a241-e46d0a891ce8

📥 Commits

Reviewing files that changed from the base of the PR and between a3b0a78 and 2d6f831.

📒 Files selected for processing (3)
  • app/src-tauri/src/cdp/mod.rs
  • app/src-tauri/src/cdp/session.rs
  • app/src-tauri/src/webview_accounts/mod.rs

Comment thread app/src-tauri/src/cdp/session.rs
@M3gA-Mind M3gA-Mind changed the title fix(webview): avoid data url placeholder for child accounts fix(webview): avoid data url placeholder for child accounts (#884) Apr 24, 2026
@senamakel senamakel merged commit 7397d5c into tinyhumansai:main Apr 24, 2026
7 checks passed
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.

bug(cef): add_child fails with 'data URLs are not supported without webview-data-url'

2 participants