Applying non-generic methods to scripted direct proxies should throw TypeError

RESOLVED WORKSFORME

Status

()

RESOLVED WORKSFORME
5 years ago
3 years ago

People

(Reporter: jorendorff, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
I don't think there's anything in ES6 that says this method call should work:

    var p = new Proxy(new Date(), {});
    Date.prototype.getFullYear.call(p); // should throw TypeError

I think it should fail, because:
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-date-prototype-object

> The abstract operation thisTimeValue(value) performs the following steps:
> 
>     1. If Type(value) is Object and value has a [[DateValue]] internal data
>        property, then
>         a. Let n be the Number that is the value of value’s [[DateValue]]
>            internal data property.
>         b. If n is not undefined, then return n.
>     2. Throw a TypeError exception.


This ends up in DirectProxyHandler::nativeCall().

The obvious fix would be to add ScriptedDirectProxyHandler::nativeCall() along the lines of the existing code below:

    bool
    BaseProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args)
    {
        ReportIncompatible(cx, args);
        return false;
    }
(Assignee)

Updated

4 years ago
Assignee: general → nobody
The test case is no longer reproducible - resolving as WFM.

ScriptedDirectProxyHandler::nativeCall was added in http://hg.mozilla.org/mozilla-central/rev/c1fb4bf7b043.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.