Skip to content

Commit

Permalink
fix a possible RegExp constructor problem with multiple global `cor…
Browse files Browse the repository at this point in the history
…e-js` instances
  • Loading branch information
zloirock committed Apr 20, 2021
1 parent 8710503 commit b76f929
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Changelog
##### Unreleased
- Nothing
- Fixed a possible `RegExp` constructor problem with multiple global `core-js` instances

##### 3.10.2 - 2021.04.19
- `URL` and `URLSearchParams` marked as supported from Safari 14.0
Expand Down
7 changes: 5 additions & 2 deletions packages/core-js/modules/es.regexp.constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var getFlags = require('../internals/regexp-flags');
var stickyHelpers = require('../internals/regexp-sticky-helpers');
var redefine = require('../internals/redefine');
var fails = require('../internals/fails');
var setInternalState = require('../internals/internal-state').set;
var enforceInternalState = require('../internals/internal-state').enforce;
var setSpecies = require('../internals/set-species');
var wellKnownSymbol = require('../internals/well-known-symbol');

Expand Down Expand Up @@ -61,7 +61,10 @@ if (FORCED) {
RegExpWrapper
);

if (UNSUPPORTED_Y && sticky) setInternalState(result, { sticky: sticky });
if (UNSUPPORTED_Y && sticky) {
var state = enforceInternalState(result);
state.sticky = true;
}

return result;
};
Expand Down

0 comments on commit b76f929

Please sign in to comment.