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-70906] Remove prototype from core #7781

Merged
merged 86 commits into from Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
0aa7a21
Remove Ajax.Request from breadcrumbs
timja Mar 14, 2023
b687d55
Remove Ajax.Request from build-timeline-widget
timja Mar 14, 2023
3301d35
WIP
timja Mar 15, 2023
cb50d97
Use crumb API for setting up crumb
timja Apr 2, 2023
b3dec55
Merge branch 'master' into die-prototype
timja Apr 4, 2023
41a3cf7
Use existing semantics
timja Apr 4, 2023
e68ee46
Merge branch 'die-prototype' of github.com:timja/jenkins into die-pro…
timja Apr 4, 2023
81c72b8
Fix build button column
timja Apr 4, 2023
de56c59
Add comment explaining why catch is added
timja Apr 5, 2023
b66a691
Use post and crumb for combobox
timja Apr 5, 2023
5946e62
Lint fix
timja Apr 6, 2023
d0d8d81
More fixes
timja Apr 6, 2023
5eb6307
Fixes
timja Apr 11, 2023
a4a2b7d
Fix
timja Apr 11, 2023
05f5e6e
Fix validate button
timja Apr 13, 2023
1e9b13c
Lint fix
timja Apr 13, 2023
8d10003
Merge branch 'master' into die-prototype
timja Apr 14, 2023
d6cfd9e
Merge branch 'master' into die-prototype
timja Apr 15, 2023
c9d562f
Merge branch 'master' into die-prototype
timja Apr 21, 2023
82ea7ce
Merge branch 'master' into die-prototype
timja Apr 21, 2023
232699a
Merge branch 'master' into die-prototype
timja Apr 28, 2023
399c8aa
Merge branch 'master' into die-prototype
timja May 1, 2023
be6b3cb
Merge branch 'master' into die-prototype
timja May 3, 2023
1ce1543
Merge branch 'master' into die-prototype
basil May 5, 2023
457d60a
Fix URICheckEncodingMonitor
basil May 5, 2023
7154bfc
Add a user experimental flag to run Jenkins without Prototype.js
basil May 5, 2023
328e712
Adapt select.js
timja May 5, 2023
870f258
Fix parameter support
timja May 6, 2023
876b495
JENKINS-70922 Remove Prototype Ajax.Request usage from select.js
timja May 6, 2023
424a378
Lint:fix
timja May 6, 2023
cc6aa0e
Merge branch 'prototype-flag' into die-prototype
timja May 6, 2023
fd50b70
More
timja May 6, 2023
d962ec0
lint
timja May 6, 2023
60e10a0
Merge branch 'master' into die-prototype
timja May 6, 2023
d3c79a2
Rebased
timja May 6, 2023
113da0f
Merge branch 'master' into JENKINS-70922-select-js
timja May 6, 2023
c94ce73
Lint
timja May 6, 2023
70bf672
Fix bad merge
basil May 6, 2023
8eae594
JENKINS-70931 Remove Prototype Ajax.Request usages from hudson-behavi…
timja May 6, 2023
379945a
Fix URICheckEncodingMonitor
basil May 5, 2023
bd18ebc
JENKINS-70921 Remove Prototype Ajax.Request usages from link.js
timja May 6, 2023
0065f7b
Remove dead code
timja May 6, 2023
42a17a2
JENKINS-70910 Remove Prototype.Browser usages from hudson-behavior.js
timja May 6, 2023
b60bf76
JENKINS-70947 Remove Prototype $ usage from section_.js
timja May 7, 2023
d960b02
Merge branch 'JENKINS-70931-hudson-behavior' into die-prototype
timja May 7, 2023
9c94c86
Merge branch 'JENKINS-70921-link' into die-prototype
timja May 7, 2023
a1cdcb1
Merge branch 'JENKINS-70907-uri-check' into die-prototype
timja May 7, 2023
672d66b
Merge branch 'JENKINS-70910-browser' into die-prototype
timja May 7, 2023
28656ae
Merge branch 'JENKINS-70947-section' into die-prototype
timja May 7, 2023
3a5f150
Merge branch 'JENKINS-70922-select-js' into die-prototype
timja May 7, 2023
2e8bdd2
Prototype removal true
timja May 7, 2023
e65dba9
Remove unneeded test
timja May 7, 2023
34fd7e5
Remove hacky test that doesn't work with fetch
timja May 7, 2023
d0a099d
Remove unneeded workaround
timja May 7, 2023
54ba736
Fix test
timja May 7, 2023
941b316
Minor improvements while debugging
timja May 7, 2023
43ced8a
Fix repeatable.js
timja May 7, 2023
020d8d6
JENKINS-71020 Remove Prototype usages from buildTimeTrend_resources.js
timja May 7, 2023
48cbd42
lint
timja May 7, 2023
99b6a7a
JENKINS-71020 Remove Prototype usages from buildTimeTrend_resources.js
timja May 7, 2023
ff90e78
Use escapeHTML instead of inlined references
timja May 7, 2023
faca767
Fix issues
timja May 7, 2023
16051bd
Merge branch 'JENKINS-71020-buildTimeTrend' into die-prototype
timja May 7, 2023
b3384bb
JENKINS-70931 Remove Prototype Ajax.Request usages from hudson-behavi…
timja May 6, 2023
d8fd7f9
Remove hacky test that doesn't work with fetch
timja May 7, 2023
3c890bd
Remove unused checkMethod
timja May 7, 2023
facdf16
Merge branch 'JENKINS-70931-hudson-behavior' into die-prototype
timja May 7, 2023
3167f13
Merge branch 'master' into die-prototype
timja May 8, 2023
5d6d839
Merge branch 'master' into die-prototype
timja May 9, 2023
7cda15a
Revert "Revert "JENKINS-70922 Remove Prototype Ajax.Request usage fro…
timja May 11, 2023
bab05d8
Serialise refills
timja May 11, 2023
f30670f
Merge branch 'master' into die-prototype
timja May 12, 2023
427d083
Merge branch 'JENKINS-70922-selectjs' into die-prototype
timja May 12, 2023
aaa6bd2
More reverts
timja May 12, 2023
b641091
More merge
timja May 12, 2023
ca85f21
Merge branch 'master' into die-prototype
timja May 13, 2023
4eab4af
Merge branch 'master' into die-prototype
timja May 18, 2023
24e0015
Merge branch 'master' into die-prototype
timja May 19, 2023
e8d2811
Merge remote-tracking branch 'origin/master' into die-prototype
basil Jul 25, 2023
f79761e
Merge branch 'master' into die-prototype
timja Jul 26, 2023
98018bd
Merge branch 'master' into die-prototype
timja Aug 3, 2023
a89b68d
Remove prototype.js
timja Aug 3, 2023
4b55d97
Merge branch 'die-prototype' of github.com:timja/jenkins into die-pro…
timja Aug 3, 2023
8aaf16c
Merge branch 'master' into die-prototype
basil Aug 4, 2023
ec84977
Remove more references
timja Aug 7, 2023
4564bd5
Merge branch 'die-prototype' of github.com:timja/jenkins into die-pro…
timja Aug 7, 2023
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

