feat(libSceSystemService): open sceSystemServiceLaunchWebBrowser URLs in the host browser, opt-in with ANYPS5_OPEN_URLS #12895

Merged
MarcZX10 merged 38 commits from upstream-pr/12895 into main 2026-11-08 18:07:46 +00:00
MarcZX10 commented 2026-10-29 13:42:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T13:42:13Z.


What

sceSystemServiceLaunchWebBrowser (one URI argument; the null, 6015-byte and http:/https:/psno: checks already on main come from a measured library reading) returned EOPNOTSUPP for every valid address, so a title that asks for its browser (PPSA76677 falls back to a QR code) got nothing. It can now open the address in the host's default browser, opt-in through ANYPS5_OPEN_URLS=never|ask|always. Unset, empty and never keep today's result exactly.

Scope note: the requested target was libSceWebBrowserDialog, but no public source gives the layout of the sceWebBrowserDialogOpen parameter or the offset of its URL field (OpenOrbis-PS4-Toolchain @ 0a1aaf9dd4a92695538bdeb09fb056d06dd11725 include/orbis/WebBrowserDialog.h declares every function with no parameters; shadPS4 @ f68923fe807f657348e6719ce658bcbd0a2b1c72 webbrowserdialog.cpp takes none). The dialog is unchanged except for one debt line saying so. The store and profile dialogs carry ids, not URLs.

Design (all host-side, injected behind interfaces):

  • ValidateHostUrl: only http:// and https://, at most 2048 bytes, RFC 3986 characters only (so no control characters, spaces, non-ASCII or look-alike Unicode hosts), percent escapes well formed and not decoding to a control character, no credentials (user@, [email protected]), non-empty host (DNS names or IPv6 literals), port 1 to 65535.
  • IUrlLauncher and IUrlConfirmation; OpenUrlOnHost applies the mode. An address that fails the validator reaches neither backend in any mode.
  • Backends: posix_spawnp of xdg-open (Linux) or /usr/bin/open (macOS) with the address as a single argv element and stdio on /dev/null, never a shell; ShellExecuteW on Windows after revalidating the address. Each backend refuses anything that is not a valid URL by itself.
  • Confirmation: SDL_ShowMessageBox (SDL2-static is now linked into libSceSystemService) showing the whole address, Cancel as the default for Return/Escape; no display means no. It does not use or stack on the overlay dialogs of #12379 (no shared files; the conceptual overlap is "a host dialog"). A mutex serialises launches so two guest threads never stack boxes.
  • Results: launched returns 0 (the native success value is not measured, recorded as debt); declined, rejected, failed or disabled return the existing EOPNOTSUPP. An invalid ANYPS5_OPEN_URLS throws naming the variable at the first call past the argument checks.

Commits (22): validator + test; mode parsing + test; interfaces/policy + test; POSIX backend + test; Windows backend; POSIX launcher revalidation + test; SDL confirmation + test; wiring + test; env reference; usage; five debt statements (one per commit).

Overlap with open PRs: none edit the same lines. #12848 and #12752 also add rows/paragraphs to docs/dev/ENVIRONMENT.md and docs/user/USAGE.md and touch libSceSystemService (language and date format variables); #12285 touches libSceSystemService Export.cpp elsewhere. #12379 touches libSceMsgDialog and other CMake files, not these.

Tested

Linux x86_64, g++ 12, archive build with the host CPU gate patched (run_tests.sh).

  • Branch (built before the last two rebases, which only brought in unrelated upstream files; checks below re-run after): guest_system_service_open_url (new), guest_system_service, guest_system_service_language, guest_system_service_time_zone, guest_system_service_usb_storage, guest_system_service_app_title_id_{known,long,missing}, loadexec_arguments, guest_system_exit, guest_system_exit_parameters: 11/11 passed.
  • Baseline (upstream/main 5454cd2e45, second tree): the same ten existing tests, 10/10 passed, identical per test, so the default behaviour is unchanged (the existing test pins EOPNOTSUPP for http:, https:, psno: and the sourced error codes).
  • Negative controls (new test, mutation in the built tree, rebuild, ctest): 24 mutations, all aborted the test: credentials check removed, control-escape check removed, port upper bound, port zero, scheme prefix loosened, length limit raised, non-ASCII allowed, space allowed, empty host allowed, IPv6 characters unchecked, unknown mode returning never, variable name dropped from the message, policy without validation, ask skipping the question, always asking, never launching, launcher failure ignored, POSIX launcher without revalidation, POSIX launcher spawning sh, POSIX launcher reporting failure after spawn, confirmation wrap off, confirmation truncating, confirmation answering yes on SDL failure, wiring ignoring the mode, wiring always returning 0, wiring ignoring the environment, null-argument code changed. The failing line inside the test was not extracted (assertions use abort), so "intended case" is by construction of each mutation, not by line.
  • Checks: tools/check_conventions.py --base upstream/main, git diff --check, test_public_headers.py --audit-only, env_reference.py --check all clean on the final rebased head.
  • MinGW x86_64-w64-mingw32-g++ -fsyntax-only on the Windows backend.

