Skip to content

JS Console capture can trigger web inspector detection and reaction on some websites - #50

Merged
marcprux merged 1 commit into
skiptools:mainfrom
tifroz:tifroz/configurable-console-output
May 28, 2026
Merged

marcprux merged 1 commit into
skiptools:mainfrom
tifroz:tifroz/configurable-console-output

Conversation

@tifroz

@tifroz tifroz commented May 28, 2026

Copy link
Copy Markdown
Contributor

Thank you for contributing to the Skip project! Please use this space to describe your change and add any labels (bug, enhancement, documentation, etc.) to help categorize your contribution.

Please review the contribution guide at https://skip.dev/docs/contributing/ for advice and guidance on making high-quality PRs.

Skip Pull Request Checklist:

  • REQUIRED: I have signed the Contributor Agreement
  • REQUIRED: I have tested my change locally with swift test
  • OPTIONAL: I have tested my change on an iOS simulator or device
  • OPTIONAL: I have tested my change on an Android emulator or device

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Codex generated the code, visually confirmed by testing from a sandbox app


Context: some websites have defensive mechanisms in place to make web pages unusable when webtools are detected (web inspector etc...). For example the website will automatically redirect to the homepage to prevent inspection on their web pages

This PR makes console capture configurable with WebEngineConfiguration.capturesConsoleOutput. capturesConsoleOutput defaults to true for backward compatibility (if not for backward compatibility I think it would make sense to be defensive and make it an opt-in feature instead given the unexpected behavior on affected websites)

@cla-bot cla-bot Bot added the cla-signed label May 28, 2026
navigator.webEngine = webEngine
let view = webEngine.webView
if let parent = view.parent as? ViewGroup {
parent.removeView(view)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you explain what this is doing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, this is not part of the configurable console output change.

It’s an unrelated fix that I performed locally and forgot to submit as a PR so the 2 changes are lumped together. I can split it into a separate PR if you prefer?

About the reparenting fix: when Compose asks SkipWeb to render an existing engine again, the underlying native WebView may still be attached to an old ViewGroup. Android native views can only have one parent, so the next AndroidView mount can fail before layout. This detaches the reused WebView from its previous parent before handing it back to AndroidView.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds good. No need to make a new PR.

@marcprux
marcprux merged commit a71594f into skiptools:main May 28, 2026
2 checks passed
@tifroz
tifroz deleted the tifroz/configurable-console-output branch May 28, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants