Skip to content

web: Improve navigator.plugins and navigator.mimeTypes so they can be used with JSON.stringify #20033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2025

Conversation

evilpie
Copy link
Collaborator

@evilpie evilpie commented Apr 6, 2025

To make JSON.stringify work with navigator.plugins and navigator.mimeTypes we have to make sure all enumerable properties are non-cyclic.

It seems like in a normal browser e.g. navigator.mimeTypes["application/pdf"] (all names) and navigator.plugins["PDF Viewer"] are not enumerable. So I switched to using Object.defineProperty for those.

To hide our internal private variables I switched those to ECMAScript Private Fields. This also prevents them from being enumerated of course.

RufflePlugin didn't use getters so I fixed this as well for consistency with the browser Plugin type.

Fixes #19957

@evilpie evilpie added the A-web Area: Web & Extensions label Apr 6, 2025
@danielhjacobs danielhjacobs added the T-fix Type: Bug fix (in something that's supposed to work already) label Apr 7, 2025
@danielhjacobs
Copy link
Contributor

Note: Use of private variables stretches to the edge of our minimum supported browser versions for some browsers, that's fine but just worth noting: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_properties#browser_compatibility

@evilpie evilpie merged commit 0223eb0 into ruffle-rs:master Apr 7, 2025
20 checks passed
Hancock33 added a commit to Hancock33/batocera.piboy that referenced this pull request Apr 20, 2025
--------------------------------------------------------------------------------------------------------
batocera-emulationstation.mk fb7b406cbaa444010577f445992777416bdddb38 # Version: Commits on Apr 08, 2025
--------------------------------------------------------------------------------------------------------
Merge pull request #1902 from Tartifless/master

Add VC4000 platform and screenscraper ID,

------------------------------------------------------------------------------------------------
batocera-es-piboy.mk fb7b406cbaa444010577f445992777416bdddb38 # Version: Commits on Apr 08, 2025
------------------------------------------------------------------------------------------------
Merge pull request #1902 from Tartifless/master

Add VC4000 platform and screenscraper ID,

-------------------------------------------------------------------------------------
azahar.mk 8d769ed9cb3935dce8193e07cda3f6e8dd855f52 # Version: Commits on Apr 08, 2025
-------------------------------------------------------------------------------------
Fix typo in README.md,

------------------------------------------------------------------------------------------
dolphin-emu.mk 01363572cbd6905e0427116fdf75fad66d99d81d # Version: Commits on Apr 08, 2025
------------------------------------------------------------------------------------------
Merge pull request #13483 from Sam-Belliveau/fixed_playback_speed

Use Doubles for Sample Rate Conversion,

------------------------------------------------------------------------------------------
duckstation.mk 182ba2aa7f516b7583b6a853ee3255cbf35bbf8c # Version: Commits on Apr 08, 2025
------------------------------------------------------------------------------------------
SPU: Devel build fix,

--------------------------------------------------------------------------------------
openmsx.mk 46d9f483c70f1d862bcacc5816dd580633e78847 # Version: Commits on Apr 08, 2025
--------------------------------------------------------------------------------------
better looking palette widget (#1886),

----------------------------------------------------
pcsx2.mk v2.3.261 # Version: Commits on Apr 08, 2025
----------------------------------------------------
- [Qt/Cheats: Add tooltip to cheat descriptions](PCSX2/pcsx2#12498)

,

-------------------------------------------------------------------------------------
ppsspp.mk 8d555d2820b0d9a0fb6523ae88506237da186117 # Version: Commits on Apr 08, 2025
-------------------------------------------------------------------------------------
Update the fixed IPs for MOHH to the current ones, oops.,

------------------------------------------------------------------------------------
rpcs3.mk 87d8bebd0d1b5ef2e10bc14d5c4f64cdd4d1e1a3 # Version: Commits on Apr 08, 2025
------------------------------------------------------------------------------------
PPU LLVM: Fixup MTFSF,

---------------------------------------------------------------
ruffle.mk nightly-2025-04-08 # Version: Commits on Apr 08, 2025
---------------------------------------------------------------
## What's Changed

* chore: Update translations by @RuffleBuild in ruffle-rs/ruffle#20018

* build(deps): bump the cargo-minor group with 8 updates by @dependabot in ruffle-rs/ruffle#20036

* chore: Fix errors of clippy beta by @kjarosh in ruffle-rs/ruffle#20006

* web: Improve navigator.plugins and navigator.mimeTypes so they can be used with JSON.stringify by @evilpie in ruffle-rs/ruffle#20033

* build(deps-dev): bump the npm-minor group in /web with 18 updates by @dependabot in ruffle-rs/ruffle#20042

**Full Changelog**: ruffle-rs/ruffle@nightly-2025-04-07...nightly-2025-04-08,

----------------------------------------------------
ryujinx.mk 1.3.30 # Version: Commits on Apr 07, 2025
----------------------------------------------------
# Canary builds:

These builds are experimental and may sometimes not work, use [regular builds](https://github.com/Ryubing/Canary-Releases/releases/latest) instead if that sounds like something you don't want to deal with.

| Platform | Artifact |

|--|--|

| Windows 64-bit | [Canary Windows Artifact](https://github.com/Ryubing/Canary-Releases/releases/download/1.3.30/ryujinx-canary-1.3.30-win_x64.zip) |

| Windows ARM 64-bit | [Canary Windows ARM Artifact](https://github.com/Ryubing/Canary-Releases/releases/download/1.3.30/ryujinx-canary-1.3.30-win_arm64.zip) |

| Linux 64-bit | [Canary Linux Artifact](https://github.com/Ryubing/Canary-Releases/releases/download/1.3.30/ryujinx-canary-1.3.30-linux_x64.tar.gz) |

| Linux ARM 64-bit | [Canary Linux ARM Artifact](https://github.com/Ryubing/Canary-Releases/releases/download/1.3.30/ryujinx-canary-1.3.30-linux_arm64.tar.gz) |

| macOS | [Canary macOS Artifact](https://github.com/Ryubing/Canary-Releases/releases/download/1.3.30/ryujinx-canary-1.3.30-macos_universal.app.tar.gz) |

**[Full Changelog](https://git.ryujinx.app/ryubing/ryujinx/-/compare/66026934775c696c75bcf92b6e9771b7412f5ff2...Canary-1.3.30)**,

--------------------------------------------------------------------------------------
shadps4.mk 03b1fef3318ce5f972e9d1c3590556e556343345 # Version: Commits on Apr 08, 2025
--------------------------------------------------------------------------------------
renderer_vulkan: Only update dynamic state when changed. (#2751),

-------------------------------------------------------------------------------------
vita3k.mk 05690eb3441cc34ef03cdde4fc633db1b3c52a97 # Version: Commits on Jun 14, 2023
-------------------------------------------------------------------------------------
modules/SceVshBridge: Stub vshDisplayRegisterFrameBufCallback.,

-------------------------------------------------------------------------------------------
xenia-native.mk 47f327e848a5c1344ed30b40b085aa6bcb627e0a # Version: Commits on Apr 04, 2025
-------------------------------------------------------------------------------------------
[Misc] Replaced const with constexpr where possible,

-------------------------------------------------------------------------------------------
sdl12-compat.mk 1d3881a319ac2a61b502f9c8d895c6a19a658b8c # Version: Commits on Apr 06, 2025
-------------------------------------------------------------------------------------------
Revert \Rename sdl12_compat.pc to sdl.pc\

This is unnecessary, given that everyone uses pkgconf(1), which

fully supports the \Provides:\ stanza and expresses it in dependencies.

This reverts commit f10920239783dc09bd22f09bad69585cfce8a28d.,

-----------------------------------------------------------------------------------------
sdl3_mixer.mk a983517a91416abfbbab0301f1d04efaea5f77f7 # Version: Commits on Apr 08, 2025
-----------------------------------------------------------------------------------------
CI: linux workflows to run under ubuntu-latest.,

-------------------------------------------------------------------------------------------------
rtl8821au-morrownr.mk b90b76d30709fb82705cbc2e295a7dde9372a0a8 # Version: Commits on Apr 08, 2025
-------------------------------------------------------------------------------------------------
support for kernel 6.14,

------------------------------------------------------------------------------------
box64.mk d592c1996d74e9e6e728026486cdab6a75f43aaa # Version: Commits on Apr 08, 2025
------------------------------------------------------------------------------------
[WOW64] Add wow64 PE build scaffolding (#2513),

---------------------------------------------------------------------------------------
corsixth.mk 0cbc093290783c315f81f198e01e9d5699702326 # Version: Commits on Apr 08, 2025
---------------------------------------------------------------------------------------
Allow using the secondary marker (#2818)

* Rename the first marker to 'primary_marker'.

- Also add lua member methods that use 'PrimaryMarker'

* Rename animation_kind::child to animation_kind::primary_child

* Allow using the secondary marker for a child animation.

* Increment API version due to new  and modified functions,

-------------------------------------------------------------------------------------------
jazz2-native.mk 7c08cfbf342fce5f75c172883c039cbac7f21adb # Version: Commits on Apr 08, 2025
-------------------------------------------------------------------------------------------
Fixed build,

--------------------------------------------------------------------------------------
omf2097.mk d81dbb802ee9a227bb4fbc89c094949d601ed787 # Version: Commits on Apr 08, 2025
--------------------------------------------------------------------------------------
Merge branch 'lobby-new-text-renderer',

------------------------------------------------------------
syncthing.mk v1.29.5-rc.1 # Version: Commits on Apr 08, 2025
------------------------------------------------------------
## What's Changed

* chore(lib): expose model methods to obtain progress by @pixelspark in syncthing/syncthing#9886

* feat(gui): explanation to options enabled or disabled per folder type by @tomasz1986 in syncthing/syncthing#9367

* fix(gui): validate device ID in canonical form (fixes #7291) by @mathias4833 in syncthing/syncthing#10006

* fix(config): remove discontinued primary STUN server (fixes #10008) by @marbens-arch in syncthing/syncthing#10009

* fix(stun): better error handling (ref #10008) by @calmh in syncthing/syncthing#10010

* chore(config): remove discontinued secondary STUN servers (fixes #10011) by @marbens-arch in syncthing/syncthing#10012

* chore(fs): speed up case normalization by @bt90 in syncthing/syncthing#10013

* build(deps): update dependencies by @calmh in syncthing/syncthing#10020

* feat(fs, config): add support for custom filesystem type construction by @pixelspark in syncthing/syncthing#9887

* build: replace underscore in Debian version by @bt90 in syncthing/syncthing#10032

* chore(model): add metric for total number of conflicts by @swenske in syncthing/syncthing#10037

* fix(config): properly apply defaults when reading folder configuration by @pixelspark in syncthing/syncthing#10034

* fix(config): zero filesystemtype is \basic\ by @calmh in syncthing/syncthing#10038

* build: push artifacts to Azure by @calmh in syncthing/syncthing#10044

* chore(config): resolve primary STUN servers via SRV record by @bt90 in syncthing/syncthing#10031

* chore(fs): changes to allow Filesystem to be implemented externally by @pixelspark in syncthing/syncthing#10040

* fix(strings): differentiate setup(n) and set(v) up by @systemcrash in syncthing/syncthing#10024

## New Contributors

* @marbens-arch made their first contribution in syncthing/syncthing#10009

* @swenske made their first contribution in syncthing/syncthing#10037

* @systemcrash made their first contribution in syncthing/syncthing#10024

**Full Changelog**: syncthing/syncthing@v1.29.4...v1.29.5-rc.1,

----------------------------------------------------------------------------------------
retroarch.mk fbd05aa185d6db9b60f665001197940689b65b53 # Version: Commits on Apr 08, 2025
----------------------------------------------------------------------------------------
Fix very minor build warning (#17781),

-----------------------------------------------------------------------------------
tr1x.mk 2fb3824b3b94f2269a44b25b280d7198fad9086f # Version: Commits on Apr 08, 2025
-----------------------------------------------------------------------------------
items: handle null anims/frames for sprite objects

This ensures that sprite objects (or anything with no animation index

defined) are assigned a default animation and as such allows us to

handle null frames when getting item bounds. When Lara's animations are

injected, animation index 0 (which sprite objects would previously

default to) is no longer valid, hence sprites then pointing to a null

entry.,

-----------------------------------------------------------------------------------
tr2x.mk 2fb3824b3b94f2269a44b25b280d7198fad9086f # Version: Commits on Apr 08, 2025
-----------------------------------------------------------------------------------
items: handle null anims/frames for sprite objects

This ensures that sprite objects (or anything with no animation index

defined) are assigned a default animation and as such allows us to

handle null frames when getting item bounds. When Lara's animations are

injected, animation index 0 (which sprite objects would previously

default to) is no longer valid, hence sprites then pointing to a null

entry.,

-----------------------------------------------------------------------------------------------------
libretro-mame2003-plus.mk 605eaa0dbed92a98e742f06aa0d654d765a2e47e # Version: Commits on Apr 08, 2025
-----------------------------------------------------------------------------------------------------
Update rf5c68.c,

----------------------------------------------------------------------------------------------
libretro-ppsspp.mk 8d555d2820b0d9a0fb6523ae88506237da186117 # Version: Commits on Apr 08, 2025
----------------------------------------------------------------------------------------------
Update the fixed IPs for MOHH to the current ones, oops.,

--------------------------------------------------------------------------------------------
libretro-puae.mk 22711fe01b1cf8905a31f0fa074b77a0bcef5cfd # Version: Commits on Apr 08, 2025
--------------------------------------------------------------------------------------------
Remove deprecated zoom migration,

------------------------------------------------------------------------------------------------
libretro-puae2021.mk 591900d26012feac7f2ae38b68e242406e02172a # Version: Commits on Apr 08, 2025
------------------------------------------------------------------------------------------------
Remove deprecated zoom migration,

-----------------------------------------------------------------------------------------------
libretro-sameboy.mk 1cf84a5436c49413ae756c9e9c18ce71e96d7990 # Version: Commits on Apr 08, 2025
-----------------------------------------------------------------------------------------------
Ubuntu 20.04 is dead soon, replace with 22.04,

--------------------------------------------------------------------------------------------
libretro-vice.mk 65e30b0509c3e827651a0644c037df024c937cda # Version: Commits on Apr 08, 2025
--------------------------------------------------------------------------------------------
Remove deprecated zoom migration,

-------------------------------------------------------------------------------------
dhewm3.mk f3cd3f31d0c46e3dcc0f7e04930a441bb99b5a3a # Version: Commits on Apr 08, 2025
-------------------------------------------------------------------------------------
Fix weird printing to console that sometimes happened with listImages

It sometimes happened when changing image_* cvars for compression and

then vid_restarting and then running listImages.

In one case the whole process hung and len was a ridiculously big number

=> most probably the (unsigned!) size_t overflowed by subtracting a

number > len (most likely from input_field.GetCursor()).

So I just made it a plain signed int.

I couldn't reproduce the issue anymore after doing this change.,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-web Area: Web & Extensions T-fix Type: Bug fix (in something that's supposed to work already)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Having Ruffle Extension loaded causes Google Send Feedback form to fail
2 participants