Skip to content

Commit

Permalink
Fixes requirejs/requirejs#1854, pollution
Browse files Browse the repository at this point in the history
Merge the previous `denyProps` fix (3e9eb74) with `disallowedProps`,
which apply to any call to `eachProps`.
  • Loading branch information
jrburke authored and prantlf committed Jul 22, 2024
1 parent 8e011c9 commit da8c9f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 5 additions & 4 deletions dist/r.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license r.js 3.0.1 Sun, 23 Apr 2023 13:09:47 GMT Copyright jQuery Foundation and other contributors.
* @license r.js 3.0.1 Mon Jul 22 13:19:58 UTC 2024 Copyright jQuery Foundation and other contributors.
* Released under MIT license, http://github.com/requirejs/r.js/LICENSE
*/

Expand All @@ -19,7 +19,7 @@ var requirejs, require, define, xpcUtil;
(function (console, args, readFileFunc) {
var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode, Cc, Ci,
version = '3.0.1 Sun, 23 Apr 2023 13:09:47 GMT',
version = 'Mon Jul 22 13:19:58 UTC 2024',
jsSuffixRegExp = /\.js$/,
commandOption = '',
useLibLoaded = {},
Expand Down Expand Up @@ -282,7 +282,8 @@ var requirejs, require, define, xpcUtil;
contexts = {},
cfg = {},
globalDefQueue = [],
useInteractive = false;
useInteractive = false,
disallowedProps = ['__proto__', 'constructor'];

//Could match something like ')//comment', do not lose the prefix to comment.
function commentReplace(match, singlePrefix) {
Expand Down Expand Up @@ -343,7 +344,7 @@ var requirejs, require, define, xpcUtil;
function eachProp(obj, func) {
var prop;
for (prop in obj) {
if (hasProp(obj, prop)) {
if (hasProp(obj, prop) && disallowedProps.indexOf(prop) == -1) {
if (func(obj[prop], prop)) {
break;
}
Expand Down
12 changes: 5 additions & 7 deletions require.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.3.6 Copyright jQuery Foundation and other contributors.
* @license RequireJS 2.3.7 Copyright jQuery Foundation and other contributors.
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
*/
//Not using strict: uneven strict support in browsers, #392, and causes
Expand All @@ -11,7 +11,7 @@ var requirejs, require, define;
(function (global, setTimeout) {
var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.3.6',
version = '2.3.7',
commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/,
Expand All @@ -33,7 +33,8 @@ var requirejs, require, define;
contexts = {},
cfg = {},
globalDefQueue = [],
useInteractive = false;
useInteractive = false,
disallowedProps = ['__proto__', 'constructor'];

//Could match something like ')//comment', do not lose the prefix to comment.
function commentReplace(match, singlePrefix) {
Expand Down Expand Up @@ -94,7 +95,7 @@ var requirejs, require, define;
function eachProp(obj, func) {
var prop;
for (prop in obj) {
if (hasProp(obj, prop)) {
if (hasProp(obj, prop) && disallowedProps.indexOf(prop) == -1) {
if (func(obj[prop], prop)) {
break;
}
Expand Down Expand Up @@ -1262,8 +1263,6 @@ var requirejs, require, define;
context.defQueueMap = {};
}

var denyProps = ["__proto__", "constructor", "prototype"];

context = {
config: config,
contextName: contextName,
Expand Down Expand Up @@ -1308,7 +1307,6 @@ var requirejs, require, define;
};

eachProp(cfg, function (value, prop) {
if (denyProps.indexOf(prop) >= 0) return;
if (objs[prop]) {
if (!config[prop]) {
config[prop] = {};
Expand Down

0 comments on commit da8c9f8

Please sign in to comment.