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

Add __exception__ property only in enhanced java access #1663

Conversation

rPraml
Copy link
Contributor

@rPraml rPraml commented Sep 30, 2024

I noticed that Rhino stores the current exception in a __exception__ variable.
This is not really standard and in my opinion it only makes sense when using LiveConnect (and even there I see no reason to enable this by default).

My suggestion is to enable this feature only via flag (FEATURE_ENHANCED_JAVA_ACCESS should fit) or remove it completely.

It was introduced with d0c1400 but no test or use case was described. And I also found only this post: https://groups.google.com/g/mozilla.dev.tech.js-engine.rhino/c/qNttXExynw4?pli=1

Instead of putting something in the current scope, you can use this more object oriented code to access the underlying exception

try {
   ... 
} catch (e) {
   e.rhinoException.printStackTrace();
   // or if it is a real java exception:
   e.javaException.printStackTrace();
}

So maybe anyone can tell a use case for this feature, if this is still needed?

@p-bakker
Copy link
Collaborator

p-bakker commented Oct 1, 2024

This seems to me something very old, that has been surpassed by other features

I wouldn't mind deprecating this for removal and maybe already putting this behind some DEPRECATED_FOR_REMOVAL flag

Heck, I wouldn't mind just tossing it out completely right now 🤪

@rbri
Copy link
Collaborator

rbri commented Oct 1, 2024

i do not use it in HtmlUnit so removal is fine for me and everything elso also.

@gbrail
Copy link
Collaborator

gbrail commented Oct 2, 2024

I think it makes sense and I'm going to merge this and put it behind the feature flag -- and given that it's not documented anywhere I'd be happy to remove it entirely later.

@gbrail gbrail merged commit 9cc24c8 into mozilla:master Oct 2, 2024
1 check passed
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.

4 participants