Closed Bug 945566 Opened 11 years ago Closed 9 years ago

ES6 Proxies: calling Proxy() without `new` keyword -> TypeError

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: jorendorff, Assigned: efaust)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, site-compat)

Attachments

(1 file)

http://esdiscuss.org/notes/2013-11-19 contains this:

> REQUIRE `new Proxy` by making Proxy an exotic function that has it's
> own internal construct. (this is only "action" item)

That is, `Proxy()` will be specified to throw a TypeError.
Blocks: 703537
Blocks: 978228
Summary: ES6: calling Proxy() without `new` keyword -> TypeError → ES6 Proxies: calling Proxy() without `new` keyword -> TypeError
Assignee: general → efaustbmo
Status: NEW → ASSIGNED
Attachment #8450035 - Flags: review?(jorendorff)
Some test files still need to be updated:

jit-test/tests/auto-regress/bug580694.js
jit-test/tests/gc/bug-913715.js
jit-test/tests/proxy/testDirectProxyApply1.js
jit-test/tests/proxy/testDirectProxyConstruct1.js
jit-test/tests/proxy/testDirectProxyDefineProperty1.js
jit-test/tests/proxy/testDirectProxyGet1.js
jit-test/tests/proxy/testDirectProxyGetOwnPropertyDescriptor1.js
jit-test/tests/proxy/testDirectProxyHas1.js
jit-test/tests/proxy/testDirectProxyHasOwnProperty.js
jit-test/tests/proxy/testDirectProxyKeys1.js
jit-test/tests/proxy/testDirectProxySet1.js
jit-test/tests/proxy/testDirectProxyValidateProperty1.js
(In reply to André Bargull from comment #3)
> Some test files still need to be updated:
> 
> jit-test/tests/auto-regress/bug580694.js
> jit-test/tests/gc/bug-913715.js
> jit-test/tests/proxy/testDirectProxyApply1.js
> jit-test/tests/proxy/testDirectProxyConstruct1.js
> jit-test/tests/proxy/testDirectProxyDefineProperty1.js
> jit-test/tests/proxy/testDirectProxyGet1.js
> jit-test/tests/proxy/testDirectProxyGetOwnPropertyDescriptor1.js
> jit-test/tests/proxy/testDirectProxyHas1.js
> jit-test/tests/proxy/testDirectProxyHasOwnProperty.js
> jit-test/tests/proxy/testDirectProxyKeys1.js
> jit-test/tests/proxy/testDirectProxySet1.js
> jit-test/tests/proxy/testDirectProxyValidateProperty1.js

Oh, yeah. This patch was written on top of the patch in bug 978279, where adding Proxy.revocable to all the tests gave me an opportunity to clean up the rest of those cases. Sorry for the confusion.
Comment on attachment 8450035 [details] [diff] [review]
proxyConstructOnly.patch

Review of attachment 8450035 [details] [diff] [review]:
-----------------------------------------------------------------

Please announce this change on dev.platform before it goes in. Surely it'll break somebody.

::: js/src/jsproxy.cpp
@@ +2965,3 @@
>      if (args.length() < 2) {
>          JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
>                               "Proxy", "1", "s");

Hey, great. Now that this is factored differently, you can pass in the string "Proxy" at one call site and "Proxy.revocable" at the other, for a better error message in the latter case.
Attachment #8450035 - Flags: review?(jorendorff) → review+
Depends on: 1118489
https://hg.mozilla.org/mozilla-central/rev/8b26ea0c66f3
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: