Same as bug 1546.
19.1.2.1 new Object ( [ value ] )
Symbol primitive type not handled in step 1.
Maybe just update 19.1.2.1 to call OrdinaryConstruct() to use the proper realm, currently `var foreignObject = otherRealm.Object; new foreignObject()` creates an object of the current execution context's realm instead of otherRealm.
Why do you say that about the real of the new object?
All object creations done by a built-in function are supposed to be in the same realm as the built-in unless the spec. explicitly says otherwise.
fixed in Rev20 editor's draft
new Object(aSymbol) now does ToObject(aSymbol)
This is my current understanding:
- ToObject() creates an object based on the current realm
- The current realm is determined by the top frame element of the ExecutionContext stack
- [[Call]] for ordinary functions push a new frame on the ExecutionContext stack
- So does [[Call]] for built-in functions (already spec'ed or TBD?)
- [[Construct]] does not push a new element on the execution stack
- But [[Construct]] may call [[Call]] which will create a new ExecutionContext
- [[Construct]] for "19.1 Object" is not updated to the new scheme where [[Construct]] just calls OrdinaryConstruct()
=> That means `new foreignObject()` does not push a new frame on the ExecutionContext stack, so the new object will be of the current execution context's realm instead of otherRealm.
(In reply to comment #3)
> This is my current understanding:
> - ToObject() creates an object based on the current realm
> - The current realm is determined by the top frame element of the
> ExecutionContext stack
> - [[Call]] for ordinary functions push a new frame on the ExecutionContext
> stack
> - So does [[Call]] for built-in functions (already spec'ed or TBD?)
This is my intent, although I think there is some additional spec. work that is need to make this clear.
> - [[Construct]] does not push a new element on the execution stack
> - But [[Construct]] may call [[Call]] which will create a new ExecutionContext
> - [[Construct]] for "19.1 Object" is not updated to the new scheme where
> [[Construct]] just calls OrdinaryConstruct()
Ah, I see. Yes, that still needs to be cleaned up.
>
> => That means `new foreignObject()` does not push a new frame on the
> ExecutionContext stack, so the new object will be of the current execution
> context's realm instead of otherRealm.
yes, it shouldn't do that.
fixed in rev20 draft, Oct. 28, 2013