Skip to content

Object.seal() behavior is not correct #174

@RuralHunter

Description

@RuralHunter

This should be a rhino problem.
According to the specification, the values of present properties of a sealed object can be changed as long as they are writable. The code below runs correctly in real browsers but fails in htmlunit with net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot add properties to this object because extensible is false.

fun=function() 
{
    "use strict";
    var r = {};
    Object.defineProperties(r, {
        a: {
            writable: true,
            value: 'aaa'
        }
    });
    r.a='abefore';
    alert('r.a before='+r.a);
    Object.seal(r);
    r.a='aafter';
    alert('r.a after='+r.a);
};
fun();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions