Skip to content

Commit 022bdec

Browse files
committed
AC-12901: Require.js upgrade to the latest version 2.3.7 (security vulnerability CVE-2024-38999)
1 parent 7302cf1 commit 022bdec

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

lib/web/requirejs/require.js

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//problems with requirejs.exec()/transpiler plugins that may not be strict.
77
/*jslint regexp: true, nomen: true, sloppy: true */
88
/*global window, navigator, document, importScripts, setTimeout, opera */ // eslint-disable-line no-redeclare
9+
/* eslint-disable strict */
910

1011
var requirejs, require, define;
1112
(function (global, setTimeout) {
@@ -95,7 +96,7 @@ var requirejs, require, define;
9596
function eachProp(obj, func) {
9697
var prop;
9798
for (prop in obj) {
98-
if (hasProp(obj, prop) && disallowedProps.indexOf(prop) == -1) {
99+
if (hasProp(obj, prop) && disallowedProps.indexOf(prop) === -1) {
99100
if (func(obj[prop], prop)) {
100101
break;
101102
}
@@ -308,7 +309,7 @@ var requirejs, require, define;
308309

309310
outerLoop: for (i = nameParts.length; i > 0; i -= 1) {
310311
nameSegment = nameParts.slice(0, i).join('/');
311-
312+
/* eslint-disable max-depth */
312313
if (baseParts) {
313314
//Find the longest baseName segment match in the config.
314315
//So, do joins on the biggest to smallest lengths of baseParts.
@@ -328,6 +329,7 @@ var requirejs, require, define;
328329
}
329330
}
330331
}
332+
/* eslint-enable max-depth */
331333

332334
//Check for a star map match, but just hold on to it,
333335
//if there is a shorter segment match later in a matching
@@ -445,7 +447,7 @@ var requirejs, require, define;
445447
normalizedName = name;
446448
} else if (pluginModule && pluginModule.normalize) {
447449
//Plugin is loaded, use its normalize method.
448-
normalizedName = pluginModule.normalize(name, function (name) {
450+
normalizedName = pluginModule.normalize(name, function (name) { // eslint-disable-line no-shadow
449451
return normalize(name, parentName, applyMap);
450452
});
451453
} else {
@@ -591,16 +593,16 @@ var requirejs, require, define;
591593
'module': function (mod) {
592594
if (mod.module) {
593595
return mod.module;
594-
} else {
595-
return (mod.module = {
596-
id: mod.map.id,
597-
uri: mod.map.url,
598-
config: function () {
599-
return getOwn(config.config, mod.map.id) || {};
600-
},
601-
exports: mod.exports || (mod.exports = {})
602-
});
603596
}
597+
/* eslint-disable no-extra-parens */
598+
return (mod.module = {
599+
id: mod.map.id,
600+
uri: mod.map.url,
601+
config: function () {
602+
return getOwn(config.config, mod.map.id) || {};
603+
},
604+
exports: mod.exports || (mod.exports = {})
605+
});
604606
}
605607
};
606608

@@ -1178,7 +1180,7 @@ var requirejs, require, define;
11781180
},
11791181

11801182
on: function (name, cb) {
1181-
var cbs = this.events[name];
1183+
var cbs = this.events[name]; // eslint-disable-line newline-after-var
11821184
if (!cbs) {
11831185
cbs = this.events[name] = [];
11841186
}
@@ -1715,7 +1717,7 @@ var requirejs, require, define;
17151717
interactiveScript = null;
17161718

17171719
//Pull out the name of the module and the context.
1718-
var data = getScriptData(evt);
1720+
var data = getScriptData(evt); // eslint-disable vars-on-top
17191721
context.completeLoad(data.id);
17201722
}
17211723
},
@@ -1727,7 +1729,7 @@ var requirejs, require, define;
17271729
var data = getScriptData(evt);
17281730
if (!hasPathFallback(data.id)) {
17291731
var parents = [];
1730-
eachProp(registry, function(value, key) {
1732+
eachProp (registry, function(value, key) {
17311733
if (key.indexOf('_@r') !== 0) {
17321734
each(value.depMaps, function(depMap) {
17331735
if (depMap.id === data.id) {
@@ -1908,7 +1910,8 @@ var requirejs, require, define;
19081910
//that do not match the behavior of all other browsers with
19091911
//addEventListener support, which fire the onload event for a
19101912
//script right after the script execution. See:
1911-
//https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
1913+
//https://connect.microsoft.com/IE/feedback/details/648057/
1914+
// script-onload-event-is-not-fired-immediately-after-script-execution
19121915
//UNFORTUNATELY Opera implements attachEvent but does not follow the script
19131916
//script execution mode.
19141917
if (node.attachEvent &&
@@ -2139,7 +2142,7 @@ var requirejs, require, define;
21392142
*/
21402143
req.exec = function (text) {
21412144
/*jslint evil: true */
2142-
return eval(text);
2145+
return eval(text); // eslint-disable-line no-eval
21432146
};
21442147

21452148
//Set up with config info.

0 commit comments

Comments
 (0)