This file was deleted.

Expand Up @@ -109,13 +109,9 @@ function confirmAndRevokeAllSelected(button) {
selectedValues.push({ userId: userId, uuid: uuid });
}

// TODO simplify when Prototype.js is removed

fetch(url, {
method: "post",
body: Object.toJSON
? Object.toJSON({ values: selectedValues })
: JSON.stringify({ values: selectedValues }),
body: JSON.stringify({ values: selectedValues }),
headers: crumb.wrap({ "Content-Type": "application/json" }),
}).then(() => window.location.reload());
},
Expand Down
4 changes: 0 additions & 4 deletions core/src/main/resources/lib/layout/layout.jelly
Expand Up @@ -123,10 +123,6 @@ THE SOFTWARE.
<link rel="mask-icon" href="${resURL}/mask-icon.svg" color="#191717" />
<meta name="theme-color" content="#ffffff" />

<l:userExperimentalFlag var="removePrototype" flagClassName="jenkins.model.experimentalflags.RemovePrototypeUserExperimentalFlag" />
<j:if test="${!removePrototype}">
<script src="${resURL}/scripts/prototype.js" type="text/javascript"/>
</j:if>
<script src="${resURL}/scripts/behavior.js" type="text/javascript"/>

<st:adjunct includes="org.kohsuke.stapler.bind"/>
Expand Down
42 changes: 0 additions & 42 deletions test/src/test/java/hudson/ExceptionTest.java

This file was deleted.

This file was deleted.

11 changes: 2 additions & 9 deletions test/src/test/resources/lib/form/JSON.js
Expand Up @@ -5,14 +5,7 @@ if (typeof JSON=="undefined") {
return String.evalJSON(str);
},
stringify : function (obj) {
// TODO simplify when Prototype.js is removed
if (Object.toJSON) {
// Prototype.js
return Object.toJSON(obj);
} else {
// Standard
return JSON.stringify(obj);
}
return JSON.stringify(obj);
}
};
}
}
1 change: 0 additions & 1 deletion war/.eslintignore
Expand Up @@ -11,5 +11,4 @@ jsbundles

