Skip to content

[gecko] Port SailfishOS Gecko and EmbedLite to Firefox ESR 153.2. JB#64963 - #192

Closed
abranson wants to merge 45 commits into
masterfrom
sailfishos-esr153
Closed

abranson wants to merge 45 commits into
masterfrom
sailfishos-esr153

Conversation

@abranson

@abranson abranson commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Upgrade Gecko from ESR115.39 to ESR153.2.0 and rebase the Sailfish patch stack.

  • Replace legacy EmbedLiteView IPC, custom process/thread backends and local docshells with Gecko chrome windows and remote tabs. Run the parent runtime on the application's Qt main thread.
  • Enable Fission site isolation, per-document helpers and cross-process find, selection, clipboard and prompt routing.
  • Preserve private browsing contexts from initial process creation through subsequent process switches.
  • Move video decoding, including gecko-camera, into RDD and audio decoding into the utility process. Gecko OS sandboxes remain disabled.
  • Enable BFCache following Android Firefox's RAM-based limits, capped at eight viewers with six-minute expiry.
  • Port Qt widgets, native dialogs, clipboard, input, display scaling and orientation to ESR153.
  • Update WebRender/EGL, APZ, media/WebRTC, profile initialization, dependencies and ARM/RPM build support.

abranson and others added 26 commits September 5, 2026 23:09
Establish the Firefox ESR153 package baseline with the carried Sailfish Qt,
EmbedLite, media, rendering, and packaging patch stack.

Co-authored-by: Matti Lehtimäki <matti.lehtimaki@jolla.com>
Route child messages through one per-view ChromeMessageSender parented to
the global manager and project the already-deserialized value to the legacy
JSON API.

Queue same-process asynchronous delivery and write parsed synchronous JSON
replies into fresh structured-clone holders. Add focused contract tests.
Serialize popup construction state through EmbedLite IPC and restore the
ESR153 browsing context, initial window global, and open-window data before
creating the web browser.

Keep the windowless standalone fallback separate, reject unsupported legacy
remote creation, and add focused initialization contract coverage.

Co-authored-by: Sebastian Matkovich <38816871+smatkovi@users.noreply.github.com>
Replace the removed nsIDOMWindowUtils API with the current
nsContentUtils helper. Preserve the existing pressure, button state, touch
input source, and synthesized-event semantics.

Co-authored-by: Sebastian Matkovich <38816871+smatkovi@users.noreply.github.com>
EmbedLite overrides nsIXULRuntime but left its Fission queries
unimplemented and reported e10s as disabled. Delegate to Gecko canonical
session decisions so environment, preference, and child-process state remain
consistent.

Remove the obsolete disableSessionHistoryInParent preference, which no
longer exists in ESR153.
Co-authored-by: Sebastian Matkovich <38816871+smatkovi@users.noreply.github.com>
Follow ESR153 nsIWidget creation, geometry, listener and event-dispatch
contracts while preserving EmbedLite asynchronous paint and chrome-host
routing.

Update removed helper APIs, keyboard tables, profiler initialization and
ignored-result handling across the remaining EmbedLite sources.

Co-authored-by: Sebastian Matkovich <38816871+smatkovi@users.noreply.github.com>
Implement the ESR153 synchronous native clipboard size contract using the
UTF-16 byte count, clearing temporary text before returning
NS_ERROR_CLIPBOARD_TOO_BIG.
Supply the required decoder module name and remove obsolete Unused handling
from asynchronous camera callbacks.

Co-authored-by: Sebastian Matkovich <38816871+smatkovi@users.noreply.github.com>
Update driver-info ownership, picker initialization, print promises, screen
construction, and sound interfaces for ESR153.

Co-authored-by: Sebastian Matkovich <38816871+smatkovi@users.noreply.github.com>
Carry the Qt XDG directory guards as a managed Gecko patch.

Co-authored-by: Sebastian Matkovich <38816871+smatkovi@users.noreply.github.com>
Check the injected host LLVM library outside SB2 target-path mapping so
AArch64 can stage its bindgen dependencies.

