Experimental Go/wasm browser (SkywireGoBrowser) in the wasm visor - #11
Closed
0pcom wants to merge 1 commit into
Closed
Experimental Go/wasm browser (SkywireGoBrowser) in the wasm visor#110pcom wants to merge 1 commit into
0pcom wants to merge 1 commit into
Conversation
An EXPERIMENTAL alternative to netscrape's browse.js — a browser written in Go/wasm (github.com/0magnet/shipyard cmd/browser). Its chrome (tabs, address bar, back/forward), page transcoding (sandboxed srcdoc, inlined stylesheets/images via a parent/sandbox relay), and navigation are all Go+syscall/js; only the network is delegated, through the same skywireVisor.fetchDmsg / fetchClearnet the JS engine uses. Additive and non-breaking — netscrape's browse.js is untouched. The module (gobrowser.wasm.gz, inflated by GoBrowserWasm()) is served at /gobrowser.wasm; gobrowser-loader.js (in the bundle) exposes globalThis.SkywireGoBrowser.open(), which opens a winbox window, wires the transport (mesh hosts → fetchDmsg, else fetchClearnet), and instantiates the module. Built without a running visor to test against — open the visor page and call SkywireGoBrowser.open() in the console to try it; the transport wiring in gobrowser-loader.js (fetchDmsg/fetchClearnet signatures, WinBox .body) is the most likely thing to need adjusting to the live API.
Owner
Author
|
Superseded by the upstream PR: skycoin#4469 (same branch). |
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.
Adds an experimental alternative to netscrape's
browse.js: a browser written in Go/wasm (0magnet/shipyardcmd/browser). Its chrome (tabs, address bar, back/forward, reload), page transcoding (renders in a sandboxedsrcdoc, inlines stylesheets as<style>and images asdata:URIs via a parent/sandbox postMessage relay), and navigation are all Go +syscall/js. Only the network is delegated, through the sameskywireVisor.fetchDmsg/fetchClearnetthe JS engine already uses.Non-breaking
netscrape's
browse.jsis untouched and still the default. This only adds a launcher.What it wires
pkg/wasmhv/browseui/gobrowser.wasm.gz— the module (632 KB gz), inflated byGoBrowserWasm(), served at/gobrowser.wasm(both the native HV page andhv serve).pkg/wasmhv/browseui/gobrowser-loader.js— concatenated into the bundle; definesglobalThis.SkywireGoBrowser.open(), which opens a winbox window, setsglobalThis.__shipyardBrowserFetch(mesh hosts →fetchDmsg, elsefetchClearnet), and instantiates the module against that window.pkg/wasmhv/embed.go; serving cases inpkg/visor/hypervisor_handlers_browse.goandpkg/visor/wasmserve.go.How to test
Open the visor page, then in the console:
A window should open; type
example.com(clearnet) or a*.dmsghost (mesh) in the address bar.Built blind — please poke at it
I built this without a running visor to test against. The likely spots needing adjustment to the live API are in
gobrowser-loader.js: the exactfetchDmsg/fetchClearnetsignatures and return shapes, andWinBox().body. Native + wasm packages compile (go build ./pkg/wasmhv/... ./pkg/visor/...).