# External scripts
src/main/webapp/scripts/yui
src/main/webapp/scripts/prototype.js
src/main/js/plugin-setup-wizard/bootstrap-detached.js
1 change: 0 additions & 1 deletion war/.prettierignore
Expand Up @@ -12,7 +12,6 @@ node/
# libraries / external deps / generated files
src/main/js/plugin-setup-wizard/bootstrap-detached.js
src/main/webapp/scripts/yui
src/main/webapp/scripts/prototype.js
src/main/webapp/jsbundles/
src/main/scss/_bootstrap.scss

Expand Down
40 changes: 2 additions & 38 deletions war/src/main/js/util/jenkins.js
Expand Up @@ -17,42 +17,6 @@ jenkins.baseUrl = function () {
return u;
};

// awful hack to get around JSONifying things with Prototype taking over wrong. ugh. Prototype is the worst.
jenkins.stringify = function (o) {
if (Array.prototype.toJSON) {
// Prototype f's this up something bad
var protoJSON = {
a: Array.prototype.toJSON,
o: Object.prototype.toJSON,
h: Hash.prototype.toJSON,
s: String.prototype.toJSON,
};
try {
delete Array.prototype.toJSON;
delete Object.prototype.toJSON;
delete Hash.prototype.toJSON;
delete String.prototype.toJSON;

return JSON.stringify(o);
} finally {
if (protoJSON.a) {
Array.prototype.toJSON = protoJSON.a;
}
if (protoJSON.o) {
Object.prototype.toJSON = protoJSON.o;
}
if (protoJSON.h) {
Hash.prototype.toJSON = protoJSON.h;
}
if (protoJSON.s) {
String.prototype.toJSON = protoJSON.s;
}
}
} else {
return JSON.stringify(o);
}
};

/**
* redirect
*/
Expand Down Expand Up @@ -82,7 +46,7 @@ jenkins.get = function (url, success, options) {
};

/**
* Jenkins AJAX POST callback, formats data as a JSON object post (note: works around prototype.js ugliness using stringify() above)
* Jenkins AJAX POST callback, formats data as a JSON object post
* If last parameter is an object, will be extended to jQuery options (e.g. pass { error: function() ... } to handle errors)
*/
jenkins.post = function (url, data, success, options) {
Expand Down Expand Up @@ -110,7 +74,7 @@ jenkins.post = function (url, data, success, options) {
formBody = $.extend({}, formBody);
formBody[crumb.fieldName] = crumb.value;
}
formBody = jenkins.stringify(formBody);
formBody = JSON.stringify(formBody);
}

var args = {
Expand Down
30 changes: 2 additions & 28 deletions war/src/main/webapp/scripts/hudson-behavior.js
Expand Up @@ -2222,6 +2222,7 @@ function encode(str) {
// when there are multiple form elements of the same name,
// this method returns the input field of the given name that pairs up
// with the specified 'base' input element.
// eslint-disable-next-line no-unused-vars
function findMatchingFormInput(base, name) {
// find the FORM element that owns us
var f = base.closest("form");
Expand Down Expand Up @@ -2254,17 +2255,6 @@ function findMatchingFormInput(base, name) {
return null; // not found
}

// TODO remove when Prototype.js is removed
if (typeof Form === "object") {
/** @deprecated For backward compatibility only; use {@link findMatchingFormInput} instead. */
Form.findMatchingInput = function (base, name) {
console.warn(
"Deprecated call to Form.findMatchingInput detected; use findMatchingFormInput instead.",
);
return findMatchingFormInput(base, name);
};
}

// eslint-disable-next-line no-unused-vars
function toQueryString(params) {
var query = "";
Expand Down Expand Up @@ -2649,14 +2639,7 @@ function buildFormTree(form) {
}
}

// TODO simplify when Prototype.js is removed
if (Object.toJSON) {
// Prototype.js
jsonElement.value = Object.toJSON(form.formDom);
} else {
// Standard
jsonElement.value = JSON.stringify(form.formDom);
}
jsonElement.value = JSON.stringify(form.formDom);

// clean up
for (i = 0; i < doms.length; i++) {
Expand Down Expand Up @@ -2825,15 +2808,6 @@ function createComboBox(idOrField, valueFunction) {
}
}

// Exception in code during the AJAX processing should be reported,
// so that our users can find them more easily.
// TODO remove when Prototype.js is removed
if (typeof Ajax === "object" && Ajax.Request) {
Ajax.Request.prototype.dispatchException = function (e) {
throw e;
};
}

// event callback when layouts/visibility are updated and elements might have moved around
var layoutUpdateCallback = {
callbacks: [],
Expand Down