Skip to content

Conversation

@rbri
Copy link
Collaborator

@rbri rbri commented Oct 26, 2025

Use the existing ScriptRuntime.typeErrorThrower(cx) instead of having a separate ThrowTypeError in Arguments.

This also fixes the setup of the ThrowTypeError returned by ScriptRuntime.typeErrorThrower(cx).

@rbri rbri marked this pull request as draft October 26, 2025 09:25
@aardvark179
Copy link
Contributor

This looks good, but it feels like it's only partway there, but not quite. If you're altering ScriptRuntime.typeErrorThrower() anyway, then let's do it properly:

  1. %TypeErrorThrower% is per realm, so add it to the list of things on TopLevel (effectively our realm object).
  2. Change ScriptRuntime.typeError to accept a scope (the no args version can use cx.topCallScope), and get it from the TopLevel object.

I am also not quite clear on why we need another subclass of BaseError rather than just a LambdaFunction, but maybe I'm missing something.

Error handling feels like an area we should come up with a plan to tidy up. At the moment we throw internal errors and record their type based on a name, but all those constructors are per realm, so we should probably come up with a plan to fix that. Since the ScriptRuntime functions are used everywhere we'd better also do this in a way that allows us to introduces any new scope argument, or whatever, gradually, otherwise we'll have a really PR.

@rbri
Copy link
Collaborator Author

rbri commented Oct 26, 2025

This looks good, but it feels like it's only partway there, but not quite.

@aardvark179 hehe it is a draft... ;-)

will try to finish my changes first, and then i will have a look at your suggestions. As in many other areas we have to go a long way to reach the spec

@rbri rbri marked this pull request as ready for review October 26, 2025 21:31
@gbrail
Copy link
Collaborator

gbrail commented Oct 30, 2025

This looks good to me -- thanks. I'm idly curious whether the "read only arguments" behavior could have been implemented by making the object's properties non-configurable and making the object non-extensible. Are there other JS objects that are supposed to silently ignore attempts to set properties like this one, or is arguments special?

rbri added 5 commits October 31, 2025 08:05
… a separate ThrowTypeError in Arguments.

This also fixes the setup of the ThrowTypeError returned by ScriptRuntime.typeErrorThrower(cx).
All test passing with the code base before the first 'argument' changes (commit 3f4e1a7)
@rbri rbri force-pushed the arguments_step_2 branch from d711c00 to d40498f Compare October 31, 2025 07:06
@rbri rbri force-pushed the arguments_step_2 branch from d40498f to 1425a5b Compare October 31, 2025 07:08
@rbri
Copy link
Collaborator Author

rbri commented Oct 31, 2025

I'm idly curious whether the "read only arguments" behavior could have been implemented by making the object's properties non-configurable

at least the property descriptor shows that they are configurable (see the last added test)

@gbrail
Copy link
Collaborator

gbrail commented Nov 1, 2025

Thanks for the progress on this!

@gbrail gbrail merged commit 8ca38bf into mozilla:master Nov 1, 2025
11 checks passed
@rbri rbri deleted the arguments_step_2 branch November 2, 2025 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants