Skip to content

Experimental Go/wasm browser (SkywireGoBrowser) in the wasm visor - #11

Closed
0pcom wants to merge 1 commit into
developfrom
gobrowser-integration
Closed

Experimental Go/wasm browser (SkywireGoBrowser) in the wasm visor#11
0pcom wants to merge 1 commit into
developfrom
gobrowser-integration

Conversation

@0pcom

@0pcom 0pcom commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Adds an experimental alternative to netscrape's browse.js: a browser written in Go/wasm (0magnet/shipyard cmd/browser). Its chrome (tabs, address bar, back/forward, reload), page transcoding (renders in a sandboxed srcdoc, inlines stylesheets as <style> and images as data: URIs via a parent/sandbox postMessage relay), and navigation are all Go + syscall/js. Only the network is delegated, through the same skywireVisor.fetchDmsg / fetchClearnet the JS engine already uses.

Non-breaking

netscrape's browse.js is 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 by GoBrowserWasm(), served at /gobrowser.wasm (both the native HV page and hv serve).
  • pkg/wasmhv/browseui/gobrowser-loader.js — concatenated into the bundle; defines globalThis.SkywireGoBrowser.open(), which opens a winbox window, sets globalThis.__shipyardBrowserFetch (mesh hosts → fetchDmsg, else fetchClearnet), and instantiates the module against that window.
  • Re-exports in pkg/wasmhv/embed.go; serving cases in pkg/visor/hypervisor_handlers_browse.go and pkg/visor/wasmserve.go.

How to test

Open the visor page, then in the console:

SkywireGoBrowser.open()

A window should open; type example.com (clearnet) or a *.dmsg host (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 exact fetchDmsg/fetchClearnet signatures and return shapes, and WinBox().body. Native + wasm packages compile (go build ./pkg/wasmhv/... ./pkg/visor/...).

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.
@0pcom

0pcom commented Sep 4, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the upstream PR: skycoin#4469 (same branch).

@0pcom 0pcom closed this Sep 4, 2026
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.

1 participant