Bug 170878 - test262: test262/test/language/expressions/tagged-template/template-object.js
Summary: test262: test262/test/language/expressions/tagged-template/template-object.js
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-15 16:23 PDT by Joseph Pecoraro
Modified: 2017-04-16 13:01 PDT (History)
8 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (12.93 KB, patch)
2017-04-15 16:42 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews104 for mac-elcapitan-wk2 (1.00 MB, application/zip)
2017-04-15 17:58 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews117 for mac-elcapitan (1.67 MB, application/zip)
2017-04-15 18:09 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2017-04-15 16:23:57 PDT
test262/test/language/expressions/tagged-template/template-object.js

And other test262 tests.

Boils down to:
var arr = [];
Object.freeze(arr);
arr.length = "test";
assert( arr.length === 0 );

Expected:
No runtime exception and length doesn't change.

Actual:
Exception: RangeError: Invalid array length

Notes:
- Chrome, Firefox, and Edge all do not throw an exception here
- Seems JavaScriptCore has a JSArray::put fast path that doesn't check the is array writable before attempting to set the length

Spec:

12.15.4 Runtime Semantics: Evaluation
https://tc39.github.io/ecma262/#sec-assignment-operators-runtime-semantics-evaluation

> 1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, then
>    ...
>    f. Perform ? PutValue(lref, rval).

6.2.4.2 PutValue ( V, W )
https://tc39.github.io/ecma262/#sec-putvalue

> 6. Else if IsPropertyReference(V) is true, then
>     ...
>     b. Let succeeded be ? base.[[Set]](GetReferencedName(V), W, GetThisValue(V)).
>     c. If succeeded is false and IsStrictReference(V) is true, throw a TypeError exception.
>     d. Return.

9.1.9 [[Set]] ( P, V, Receiver )
https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver

> 1. Return ? OrdinarySet(O, P, V, Receiver).

9.1.9.1 OrdinarySet ( O, P, V, Receiver )
https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-set-p-v-receiver

> 4. If IsDataDescriptor(ownDesc) is true, then
>      a. If ownDesc.[[Writable]] is false, return false.
>      ...
>      d. If existingDescriptor is not undefined, then
>          ...
>         iv) Return ? Receiver.[[DefineOwnProperty]](P, valueDesc).

4.d.iv This DefineOwnProperty would throw a range error except 4.a should already have returned if this is not writable.
Comment 1 Joseph Pecoraro 2017-04-15 16:42:02 PDT
Created attachment 307205 [details]
[PATCH] Proposed Fix
Comment 2 Build Bot 2017-04-15 17:58:02 PDT
Comment on attachment 307205 [details]
[PATCH] Proposed Fix

Attachment 307205 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3542628

New failing tests:
webrtc/multi-video.html
Comment 3 Build Bot 2017-04-15 17:58:03 PDT
Created attachment 307210 [details]
Archive of layout-test-results from ews104 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 4 Build Bot 2017-04-15 18:08:59 PDT
Comment on attachment 307205 [details]
[PATCH] Proposed Fix

Attachment 307205 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3542641

New failing tests:
workers/wasm-long-compile-many.html
Comment 5 Build Bot 2017-04-15 18:09:00 PDT
Created attachment 307211 [details]
Archive of layout-test-results from ews117 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 6 Saam Barati 2017-04-16 10:12:26 PDT
Comment on attachment 307205 [details]
[PATCH] Proposed Fix

LGTM
Comment 7 Joseph Pecoraro 2017-04-16 12:33:32 PDT
Comment on attachment 307205 [details]
[PATCH] Proposed Fix

Test failures are unrelated.
Comment 8 WebKit Commit Bot 2017-04-16 13:01:29 PDT
Comment on attachment 307205 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 307205

Committed r215401: <http://trac.webkit.org/changeset/215401>
Comment 9 WebKit Commit Bot 2017-04-16 13:01:30 PDT
All reviewed patches have been landed.  Closing bug.