Skip to content

Remove legacy vendor-prefixed DOM APIs and fallbacks#27347

Merged
sbc100 merged 2 commits into
emscripten-core:mainfrom
sbc100:cleanup_fullscreen_api
Jul 14, 2026
Merged

Remove legacy vendor-prefixed DOM APIs and fallbacks#27347
sbc100 merged 2 commits into
emscripten-core:mainfrom
sbc100:cleanup_fullscreen_api

Conversation

@sbc100

@sbc100 sbc100 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Remove references to mozRequestFullScreen, msRequestFullscreen,
mozCancelFullScreen, msExitFullscreen, cancelFullScreen,
mozfullscreenchange, and MSFullscreenChange across libbrowser.js
and libglfw.js. Convert bracket notation
(canvasContainer['requestFullscreen'], document['exitFullscreen'])
to standard dot notation.

In libhtml5.js, remove document.mozFullScreenElement,
document.webkitCurrentFullScreenElement, and
document.msFullscreenElement from $getFullscreenElement(), leaving
document.fullscreenElement and document.webkitFullscreenElement
(guarded by MIN_SAFARI_VERSION). Also remove
screen.mozLockOrientation, screen.webkitLockOrientation,
screen.mozUnlockOrientation, and screen.webkitUnlockOrientation
from emscripten_lock_orientation and emscripten_unlock_orientation.

In libbrowser.js, libopenal.js, and closure-externs.js, remove
obsolete mozGetUserMedia, msGetUserMedia, and webkitGetUserMedia
fallbacks and extern definitions, and transition getUserMedia calls
from the deprecated callback API (navigator.getUserMedia) to standard
Promise-based navigator.mediaDevices.getUserMedia.

These prefixed properties and fallbacks are safe to remove because:

  1. Fullscreen, Screen Orientation, and MediaDevices APIs became
    unprefixed standards across Firefox, Chrome, and Safari years ago
    (e.g. requestFullscreen in Firefox 64 / Chrome 71,
    navigator.mediaDevices.getUserMedia in Chrome 53 / Firefox 38 / Safari
    11). Emscripten's minimum supported browser versions
    (MIN_FIREFOX_VERSION = 79, MIN_CHROME_VERSION = 85) are well beyond
    when these unprefixed properties and methods became standard across
    major engines.
  2. IE and legacy Edge (ms prefix) and Firefox OS (moz prefixes) are
    no longer supported.
  3. Safari < 16.4 still requires webkit prefixes for Fullscreen, so
    webkitRequestFullscreen, webkitExitFullscreen,
    webkitfullscreenchange, and webkitFullscreenElement are retained
    where appropriate.

@sbc100 sbc100 force-pushed the cleanup_fullscreen_api branch from 186b3c4 to 85231ff Compare July 14, 2026 17:38
@sbc100 sbc100 requested review from dschuff and kripken July 14, 2026 17:38
@sbc100

sbc100 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

I you prefer I could split this up like I did with #27341, #27339, #27338, #27340. This change seems fairly reasonable as is though.

@sbc100 sbc100 force-pushed the cleanup_fullscreen_api branch 3 times, most recently from 24af87d to d883ab7 Compare July 14, 2026 17:47
Comment thread src/lib/libbrowser.js Outdated
@sbc100 sbc100 force-pushed the cleanup_fullscreen_api branch from d883ab7 to 0464dca Compare July 14, 2026 18:49
@sbc100

sbc100 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

I updated the webkitRequestFullscreen usage to apply only for safari < 16.4

@sbc100 sbc100 force-pushed the cleanup_fullscreen_api branch 2 times, most recently from ba322df to 2772bb3 Compare July 14, 2026 18:56
@sbc100 sbc100 requested a review from kripken July 14, 2026 19:14
@sbc100 sbc100 force-pushed the cleanup_fullscreen_api branch from 2772bb3 to 95087f4 Compare July 14, 2026 19:24
slouken pushed a commit to libsdl-org/SDL that referenced this pull request Jul 14, 2026
This modern navigator.mediaDevices.getUserMedia has been
available since Chrome 53 / Firefox 38 / Safari 11.

See emscripten-core/emscripten#27347
slouken pushed a commit to libsdl-org/SDL that referenced this pull request Jul 14, 2026
This modern navigator.mediaDevices.getUserMedia has been
available since Chrome 53 / Firefox 38 / Safari 11.