Enable llama.cpp half precision explicitly for ARM32 GCC and keep generic
target CFLAGS out of accelerated Rust host compilations.
Bash implements test as a builtin, so its temporary variable assignment
does not start a process that can disable SB2 path mapping. Use the
external coreutils binary like the surrounding host-tool commands.
Disable the unsupported Utility decoder process and allow audio platform
decoder modules to run in the browser process. This keeps AAC and MP3
playback alongside the existing local gecko-camera video path.

Bump the package release for deployment.
EmbedLite does not traverse the Firefox application directory, so
package BrowserWindowTracker explicitly for toolkit consumers such as
NewTabUtils.

Bump the package release to 17.
Resolve picker endpoints from their BrowsingContext so hosted Fission tabs
do not fall back to an unrelated legacy window.

Keep hosted endpoint IDs representable by QML int properties and deliver
native responses before content re-entry, matching legacy ordering. Add
coverage for the signed boundary and wraparound.

Bump the package release to 21.
Run Gecko on the Qt application main thread and create hosted chrome windows
directly in the browser parent. Keep logical tabs remote so Firefox creates
ordinary Web Content processes for documents.

Delete the legacy thread, process, and local-docshell backends instead of
retaining an alternate mode or fallback. Publish hosted widget layout before
matching compositor geometry during rotation.

Re-export the managed Firefox patch stack as 87 sequential patches while
keeping the nested gitlink on the clean ESR153 base.

Also defer location updates until a watcher exists and harden Qt event-loop
shutdown against queued native callbacks.
Hold hosted window parents alive while notifying embedders and stop replay
when teardown starts. Iterate window IDs during application shutdown so a
callback that destroys another window cannot leave a stale pointer behind.
Handle popup closure in EscapablePageParent.leaveErrorPage so certificate
and other escapable error pages follow the same policy. Close a top-level
popup that has a cross-group opener; preserve the existing history and
safe-page handling otherwise.

Bump the package release to 25.
Drop obsolete pre-hosted patches and move prompt, net-error presentation,
and download behavior into embedding components where appropriate.

Retain only narrow Gecko actor and component hooks, port the Mesa
surfaceless WebGL context fix, and re-export 73 contiguous patches.
Install the desktop module in the application-root modules directory. Toolkit
imports it through resource:///modules in the unified EmbedLite application.
Notify profile-do-change before constructing EmbedLite startup services.
Their module imports can open Remote Settings IndexedDB immediately, which
otherwise races QuotaManager profile initialization.
Hosted browser elements are constructed directly by C++ and do not gain
the browser custom element's messageManager getter. Fall back to the
native frame loader's message manager so frame scripts and external
message listeners attach to hosted tabs.
Defer orientation acknowledgements until a post-resize MozAfterPaint
transaction. Include painted content geometry so embedders can hold the
transition mask until layout for the new orientation is ready.
Replay the 73-patch Sailfish stack on Firefox 153.2.0.
WebGL2 requests PREFER_ES3 just like the offscreen WebRender compositors.
On hybris with an active borrowed Qt display, the compositor fallback
therefore rejected WebGL2 context creation too, with an empty failure ID.

Require an explicit ALLOW_SHARED_CONTEXT_FALLBACK flag for that path and
set it in the two offscreen compositor callers. WebGL retains its own
context creation while WebRender can still reuse SingletonGL and its
shader objects. Preserve Mesa and display ownership handling.
Remove obsolete preference overrides and their stale comments while
preserving active tuning. Correct the hover-text colour preference to
match the current look-and-feel table.

Replace gl.msaa-level with webgl.msaa-samples so WebGL contexts disable
MSAA as intended. Match Firefox Android's grayscale text antialiasing
policy and 0.06-inch touch-start tolerance to reduce the finger movement
needed to begin scrolling (Mozilla bug 1230077).
Mesa Wayland displays can lack pbuffer EGL configurations just like the
supported hybris path. Extend patch 74's explicitly compositor-only fallback
to all borrowed Qt displays while leaving WebGL context creation independent.
A fixed non-zoomable viewport can arrive after the fallback viewport has
already been shrunk to fit. Ensure first paint applies the document initial
resolution so layout and visual viewport coordinates remain aligned.
Make debug_package empty so callers cannot generate debug subpackages.
Assign the final RemoteType before enabling remoteness for a new browser.
Use opening attributes synchronized with the chrome private state so initial
navigation does not require a process switch.
Clarify that Gecko's parent runtime shares the Sailfish application process
and Qt main thread. Describe the initial private remote type and the
hosted Qt Quick rendering path used by normal, private and captive tabs.
Mark hosted windows for Fission and load the browser custom-element
bootstrap needed for remoteness changes. Remove the obsolete COOP
process-switch override.

