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

8342460: Remove calls to doPrivileged in javafx.web #1620

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

andy-goryachev-oracle
Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle commented Oct 31, 2024

Removes doPrivileged calls in the javafx.web module, excluding the code in {android,ios}.

/reviewers 2


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8342460: Remove calls to doPrivileged in javafx.web (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1620/head:pull/1620
$ git checkout pull/1620

Update a local copy of the PR:
$ git checkout pull/1620
$ git pull https://git.openjdk.org/jfx.git pull/1620/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1620

View PR using the GUI difftool:
$ git pr show -t 1620

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1620.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 31, 2024

👋 Welcome back angorya! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 31, 2024

@andy-goryachev-oracle This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8342460: Remove calls to doPrivileged in javafx.web

Reviewed-by: kcr, arapte

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

cause = cause.getCause();
throw cause;
}
return MethodHelper.invoke(method, instance, args);
Copy link
Contributor Author

@andy-goryachev-oracle andy-goryachev-oracle Oct 31, 2024

Choose a reason for hiding this comment

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

I think the whole fwkInvokeWithContext method and associated constants can be safely removed.

Copy link
Member

Choose a reason for hiding this comment

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

Very unlikely, but I'll take a look when fixing JDK-8342993, since this method is on my list to be modified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see this private method being called...

Copy link
Member

Choose a reason for hiding this comment

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

https://github.com/openjdk/jfx/blob/master/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/JNIUtilityPrivate.cpp#L325-L330

All Java methods in javafx.web that are named fwk* are called by native WebKit code via JNI upcalls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ouch. it would be nice to have the method commented or annotated somehow...
thank you for clarification!

Copy link
Member

Choose a reason for hiding this comment

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

Indeed it would. Instead we just have to "know" the convention. Not very satisfying, is it!

@openjdk
Copy link

openjdk bot commented Oct 31, 2024

@andy-goryachev-oracle
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@andy-goryachev-oracle andy-goryachev-oracle marked this pull request as ready for review October 31, 2024 23:21
@openjdk openjdk bot added the rfr Ready for review label Oct 31, 2024
@mlbridge
Copy link

mlbridge bot commented Oct 31, 2024

Webrevs

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

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

Looks good except for one problem that needs to be fixed. I also left a question inline about removed comment lines.

Comment on lines -579 to -580
} catch (@SuppressWarnings("removal") AccessControlException ex) {
errorCode = LoadListenerClient.PERMISSION_DENIED;
Copy link
Member

Choose a reason for hiding this comment

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

Excellent. This was on my list for JDK-8342998, so one less thing for me to do for that (actually, two less things, since you also took care of the one in URLLoader.java).

cause = cause.getCause();
throw cause;
}
return MethodHelper.invoke(method, instance, args);
Copy link
Member

Choose a reason for hiding this comment

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

The removal of the try/catch is causing a test failure in JavaScriptBridgeTest because InvocationTargetException is now thrown rather than InvocationTargetException::getCause.

Suggested change
return MethodHelper.invoke(method, instance, args);
try {
return MethodHelper.invoke(method, instance, args);
} catch (InvocationTargetException ex) {
Throwable cause = ex.getCause();
throw cause != null ? cause : ex;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed as suggested.
is this test being run as part of GHA or the headful test suite?

@@ -830,9 +826,7 @@ private Button addButton(ToolBar toolbar, final String iconName, String tooltipT
button.getStyleClass().add(styleClass);
toolbar.getItems().add(button);

@SuppressWarnings("removal")
Image icon = AccessController.doPrivileged((PrivilegedAction<Image>) () -> new Image(HTMLEditorSkin.class.getResource(iconName).toString()));
// button.setGraphic(new ImageView(icon));
Copy link
Member

Choose a reason for hiding this comment

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

I see you removed this comment. Do you think there is no value in leaving it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reverted here and below.

((StyleableProperty)toggleButton.graphicProperty()).applyStyle(null, new ImageView(icon));
// toggleButton.setGraphic(new ImageView(icon));
Copy link
Member

Choose a reason for hiding this comment

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

Same question as above.

@kevinrushforth
Copy link
Member

@arapte Can you be the second reviewer?

Copy link
Member

@arapte arapte left a comment

Choose a reason for hiding this comment

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

LGTM, with one minor comment. Please take a look.

messageCallback.call(message);
return null;
}, webEngine.page.getAccessControlContext());
messageCallback.call(message);
Copy link
Member

Choose a reason for hiding this comment

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

@SuppressWarnings("removal") can be removed from this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed, thanks!

@openjdk openjdk bot added the ready Ready to be integrated label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Ready to be integrated rfr Ready for review
Development

Successfully merging this pull request may close these issues.

3 participants