Page MenuHomePhabricator

Current JavaScript executor does not support Object.hasOwn
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:
We get an error message "Z507K1 bit a function"

What should have happened instead?:
The function should run

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

The problem is that Object.hasOwn, which is here used in line 66, has only been implemented in QuickJS 0.24.0 or later. The issue will go away as soon as we deploye QuickJS 0.24.0.

That was the only place where JavaScript implementations used Object.hasOwn, so this is not urgent. We will just deploy it as the new QickJS version propagates through.

Thanks to Racecard who reported an issue here: https://www.wikifunctions.org/wiki/Talk:Z10944

Event Timeline

Mcastro triaged this task as High priority.Dec 21 2023, 5:35 PM
Mcastro lowered the priority of this task from High to Low.
Mcastro moved this task from To triage to Backlog on the Abstract Wikipedia team board.

Looks like this got merged into wasmedge-quickjs in February: https://github.com/second-state/wasmedge-quickjs/commit/d76ccf4aed0745e4ff7aad2f6aac4caf4acdfca2

And when I try locally, it does seem to work:

root@631fc176bc66:/srv/service# . ./programming-languages/wasmedge/wasmedge-binary/env 
root@631fc176bc66:/srv/service# cat << EOF > script.js
> import * as std from 'std';
> const obj = { a: 1 };
> print(Object.hasOwn(obj, 'a'));
> EOF
root@631fc176bc66:/srv/service# wasmedge --dir .:. ./programming-languages/wasmedge_quickjs_uncompiled.wasm script.js 
true

I'll move this to To Deploy.