Run document helpers through window actors in every frame. Route native
commands and replies to their owning documents, transform shared geometry
once, and invalidate pending requests during teardown and BFCache changes.

Use Gecko's parent-side Finder and per-frame actors to search across
process boundaries, including next/previous wrapping. Discard cancelled
or stale search replies and avoid initializing an unused finder on close.

Document the updated initialization path and cover frame routing,
geometry aliases, BFCache request lifetimes, and cross-frame find.
Enable remote video and utility audio decoding for EmbedLite, including
Fission subframes. Register the Qt app shell in utility processes so their
event loop remains alive, and use minimal QPA in both decoder processes.

Keep gecko-camera decoding out of content while RDD is enabled and disable
non-utility audio fallback. Package the decoder changes as upstream patches
and document the process architecture with OS sandboxing still disabled.
Enable parent-owned back/forward caching for EmbedLite and size its
capacity automatically using Android limits on Qt builds. Retain the
six-minute viewer timeout and document the distinction from persistent
Sailfish session data.
Acquire platform frames through ProducerReadAcquire instead of deferring
unready frames to a retry timer. Pin the frame in the Acquiring state and
release the frame-list lock before waiting, preserving frame ownership
while avoiding the extra presentation delay.
Replace an unclaimed ready image when a newer composite is published,
instead of retaining the older token and forcing another render after
acquisition. This reduces stale-frame catch-up during scrolling.

Keep acquiring, acquired and released images pinned until their existing
lifetime and fence requirements are satisfied. Document that a ready
token can be superseded before acquisition starts.
@abranson

Copy link
Copy Markdown
Member Author

Note that this PR is obsolete: a new repo without the full gecko git history has been created, with embedlite-components merged in. This branch has been kept in line with that for review purposes, but should not be merged. Well, it could be, but won't be used.

NS_ENSURE_SUCCESS(rv, rv);
}

XULFrameElement* xulBrowser = XULFrameElement::FromNode(browser);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we're not using xul anywhere in our user interface, are you sure that this is what we should be using here? Given that it doesn't bring anything that is not wanted, I'm ok with it.

@abranson abranson Sep 28, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how we use the remote-browser mechanism of Gecko instead of the previous EmbedLite process management. It's the host that connect to and relays the tab content into the browser application. The new implementation replaces a ton of that stuff with Gecko’s standard remote-browser machinery through <browser>.

return true;
}

bool EmbedLiteHostedWindow::LoadURL(const nsACString& aURL,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not return void when this is always succeeding? Same for other similar methods.

}

bool EmbedLiteWindowParent::ScrollTo(uint64_t aTabId, int32_t aX, int32_t aY)
{ return CanTargetContentTab(aTabId) &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coding style wise this is messy. There was another similar class as well.

@rainemak rainemak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read through all changes. Also https://github.com/sailfishos/embedlite-components/pull/111/changes

LGTM, few minor coding style related notes. Please check those.

Return void from private hosted-window commands that always succeed,
while preserving validation and Boolean results at their callers.

Expand compressed forwarding methods and align continuation parameters
in the hosted window and its parent.
Revalidate tabs after synchronous snapshot callbacks before notifying the
embedder. Retain planar camera buffers without argument-order hazards,
and restore the native colour scheme for ambience mode.
Retain command objects across synchronous callbacks and reject unavailable
user-agent targets. Reset the restore latch on rejection while preserving
reentrant duplicate protection.
Use the pristine ESR153.3 release from the official Mozilla repository
and refresh the existing Sailfish patch context. Preserve the XULRunner
package identity and versioned installation paths.
Keep the Gecko tab order aligned with page-opened tabs and remove the
correct record if creating the new browser fails.
Pin the pristine ESR153.4 release and regenerate the legacy RPM patch stack
from managed source commits. Adapt APZ DPI and keyboard setup and its test
double to the updated upstream input bridge API.
@abranson abranson closed this Oct 2, 2026
@abranson

abranson commented Oct 2, 2026

Copy link
Copy Markdown
Member Author

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.

2 participants