From ecc356a219b79075c562d002c21d18436482e15a Mon Sep 17 00:00:00 2001 From: James Burke Date: Mon, 15 Jul 2024 22:26:43 -0700 Subject: [PATCH] Fixes requirejs/requirejs#1854, pollution --- dist/r.js | 9 +++++---- require.js | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dist/r.js b/dist/r.js index 46f2864d..ca747184 100644 --- a/dist/r.js +++ b/dist/r.js @@ -1,5 +1,5 @@ /** - * @license r.js 2.3.6 Copyright jQuery Foundation and other contributors. + * @license r.js 2.3.6+ Tue, 16 Jul 2024 05:19:14 GMT Copyright jQuery Foundation and other contributors. * Released under MIT license, http://github.com/requirejs/r.js/LICENSE */ @@ -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 = '2.3.6', + version = '2.3.6 Tue, 16 Jul 2024 05:19:14 GMT', jsSuffixRegExp = /\.js$/, commandOption = '', useLibLoaded = {}, @@ -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) { @@ -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; } diff --git a/require.js b/require.js index 78490f91..acda0565 100644 --- a/require.js +++ b/require.js @@ -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) { @@ -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; }