DescriptionIDL: Add any support to IDL dictionary and use it in CustomEventInit
We need "any" support to implement some EventInit dictionary.
Add CustomEventInit which has "details" member of type "any".
We need to be careful when initializing an event with "any" type
properties. It could be leaked from an isolated world to another isolated
world if we just keep them in an instance of DOM class and return it when
callback is called. See [1] for details.
Currently, we have special handling to avoid this problem. Suppose we
have an event interface E which has P property of type "any". We
annotate E with [EventConstructor] and P with
[InitializedByEventConstructor]. When these are specified, the code
generator generates a special constructor. This constructor sets the
value of P as a hidden value to a wrapper object and stores serialized
value to a DOM object. When the custom getter callback assicated
with P is called, the callback looks up the hidden value for P and
returns it if it exists. If lookup failed, the callback "clones" the
value of P from the serialized value, store it as a hidden value, then
returns it.
Since using EventInit dictionary doesn't work with [EventConstructor],
we need another solution. This CL adds ScriptValue::v8ValueFor(ScriptState*).
It is similar to ScriptValue::v8Value(), but returns "cloned" V8 value
when a given ScriptState is different from the ScriptState which is associated
with the ScriptValue. Getter callbacks for any type properties can use it
to make sure it won't leak V8 value to other worlds.
[1] https://docs.google.com/document/d/1AtnKpzQaSY3Mo1qTm68mt_3DkcZzrp_jcGS92a3a1UU/edit
BUG=433179
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=195573
Patch Set 1 #
Total comments: 8
Patch Set 2 : #
Total comments: 4
Patch Set 3 : #Messages
Total messages: 11 (3 generated)
|