Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some cleanup and minor optimizations #1212

Merged
merged 5 commits into from
May 3, 2022
Merged

Some cleanup and minor optimizations #1212

merged 5 commits into from
May 3, 2022

Conversation

rbri
Copy link
Collaborator

@rbri rbri commented Apr 26, 2022

No description provided.

@rbri
Copy link
Collaborator Author

rbri commented Apr 26, 2022

Do we need a (deprecated) version of ScriptRuntime.enumNext() for backward compatibility?

@@ -2290,16 +2289,15 @@ public static void setEnumNumbers(Object enumObj, boolean enumNumbers) {
((IdEnumeration) enumObj).enumNumbers = enumNumbers;
}

public static Boolean enumNext(Object enumObj) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly yes, since this is public and in ScriptRuntime it's certainly possible that someone somewhere depends on it. But can we have a version that takes no "cx" and is also marked deprecated?

Also, most of our functions that take a Context take it as the first argument -- would you consider doing it that way?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backward compatibility done.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, most of our functions that take a Context take it as the first argument -- would you consider doing it that way?

I'm aware of that but the one that implements the methods

  • ScriptRuntime.enumId(Object, Context)
  • ScriptRuntime.enumInit(Object, Context, boolean)
  • ScriptRuntime.enumInit(Object, Context, int)
  • ScriptRuntime.enumInit(Object, Context, Scriptable, int)
  • ScriptRuntime.enumValue(Object, Context)

has used a different pattern.

Because all these methods are public i think we have to use the same pattern for the enumNext; otherwise we have to add some more deprecated stuff.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right, we do! Thanks.

@gbrail
Copy link
Collaborator

gbrail commented Apr 30, 2022

Thanks for this. I do think that if we're going to change the signature of a public method in ScriptRuntime that we should deprecate the old signature but keep it working.

@gbrail
Copy link
Collaborator

gbrail commented May 3, 2022

Thanks -- makes sense to me.

@gbrail gbrail merged commit d4ee2c1 into mozilla:master May 3, 2022
@p-bakker p-bakker added this to the Release 1.7.15 milestone May 4, 2022
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.

None yet

3 participants