See emscripten-core/emscripten#27347

(cherry picked from commit 31bd4ff)
slouken pushed a commit to libsdl-org/SDL that referenced this pull request Jul 14, 2026
This modern navigator.mediaDevices.getUserMedia has been
available since Chrome 53 / Firefox 38 / Safari 11.

See emscripten-core/emscripten#27347
Comment thread src/lib/libbrowser.js Outdated
Comment thread src/lib/libbrowser.js Outdated
Comment thread src/lib/libbrowser.js Outdated
@sbc100 sbc100 force-pushed the cleanup_fullscreen_api branch 2 times, most recently from 89bd1af to 1b09445 Compare July 14, 2026 20:37

@kripken kripken 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.

lgtm though I would still recommend manual testing here, ideally including safari, but even without, I don't think we have automatic tests that actually verify fullscreen works.

@sbc100

sbc100 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

I think @juj runs the whole browser test suite on Safari. We don't do any in our CI I'm afraid, although we arguably should do at least some!

To really test this change we would need to test to also test on safari older then 16.4.

I will manually test chrome and ff interactive full screen tests.

Remove references to `mozRequestFullScreen`, `msRequestFullscreen`,
`mozCancelFullScreen`, `msExitFullscreen`, `cancelFullScreen`,
`mozfullscreenchange`, and `MSFullscreenChange` across `libbrowser.js`
and `libglfw.js`. Convert bracket notation
(`canvasContainer['requestFullscreen']`, `document['exitFullscreen']`)
to standard dot notation.

In `libhtml5.js`, remove `document.mozFullScreenElement`,
`document.webkitCurrentFullScreenElement`, and
`document.msFullscreenElement` from `$getFullscreenElement()`, leaving
`document.fullscreenElement` and `document.webkitFullscreenElement`
(guarded by `MIN_SAFARI_VERSION`). Also remove
`screen.mozLockOrientation`, `screen.webkitLockOrientation`,
`screen.mozUnlockOrientation`, and `screen.webkitUnlockOrientation`
from `emscripten_lock_orientation` and `emscripten_unlock_orientation`.

In `libbrowser.js`, `libopenal.js`, and `closure-externs.js`, remove
obsolete `mozGetUserMedia`, `msGetUserMedia`, and `webkitGetUserMedia`
fallbacks and extern definitions, and transition `getUserMedia` calls
from the deprecated callback API (`navigator.getUserMedia`) to standard
Promise-based `navigator.mediaDevices.getUserMedia`.

These prefixed properties and fallbacks are safe to remove because:
1. Fullscreen, Screen Orientation, and MediaDevices APIs became
unprefixed standards across Firefox, Chrome, and Safari years ago
(e.g. `requestFullscreen` in Firefox 64 / Chrome 71,
`navigator.mediaDevices.getUserMedia` in Chrome 53 / Firefox 38 / Safari
11). Emscripten's minimum supported browser versions
(`MIN_FIREFOX_VERSION = 79`, `MIN_CHROME_VERSION = 85`) are well beyond
when these unprefixed properties and methods became standard across
major engines.
2. IE and legacy Edge (`ms` prefix) and Firefox OS (`moz` prefixes) are
no longer supported.
3. Safari < 16.4 still requires `webkit` prefixes for Fullscreen, so
`webkitRequestFullscreen`, `webkitExitFullscreen`,
`webkitfullscreenchange`, and `webkitFullscreenElement` are retained
where appropriate.
@sbc100 sbc100 force-pushed the cleanup_fullscreen_api branch from 1b09445 to a9c46cf Compare July 14, 2026 21:17
@sbc100 sbc100 force-pushed the cleanup_fullscreen_api branch from a9c46cf to 137373d Compare July 14, 2026 21:59
@sbc100

sbc100 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

I tested locally with chrome and firefox using interactive.test_html5_fullscreen and interactive.test_html5_emscripten_exit_fullscreen

@sbc100 sbc100 enabled auto-merge (squash) July 14, 2026 22:09
@sbc100 sbc100 merged commit ee5cacb into emscripten-core:main Jul 14, 2026
39 checks passed
@sbc100 sbc100 deleted the cleanup_fullscreen_api branch July 14, 2026 22:56
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