Skip to content

Commit

Permalink
Bug 1672862 - Part 1: Change TypedArray indexed properties to report …
Browse files Browse the repository at this point in the history
…as configurable. r=tcampbell

Implements the changes from <tc39/ecma262#2164> and
<tc39/ecma262#2210> for [[GetOwnProperty]]. Part 3
will update [[DefineOwnProperty]] and part 5 updates [[Set]].

A side-effect of this change is that non-extensible, non-empty TypedArrays are
no longer considered as sealed by `Object.isSealed()`.

A later patch in this series will update test262 to enable more currently
skipped TypedArray tests.

Differential Revision: https://phabricator.services.mozilla.com/D99380

UltraBlame original commit: efd88e38955fc4722c6a882c175fdb48d6ff9e10
  • Loading branch information
marco-c committed Jan 1, 2021
1 parent d8d8a37 commit 6e752ba
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 48 deletions.
2 changes: 1 addition & 1 deletion js/src/tests/non262/TypedArray/object-defineproperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ assertEq
desc
.
configurable
false
true
)
;
assertEq
Expand Down
23 changes: 20 additions & 3 deletions js/src/tests/non262/TypedArray/seal-and-freeze.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ array
true
)
;
/
/
Non
-
empty
typed
arrays
can
never
be
sealed
because
the
elements
stay
configurable
.
array
=
new
Expand Down Expand Up @@ -120,7 +137,7 @@ isSealed
(
array
)
true
false
)
;
array
Expand Down Expand Up @@ -154,7 +171,7 @@ isSealed
(
array
)
true
false
)
;
assertThrowsInstanceOf
Expand Down Expand Up @@ -214,7 +231,7 @@ typed
-
array
is
trvially
trivially
frozen
var
array
Expand Down
14 changes: 6 additions & 8 deletions js/src/tests/non262/TypedArray/test-integrity-level.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Non
empty
typed
arrays
can
cannot
be
sealed
.
Expand Down Expand Up @@ -130,7 +130,7 @@ isSealed
(
ta
)
true
false
)
;
assertEq
Expand Down Expand Up @@ -270,7 +270,7 @@ isSealed
(
ta
)
true
false
)
;
assertEq
Expand Down Expand Up @@ -360,11 +360,9 @@ empty
typed
arrays
are
neither
sealed
but
aren
'
t
nor
frozen
.
for
Expand Down Expand Up @@ -413,7 +411,7 @@ isSealed
(
ta
)
true
false
)
;
assertEq
Expand Down
20 changes: 6 additions & 14 deletions js/src/vm/JSObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4369,24 +4369,25 @@ Typed
array
elements
are
non
-
configurable
writable
properties
so
/
/
if
any
/
/
elements
are
present
the
typed
array
cannot
can
neither
be
sealed
nor
frozen
.
if
Expand Down Expand Up @@ -4421,15 +4422,6 @@ get
)
>
0
&
&
level
=
=
IntegrityLevel
:
:
Frozen
)
{
*
Expand Down
51 changes: 31 additions & 20 deletions js/src/vm/NativeObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19744,6 +19744,37 @@ failCantDelete
)
;
}
/
/
Typed
array
elements
are
configurable
but
can
'
t
be
deleted
.
if
(
prop
.
isTypedArrayElement
(
)
)
{
return
result
.
failCantDelete
(
)
;
}
if
(
!
Expand Down Expand Up @@ -19783,26 +19814,6 @@ true
}
/
/
Typed
array
elements
are
non
-
configurable
.
MOZ_ASSERT
(
!
prop
.
isTypedArrayElement
(
)
)
;
/
/
Step
5
.
Expand Down
2 changes: 0 additions & 2 deletions js/src/vm/Shape-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1873,8 +1873,6 @@ isTypedArrayElement
{
return
JSPROP_ENUMERATE
|
JSPROP_PERMANENT
;
}
return
Expand Down

0 comments on commit 6e752ba

Please sign in to comment.