| Index: src/string.js
|
| ===================================================================
|
| --- src/string.js (revision 8618)
|
| +++ src/string.js (working copy)
|
| @@ -251,7 +251,9 @@
|
|
|
| // Compute the string to replace with.
|
| if (IS_FUNCTION(replace)) {
|
| - builder.add(%_CallFunction(%GetGlobalReceiver(),
|
| + var receiver =
|
| + %_IsNativeOrStrictMode(replace) ? void 0 : %GetGlobalReceiver();
|
| + builder.add(%_CallFunction(receiver,
|
| search,
|
| start,
|
| subject,
|
| @@ -274,7 +276,7 @@
|
| // the result.
|
| function ExpandReplacement(string, subject, matchInfo, builder) {
|
| var length = string.length;
|
| - var builder_elements = builder.elements;
|
| + var builder_elements = builder.elements;
|
| var next = %StringIndexOf(string, '$', 0);
|
| if (next < 0) {
|
| if (length > 0) builder_elements.push(string);
|
| @@ -418,7 +420,8 @@
|
| if (NUMBER_OF_CAPTURES(lastMatchInfo) == 2) {
|
| var match_start = 0;
|
| var override = new InternalArray(null, 0, subject);
|
| - var receiver = %GetGlobalReceiver();
|
| + var receiver =
|
| + %_IsNativeOrStrictMode(replace) ? void 0 : %GetGlobalReceiver();
|
| while (i < len) {
|
| var elem = res[i];
|
| if (%_IsSmi(elem)) {
|
| @@ -475,8 +478,10 @@
|
| // No captures, only the match, which is always valid.
|
| var s = SubString(subject, index, endOfMatch);
|
| // Don't call directly to avoid exposing the built-in global object.
|
| + var receiver =
|
| + %_IsNativeOrStrictMode(replace) ? void 0 : %GetGlobalReceiver();
|
| replacement =
|
| - %_CallFunction(%GetGlobalReceiver(), s, index, subject, replace);
|
| + %_CallFunction(receiver, s, index, subject, replace);
|
| } else {
|
| var parameters = new InternalArray(m + 2);
|
| for (var j = 0; j < m; j++) {
|
|
|