if (arg === value) return this;
args.push(value);
}
+ if (key == "replace" && typeof args[1] == "function") return this;
try {
return val[key].apply(val, args);
} catch (ex) {
} else if (expr instanceof AST_RegExp) {
map = native_fns.RegExp;
} else if (expr.is_string(compressor)) {
+ if (this.property == "replace") return false;
map = native_fns.String;
} else if (!this.may_throw_on_access(compressor)) {
map = native_fns.Object;
}
expect_stdout: "PASS"
}
+
+unsafe_string_replace: {
+ options = {
+ side_effects: true,
+ unsafe: true,
+ }
+ input: {
+ "foo".replace("f", function() {
+ console.log("PASS");
+ });
+ }
+ expect: {
+ "foo".replace("f", function() {
+ console.log("PASS");
+ });
+ }
+ expect_stdout: "PASS"
+}
}
expect_stdout: "PASS"
}
+
+unsafe_string_replace: {
+ options = {
+ evaluate: true,
+ unsafe: true,
+ }
+ input: {
+ "foo".replace("f", function() {
+ console.log("PASS");
+ });
+ }
+ expect: {
+ "foo".replace("f", function() {
+ console.log("PASS");
+ });
+ }
+ expect_stdout: "PASS"
+}