jdk8/jdk8/nashorn: 0548c134b9ac (original) (raw)

OpenJDK / jdk8 / jdk8 / nashorn

changeset 170:0548c134b9ac

8011421: When using Object.defineProperty on arrays, PropertyDescriptor's property accessors are invoked multiple times Reviewed-by: lagergren, hannesw

sundar
date Thu, 04 Apr 2013 13:54:51 +0530
parents a5a8ddc2e028
children 069923cc9de5 5eb1427b6a6d
files src/jdk/nashorn/internal/objects/NativeArray.java test/script/basic/JDK-8011421.js
diffstat 2 files changed, 54 insertions(+), 3 deletions(-)[+] [-] src/jdk/nashorn/internal/objects/NativeArray.java 6 test/script/basic/JDK-8011421.js 51

line wrap: on

line diff

--- a/src/jdk/nashorn/internal/objects/NativeArray.java Thu Apr 04 10:24:46 2013 +0530 +++ b/src/jdk/nashorn/internal/objects/NativeArray.java Thu Apr 04 13:54:51 2013 +0530 @@ -160,7 +160,7 @@ if ("length".equals(key)) { // Step 3a if (!desc.has(VALUE)) {

// Step 3b @@ -242,7 +242,7 @@ // Step 4c // set the new array element

// Step 4d if (!succeeded) { @@ -263,7 +263,7 @@ } // not an index property

--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/script/basic/JDK-8011421.js Thu Apr 04 13:54:51 2013 +0530 @@ -0,0 +1,51 @@ +/*

+); + +// make array length non-configurable +Object.defineProperty([], "length", propDesc); + +// above should have called "configurable" getter only once +if (configurableGetterCalled !== 1) {

+}