createImageBitmap - unsupported call signatures

Discussions about the development and maturation of the platform code (UXP).
Warning: may contain highly-technical topics.

Moderators: trava90, athenian200

User avatar
UCyborg
Lunatic
Lunatic
Posts: 345
Joined: 2019-01-10, 09:37
Location: Slovenia

createImageBitmap - unsupported call signatures

Unread post by UCyborg » 2024-05-26, 02:19

Just a heads up, it came into my awareness that there are websites out there that rely on additions to createImageBitmap not supported by the platform.

https://pixai.art/ throws an exception about not enough arguments, causing image previews not showing as expected, eg. even on the first page, you're supposed to see the images without having to click their entries to open them.

Related entry on Bugzilla with another example

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2389
Joined: 2018-05-05, 13:29

TypeError: Not enough arguments to Window.createImageBitmap

Unread post by vannilla » 2024-07-08, 15:27

The createImageBitmap function seems to have received a different signature at some point in time.
https://developer.mozilla.org/en-US/doc ... mageBitmap

Looking at the XRef very quickly UXP does not support the options argument as an extension to the existing supported signatures.

I wanted to play this game: https://skk-atelier.itch.io/sokoban-jelly :)
The game uses the Cocos JS engine so anything built on it is a valid "in the wild" live example.
Code from the engine just for reference: https://github.com/cocos/cocos-engine/b ... ser.ts#L88

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 37532
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: TypeError: Not enough arguments to Window.createImageBitmap

Unread post by Moonchild » 2024-07-08, 16:27

I'm sick and tired of this passing through "options" objects to everyone and their uncle. It's such a terrible hybrid approach to established calls.
But I guess it's Yet Another Spec Change (YASC) we will have to implement.

Issue #2545 (UXP)
"A dead end street is a place to turn around and go into a new direction" - Anonymous
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
adoxa
Lunatic
Lunatic
Posts: 403
Joined: 2019-03-16, 13:26
Location: Qld, Aus.

Re: TypeError: Not enough arguments to Window.createImageBitmap

Unread post by adoxa » 2024-07-09, 06:37

Here's a Modify HTTP Response filter to remove the options.

Code: Select all

[["html-classic.itch.zone",["/_virtual_cc.*\\.js$/",["/(createImageBitmap\\(.),\\{.*?\\}/g","$1"]]]]

User avatar
UCyborg
Lunatic
Lunatic
Posts: 345
Joined: 2019-01-10, 09:37
Location: Slovenia

Re: TypeError: Not enough arguments to Window.createImageBitmap

Unread post by UCyborg » 2024-07-10, 10:09

For the record, I wrote about this here.

I'm not sure when it comes to technicalities, which board is better. I assumed Browser Development was more for Pale Moon specific things, eg. look 'n feel, web stuff is all handled by the platform AFAIK.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 37532
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: TypeError: Not enough arguments to Window.createImageBitmap

Unread post by Moonchild » 2024-07-10, 10:15

That one just slipped under my radar, sorry about that. Yes, platform development is the better location but I'm usually not super strict about where it's put.
I'll merge both topics.
"A dead end street is a place to turn around and go into a new direction" - Anonymous
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2389
Joined: 2018-05-05, 13:29

Re: TypeError: Not enough arguments to Window.createImageBitmap

Unread post by vannilla » 2024-07-10, 23:38

UCyborg wrote:
2024-07-10, 10:09
For the record, I wrote about this here.
Off-topic:
Oops, I missed it completely. :oops:
I think I also read the OP back then but forgot about it. :(

User avatar
UCyborg
Lunatic
Lunatic
Posts: 345
Joined: 2019-01-10, 09:37
Location: Slovenia

Re: createImageBitmap - unsupported call signatures

Unread post by UCyborg » 2024-07-11, 20:44

Off-topic:
I've always been more of an invisible type. :P