Repository navigation
JS Console capture can trigger web inspector detection and reaction on some websites - #50
Conversation
| navigator.webEngine = webEngine | ||
| let view = webEngine.webView | ||
| if let parent = view.parent as? ViewGroup { | ||
| parent.removeView(view) |
There was a problem hiding this comment.
Can you explain what this is doing?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Sounds good. No need to make a new PR.
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:
swift testCodex 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.capturesConsoleOutputdefaults totruefor 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)