mirror of
https://github.com/tc39/test262.git
synced 2025-05-03 14:30:27 +02:00
* [javascriptcore-test262-automation] changes from git@github.com:WebKit/webkit.git at sha 949e26452cfa153a7f4afe593da97e2fe9e1b706 on Tue Jul 03 2018 14:35:15 GMT-0400 (Eastern Daylight Time)
70 lines
1.6 KiB
JavaScript
70 lines
1.6 KiB
JavaScript
(function() {
|
|
// Remove a yet-to-be-visited indexed property during iteration.
|
|
var foo = function() {
|
|
var a = [1, 2, 3, 4, 5];
|
|
var result = "";
|
|
for (var p in a) {
|
|
if (p == 2)
|
|
delete a[3];
|
|
result += a[p];
|
|
}
|
|
return result;
|
|
};
|
|
noInline(foo);
|
|
for (var i = 0; i < 10000; ++i) {
|
|
if (foo() !== "1235")
|
|
throw new Error("bad result");
|
|
}
|
|
foo(null);
|
|
})();
|
|
(function() {
|
|
// Remove a yet-to-be-visited non-indexed property during iteration.
|
|
var foo = function() {
|
|
var o = {};
|
|
o.x = "x";
|
|
o.y = "y";
|
|
o.z = "z";
|
|
var result = "";
|
|
for (var p in o) {
|
|
if (p == "x") {
|
|
delete o.y;
|
|
o.a = "a";
|
|
}
|
|
result += o[p];
|
|
}
|
|
return result;
|
|
};
|
|
noInline(foo);
|
|
for (var i = 0; i < 10000; ++i) {
|
|
if (foo() !== "xz")
|
|
throw new Error("bad result");
|
|
}
|
|
})();
|
|
(function() {
|
|
// Remove then re-add a property during iteration.
|
|
var foo = function() {
|
|
var A = function() {};
|
|
A.prototype.x = "A.x";
|
|
A.prototype.y = "A.y";
|
|
var o = new A();
|
|
o.z = "o.z";
|
|
o.y = "o.y";
|
|
o.x = "o.x";
|
|
var result = "";
|
|
for (var p in o) {
|
|
if (p == "z")
|
|
delete o.x;
|
|
if (p == "y")
|
|
o.x = "o.x";
|
|
result += o[p];
|
|
}
|
|
return result;
|
|
};
|
|
noInline(foo);
|
|
for (var i = 0; i < 10000; ++i) {
|
|
if (foo() !== "o.zo.yo.x")
|
|
throw new Error("bad result");
|
|
}
|
|
foo(null);
|
|
})();
|