Skip to content

Add toString() to Browser showing the underlying browser type#3259

Merged
vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:browser-tostring-backend
Apr 25, 2026
Merged

Add toString() to Browser showing the underlying browser type#3259
vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:browser-tostring-backend

Conversation

@vogella

@vogella vogella commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Override Browser.toString() to append the active browser backend (e.g. webkit, edge, ie, safari) returned by getBrowserType().
  • Makes it easy to identify which native browser implementation a Browser instance is using, both in the debugger and in log output, without having to drill into the internal webBrowser field.
  • The implementation calls webBrowser.getBrowserType() directly (with a null guard) instead of the public getBrowserType() method, because the public method calls checkWidget() which toString() is not expected to trigger (e.g. when called on a disposed widget or from a non-UI thread, mirroring Widget.toString() behavior).

Test plan

  • Open a Browser and inspect/print it; the result should look like Browser {} [webkit] (or the corresponding backend on Windows/macOS).
  • Inspect a disposed Browser and confirm toString() does not throw.

🤖 Generated with Claude Code

@vogella vogella requested a review from HeikoKlare April 21, 2026 11:14
@github-actions

github-actions Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Test Results

  182 files  ±0    182 suites  ±0   25m 26s ⏱️ - 1m 7s
4 723 tests ±0  4 700 ✅ ±0   23 💤 ±0  0 ❌ ±0 
6 812 runs  ±0  6 647 ✅ ±0  165 💤 ±0  0 ❌ ±0 

Results for commit 0f41fcb. ± Comparison against base commit aa1dbb8.

♻️ This comment has been updated with latest results.

Override Browser.toString() to append the active browser backend (e.g.
"webkit", "edge", "ie", "safari") returned by getBrowserType(). This
makes it easy to see in the debugger or in logs which native browser
implementation a Browser instance is using, without having to drill
into the internal webBrowser field.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@HeikoKlare HeikoKlare force-pushed the browser-tostring-backend branch from 2ec0b30 to 0f41fcb Compare April 24, 2026 14:38

@HeikoKlare HeikoKlare left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The change looks fine to me. Did you follow the test plan already? I don't see why it shouldn't work but probably still good to once test that the browser type is properly embedded into the toString() representation.

@vogella

vogella commented Apr 25, 2026

Copy link
Copy Markdown
Contributor Author

Browser {} [layout=null] [webkit]
Browser {Disposed} [layout=null] [webkit]

@vogella vogella merged commit cf37194 into eclipse-platform:master Apr 25, 2026
24 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.

2 participants