NOT RUN: Windows (ShellExecuteW backend and SDL box), macOS (open backend, main-queue dispatch of the box), any real launch of a browser or a real message box (tests use a recording script and fakes; the Linux no-display test only proves the box answers no without a display), a Wayland-only session, a console, a title (PPSA76677). No test rebuild after the final two rebases (my files and the tests are unchanged). The unfixed code was not run against the new tests beyond the baseline list above.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5069106613 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12895). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T13:42:13Z. --- ### What `sceSystemServiceLaunchWebBrowser` (one URI argument; the null, 6015-byte and `http:`/`https:`/`psno:` checks already on main come from a measured library reading) returned `EOPNOTSUPP` for every valid address, so a title that asks for its browser (PPSA76677 falls back to a QR code) got nothing. It can now open the address in the host's default browser, opt-in through `ANYPS5_OPEN_URLS=never|ask|always`. Unset, empty and `never` keep today's result exactly. Scope note: the requested target was `libSceWebBrowserDialog`, but no public source gives the layout of the `sceWebBrowserDialogOpen` parameter or the offset of its URL field (OpenOrbis-PS4-Toolchain @ 0a1aaf9dd4a92695538bdeb09fb056d06dd11725 `include/orbis/WebBrowserDialog.h` declares every function with no parameters; shadPS4 @ f68923fe807f657348e6719ce658bcbd0a2b1c72 `webbrowserdialog.cpp` takes none). The dialog is unchanged except for one debt line saying so. The store and profile dialogs carry ids, not URLs. Design (all host-side, injected behind interfaces): - `ValidateHostUrl`: only `http://` and `https://`, at most 2048 bytes, RFC 3986 characters only (so no control characters, spaces, non-ASCII or look-alike Unicode hosts), percent escapes well formed and not decoding to a control character, no credentials (`user@`, `[email protected]`), non-empty host (DNS names or IPv6 literals), port 1 to 65535. - `IUrlLauncher` and `IUrlConfirmation`; `OpenUrlOnHost` applies the mode. An address that fails the validator reaches neither backend in any mode. - Backends: `posix_spawnp` of `xdg-open` (Linux) or `/usr/bin/open` (macOS) with the address as a single argv element and stdio on /dev/null, never a shell; `ShellExecuteW` on Windows after revalidating the address. Each backend refuses anything that is not a valid URL by itself. - Confirmation: `SDL_ShowMessageBox` (SDL2-static is now linked into libSceSystemService) showing the whole address, Cancel as the default for Return/Escape; no display means no. It does not use or stack on the overlay dialogs of #12379 (no shared files; the conceptual overlap is "a host dialog"). A mutex serialises launches so two guest threads never stack boxes. - Results: launched returns 0 (the native success value is not measured, recorded as debt); declined, rejected, failed or disabled return the existing `EOPNOTSUPP`. An invalid `ANYPS5_OPEN_URLS` throws naming the variable at the first call past the argument checks. Commits (22): validator + test; mode parsing + test; interfaces/policy + test; POSIX backend + test; Windows backend; POSIX launcher revalidation + test; SDL confirmation + test; wiring + test; env reference; usage; five debt statements (one per commit). Overlap with open PRs: none edit the same lines. #12848 and #12752 also add rows/paragraphs to `docs/dev/ENVIRONMENT.md` and `docs/user/USAGE.md` and touch libSceSystemService (language and date format variables); #12285 touches libSceSystemService `Export.cpp` elsewhere. #12379 touches `libSceMsgDialog` and other CMake files, not these. ### Tested Linux x86_64, g++ 12, archive build with the host CPU gate patched (`run_tests.sh`). - Branch (built before the last two rebases, which only brought in unrelated upstream files; checks below re-run after): `guest_system_service_open_url` (new), `guest_system_service`, `guest_system_service_language`, `guest_system_service_time_zone`, `guest_system_service_usb_storage`, `guest_system_service_app_title_id_{known,long,missing}`, `loadexec_arguments`, `guest_system_exit`, `guest_system_exit_parameters`: 11/11 passed. - Baseline (upstream/main 5454cd2e45, second tree): the same ten existing tests, 10/10 passed, identical per test, so the default behaviour is unchanged (the existing test pins `EOPNOTSUPP` for `http:`, `https:`, `psno:` and the sourced error codes). - Negative controls (new test, mutation in the built tree, rebuild, `ctest`): 24 mutations, all aborted the test: credentials check removed, control-escape check removed, port upper bound, port zero, scheme prefix loosened, length limit raised, non-ASCII allowed, space allowed, empty host allowed, IPv6 characters unchecked, unknown mode returning never, variable name dropped from the message, policy without validation, `ask` skipping the question, `always` asking, `never` launching, launcher failure ignored, POSIX launcher without revalidation, POSIX launcher spawning `sh`, POSIX launcher reporting failure after spawn, confirmation wrap off, confirmation truncating, confirmation answering yes on SDL failure, wiring ignoring the mode, wiring always returning 0, wiring ignoring the environment, null-argument code changed. The failing line inside the test was not extracted (assertions use `abort`), so "intended case" is by construction of each mutation, not by line. - Checks: `tools/check_conventions.py --base upstream/main`, `git diff --check`, `test_public_headers.py --audit-only`, `env_reference.py --check` all clean on the final rebased head. - MinGW `x86_64-w64-mingw32-g++ -fsyntax-only` on the Windows backend. NOT RUN: Windows (ShellExecuteW backend and SDL box), macOS (`open` backend, main-queue dispatch of the box), any real launch of a browser or a real message box (tests use a recording script and fakes; the Linux no-display test only proves the box answers no without a display), a Wayland-only session, a console, a title (PPSA76677). No test rebuild after the final two rebases (my files and the tests are unchanged). The unfixed code was not run against the new tests beyond the baseline list above. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!12895
No description provided.