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

Remove dead JS code #9136

Merged
merged 1 commit into from
Apr 8, 2024
Merged

Remove dead JS code #9136

merged 1 commit into from
Apr 8, 2024

Conversation

zbynek
Copy link
Contributor

@zbynek zbynek commented Apr 6, 2024

The YUI.log was most likely a typo (was meant to be YAHOO.log) and is not needed anyway since the standard console.log is used in other places. Checks for existence of console can be dropped since they are missing in other places. Some global vars are not needed in anymore (mostly because of Prototype removal).

No tests were added/changed because functionality didn't change.
geval code was simplified by removing IE-only hacks, but it remains incompatible with CSP (on purpose)

Testing done

JS lint passes

Proposed changelog entries

(skip changelog)

Proposed upgrade guidelines

N/A

Submitter checklist

Desired reviewers

@mention

Before the changes are marked as ready-for-merge:

Maintainer checklist

@timja timja added the skip-changelog Should not be shown in the changelog label Apr 7, 2024
@timja
Copy link
Member

timja commented Apr 7, 2024

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Apr 7, 2024
@NotMyFault NotMyFault merged commit 89c7754 into jenkinsci:master Apr 8, 2024
17 checks passed
@MarkEWaite
Copy link
Contributor

This seems to have caused a regression when creating a new certificate credential with PKCS#12 type. @zbynek can you investigate JENKINS-73166 to confirm that my git bisect is correct and to identify a fix?

@MarkEWaite
Copy link
Contributor

MarkEWaite commented May 14, 2024

As far as I can tell, I had to restore the following subset of the commit:

 function geval(script) {
-  eval(script);
+  // execScript chokes on "" but eval doesn't, so we need to reject it first.
+  if (script == null || script == "") {
+    return;
+  }
+  // see http://perfectionkills.com/global-eval-what-are-the-options/
+  // note that execScript cannot return value
+  (this.execScript || eval)(script);
 }

When I replace the (this.execScript || eval)(script); with eval(script) it fails.

The replacement of the YUI logging lines with console.log did not seem to affect JENKINS-73166.

MarkEWaite added a commit to MarkEWaite/jenkins that referenced this pull request May 17, 2024
https://issues.jenkins.io/browse/JENKINS-73166 notes that the credentials
code for certificates has a dependency on this JavaScript code.
Without this JavaScript, an attempt to add a new certificate credential
type using PKCS#12 will fail with an HTTP 404 error.

The replacement of YUI.log with console.log is not involved in the bug
report, so it is retained in the code change.

This reverts part of commit 932ab19c5448bb0afa46f60b93c245eb08e86b55.
@zbynek zbynek deleted the remove-dead-js branch May 17, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants