Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: test/mjsunit/array-length.js

Issue 2543553002: [accessors] handle `writable` changing during ArrayLengthSetter (Closed)
Patch Set: refactor branch conditions for unlikely case Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/accessors.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/array-length.js
diff --git a/test/mjsunit/array-length.js b/test/mjsunit/array-length.js
index 02103fa3713e22ee6256068f490292019036f1eb..ea2a6725b7c8b2506b47bbdf02988f1feab10f15 100644
--- a/test/mjsunit/array-length.js
+++ b/test/mjsunit/array-length.js
@@ -132,3 +132,30 @@ for (var i = 0; i < 7; i++) {
var frozen_object = Object.freeze({__proto__:[]});
assertThrows(function () { frozen_object.length = 10 });
})();
+
+(function sloppyReentrantDescriptorChange() {
+ var b = [];
+ b.length = {
+ valueOf() {
+ Object.defineProperty(b, "length", {writable: false});
+ return 1;
+ }
+ };
+ assertEquals(0, b.length);
+})();
+
+(function strictReentrantDescriptorChange() {
+ var b = [];
+ assertThrows(() => {
+ "use strict";
+ b.length = {
+ valueOf() {
+ Object.defineProperty(b, "length", {writable: false});
+ return 1;
+ }
+ };
+ }, TypeError);
+
+ b.length = { valueOf() { return 0; } };
+ assertEquals(0, b.length);
+})();
« no previous file with comments | « src/accessors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698