Skip to content

WebContent crashes on reddit.com due to unimplemented Battery Status API (navigator.getBattery()) #8154

@devlouie

Description

@devlouie

Summary

Visiting https://www.reddit.com/ crashes the WebContent process. The crash is triggered by Google reCAPTCHA calling the unimplemented navigator.getBattery() API, which throws an unhandled TypeError in a promise, ultimately crashing the tab process.

Operating system

macOS

Steps to reproduce

  1. Launch Ladybird
  2. Navigate to https://www.reddit.com/
  3. Wait ~10 seconds for the page to load and reCAPTCHA to initialise

Expected behavior

Either:

  • navigator.getBattery() returns a rejected promise with a NotSupportedError (spec-compliant stub), or
  • The unhandled promise rejection is handled gracefully without crashing the WebContent process

Actual behavior

The WebContent process crashes with the following log output:

WebContent: [TypeError] Battery Status API is not yet implemented
    at <unknown>
    at <unknown>
    at https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:157:417
    at <unknown>
    at https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:1639:102
    at https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:1633:278
    at https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:583:368
    at <unknown>
    at OO (https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:1187:348)
    ...
Ladybird: WebContent process crashed! Last page loaded: https://www.reddit.com/
Ladybird: Consider raising an issue at https://github.com/LadybirdBrowser/ladybird/issues/new/choose

Reduced test case

URL: https://www.reddit.com/

Minimal HTML reproduction:

<!DOCTYPE html>
<html><body>
<script>
  navigator.getBattery().then(b => console.log(b));
</script>
</body></html>

Log output

WebContent(78620): FIXME: Unimplemented Navigator.maxTouchPoints
WebContent(78620): Potential FIXME: Returning from PerformanceObserver::observe() as we don't support the PerformanceEntry type 'navigation'
WebContent(78620): Potential FIXME: Returning from PerformanceObserver::observe() as we don't support the PerformanceEntry type 'longtask'
WebContent(78620): FIXME: Unimplemented IDL interface: 'StorageManagerPrototype.estimate'
WebContent(78620): [Unhandled JavaScript exception (in promise):] [TypeError] Battery Status API is not yet implemented
    at <unknown>
    at <unknown>
    at https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:157:417
    at <unknown>
    at https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:1639:102
    at https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:1633:278
    at https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:583:368
    at <unknown>
    at OO (https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:1187:348)
    at https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:673:472
    at <unknown>
    at https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:1638:229
    at <unknown>
    at run (https://www.gstatic.com/recaptcha/releases/P8cyHPrXODVy7ASorEhMUv3P/recaptcha__en.js:538:154)
    at <unknown>
Ladybird(75723): WebContent process crashed! Last page loaded: https://www.reddit.com/

Build info

  • Commit: 4b47245e99615433ed4ba046d77bf38b0947ccff
  • Platform: macOS (arm64 / Apple Silicon)
  • Build type: Release (default ./Meta/ladybird.py run)

Notes

There are two separate issues here that together cause the crash:

  1. navigator.getBattery() is unimplemented — the Battery Status API (W3C spec) should at minimum return a rejected promise rather than throwing a TypeError that propagates as an unhandled rejection.
  2. An unhandled promise rejection from third-party script (reCAPTCHA) is causing the entire WebContent process to crash, rather than being logged and discarded. This seems like the more critical robustness issue — unhandled rejections in untrusted page scripts should not be fatal to the process.

Reddit is a very high-traffic site. Fixing either of these would unblock it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions