Skip to content

Commit ecc356a

Browse files
committed
Fixes requirejs/requirejs#1854, pollution
1 parent acec536 commit ecc356a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

dist/r.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license r.js 2.3.6 Copyright jQuery Foundation and other contributors.
2+
* @license r.js 2.3.6+ Tue, 16 Jul 2024 05:19:14 GMT Copyright jQuery Foundation and other contributors.
33
* Released under MIT license, http://github.com/requirejs/r.js/LICENSE
44
*/
55

@@ -19,7 +19,7 @@ var requirejs, require, define, xpcUtil;
1919
(function (console, args, readFileFunc) {
2020
var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
2121
nodeDefine, exists, reqMain, loadedOptimizedLib, existsForNode, Cc, Ci,
22-
version = '2.3.6',
22+
version = '2.3.6 Tue, 16 Jul 2024 05:19:14 GMT',
2323
jsSuffixRegExp = /\.js$/,
2424
commandOption = '',
2525
useLibLoaded = {},
@@ -282,7 +282,8 @@ var requirejs, require, define, xpcUtil;
282282
contexts = {},
283283
cfg = {},
284284
globalDefQueue = [],
285-
useInteractive = false;
285+
useInteractive = false,
286+
disallowedProps = ['__proto__', 'constructor'];
286287

287288
//Could match something like ')//comment', do not lose the prefix to comment.
288289
function commentReplace(match, singlePrefix) {
@@ -343,7 +344,7 @@ var requirejs, require, define, xpcUtil;
343344
function eachProp(obj, func) {
344345
var prop;
345346
for (prop in obj) {
346-
if (hasProp(obj, prop)) {
347+
if (hasProp(obj, prop) && disallowedProps.indexOf(prop) == -1) {
347348
if (func(obj[prop], prop)) {
348349
break;
349350
}

require.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ var requirejs, require, define;
3333
contexts = {},
3434
cfg = {},
3535
globalDefQueue = [],
36-
useInteractive = false;
36+
useInteractive = false,
37+
disallowedProps = ['__proto__', 'constructor'];
3738

3839
//Could match something like ')//comment', do not lose the prefix to comment.
3940
function commentReplace(match, singlePrefix) {
@@ -94,7 +95,7 @@ var requirejs, require, define;
9495
function eachProp(obj, func) {
9596
var prop;
9697
for (prop in obj) {
97-
if (hasProp(obj, prop)) {
98+
if (hasProp(obj, prop) && disallowedProps.indexOf(prop) == -1) {
9899
if (func(obj[prop], prop)) {
99100
break;
100101
}

0 commit comments

Comments
 (0)