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

[JENKINS-42228] - Prevent JavaScript error on the Jenkins system configuration page #4889

Merged
merged 2 commits into from Aug 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion war/src/main/webapp/scripts/hudson-behavior.js
Expand Up @@ -500,7 +500,12 @@ var tooltip;
//========================================================
// using tag names in CSS selector makes the processing faster
function registerValidator(e) {
e.targetElement = findFollowingTR(e, "validation-error-area").firstChild.nextSibling;
var tr = findFollowingTR(e, "validation-error-area");
if (!tr || !tr.firstChild) {
Copy link
Member

Choose a reason for hiding this comment

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

can we add a warning?

Suggested change
if (!tr || !tr.firstChild) {
if (!tr || !tr.firstChild) {
console.warn("Couldn't register validator, start element was", e);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I added a warning log.
The output is like this:
warning

console.warn("Couldn't register validator, start element was", e);
return;
}
e.targetElement = tr.firstChild.nextSibling;
e.targetUrl = function() {
var url = this.getAttribute("checkUrl");
var depends = this.getAttribute("checkDependsOn");
Expand Down