feat(native-ui): locked-down webview element#7
Open
simonhamp wants to merge 5 commits into
Open
Conversation
Adds a <native:webview> leaf element for embedding web content, with a paranoid-by-default posture: JS off, no DOM storage, no file access, no JS bridge to the host, no new windows (target=_blank / window.open denied), mixed content blocked, non-persistent cookies/data store, and media playback requiring a user gesture. Hosts opt back into individual capabilities via `javascript` / `dom-storage` attributes. Content comes from `src` (https/http/data/about schemes only) or inline `html` (loaded with a null base URL, so it gets an opaque origin). Top-frame navigations fire `@navigated` with the resolved URL once committed; external schemes (mailto, tel, intent, ...) are dropped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Package renamed nativephp/native-ui -> nativephp/mobile-ui and the PHP
namespace Nativephp\NativeUi -> Native\Mobile\UI, matching the repo's
new home and bringing the plugin under the framework's Native\Mobile
namespace root (alongside Native\Mobile\Edge from nativephp/mobile).
Touches every class in src/, the PSR-4 mapping + provider FQCN in
composer.json, element/blade FQCNs and the plugin name in nativephp.json,
tests, docs, and namespace mentions in native-side comments. Platform
identifiers are intentionally unchanged: the Kotlin package
(com.nativephp.plugins.native_ui), Swift NativeUI* renderer names, the
manifest bridge namespace ("NativeUI"), and the native-ui config
key/publish tags.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The framework's PluginDiscovery and PluginValidateCommand both require type "nativephp-plugin" exactly; the old "nativephp-ui-plugin" value this test asserted would never be discovered. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
refactor(mobile-ui)!: rename package to nativephp/mobile-ui
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
<native:webview>leaf element (self-closing,<x-webview />in Blade) for embedding web content on both platforms —WKWebViewon iOS,android.webkit.WebViewon Android.Security posture
Defaults are paranoid by design; hosts opt back into individual capabilities via Blade attributes:
javascriptattribute to enable)dom-storageattribute to enable)target=_blank/window.open()silently denied on both platformsMIXED_CONTENT_NEVER_ALLOW)https/http/data/about; external schemes (mailto,tel,intent, …) are dropped rather than dispatched to the systemAPI
src— URL to load (loadable schemes only)html— inline HTML, loaded with a null base URL so it gets an opaque origin and can't make same-origin requests against the host app@navigated— fires once per committed top-frame navigation with the resolved URL (didCommiton iOS,onPageCommitVisibleon Android)Content reloads only when
src/htmlactually change (signature check), so recompositions/re-renders don't reset scroll position or flicker.Notes
self_closing: true— the renderers intentionally ignore children.applyA11yAttributes()wired in like the other elements.nativephp/mobile(pre-existing:mainalready targets unreleased Edge classes likeNative\Mobile\Edge\Element), so this was validated by manifest/class cross-check rather than pest.🤖 Generated with Claude Code