Version
latest main branch
Platform
Subsystem
url
What steps will reproduce the bug?
const { URLPattern } = require('node:url');
const pattern = new URLPattern({ pathname: '/:value' });
const result = pattern.exec('https://example.com/test');
console.log(Object.keys(result));
console.log(Object.keys(result.pathname));
console.log(JSON.stringify(result.pathname));
How often does it reproduce? Is there a required condition?
Every
What is the expected behavior? Why is that the expected behavior?
[
'hash',
'hostname',
'pathname',
'port',
'protocol',
'search',
'username'
]
[ 'groups', 'input' ]
'{"groups":{"value":"test"},"input":"/test"}'
What do you see instead?
[
'inputs',
'protocol',
'username',
'password',
'hostname',
'port',
'pathname',
'search',
'hash'
]
[ 'input', 'groups' ]
'{"input":"/test","groups":{"value":"test"}}'
Additional information
Although direct property access is unaffected, property creation order is observable through:
Object.keys(result);
Object.values(result);
JSON.stringify(result);
({ ...result });
This makes Node.js behavior incompatible with browsers and WebIDL dictionary conversion semantics.
Version
latest main branch
Platform
Subsystem
url
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Every
What is the expected behavior? Why is that the expected behavior?
What do you see instead?
Additional information
Although direct property access is unaffected, property creation order is observable through:
This makes Node.js behavior incompatible with browsers and WebIDL dictionary conversion semantics.