Skip to content

Setting Symbol.species should change the return value of constructor #239

Description

@RuralHunter

According the spec, if Symbol.species is set, the return value of constructor should be the value of Symbol.species. It seems rhino doesn't do this.

Test case:

            var emptyFunc=function() {};
            var p = Promise.resolve(1);
            p.constructor = {};
            var pt1=p.then(emptyFunc);
            console.log('pt1='+pt1);

            var t = function(e) {
                e(emptyFunc, emptyFunc);
            };
            p.constructor[Symbol.species] = t;
            var pt2=p.then(emptyFunc);
            console.log('pt2='+pt2);
            console.log(pt2 instanceof t);

In htmlunit the output is:

pt1=[object Promise]
pt2=[object Promise]
false

In real browser such as chrome, the output is:

pt1=[object Promise]
pt2=[object Object]
true

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    js-engineIssues related to the js engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions