Supporting browser builtin implementation of AudioClip again#56
Merged
Conversation
AudioClip again
jtulach
commented
May 15, 2026
| @Override | ||
| @JavaScriptBody(args = { "src" }, body = "" | ||
| + "if (typeof Audio !== 'object') return null;" | ||
| + "return new Audio(src);") |
Contributor
Author
There was a problem hiding this comment.
- in 2013 I had to distinguish among old JDK7 JavaFX WebView without
Audio - and newer WebViews (JDK8+) that had
Audioobject - or real browsers that had
Audiotoo - at that time the
typeof Audiowasobject - these days it is
function- inspite of calling
Audio("some.mp3")yields and error suggesting to usenew Audio(...)instead!
- inspite of calling
- I know the https://github.com/jtulach/minesweeper was playing its sounds in the past
- there must have been an incompatible change in the browsers since then
- that changed the
typeof Audio - interesting way to break someone's code
Contributor
Author
There was a problem hiding this comment.
Me: I do remember that in 2013 the typeof Audio was object. When did it change?
AI: ... there was a major architectural transition across all major browsers that changed web API constructors like Audio, Image, and Option from returning "object" to "function" under the
typeofoperator.
- Bug 829524 - DOM constructors should be typeof "function".
- Bug 83849 - Make DOM constructors have typeof 'function'
I haven't found those bugs/commits, but the explanation matches my memories.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Audioobject