Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Issue 1130763006: IDL: Add any support to IDL dictionary and use it in CustomEventInit (Closed)

Created:
5 years, 7 months ago by bashi
Modified:
5 years, 6 months ago
Reviewers:
haraken
CC:
blink-reviews, blink-reviews-bindings_chromium.org, vivekg_samsung, arv+blink, Inactive, vivekg, Yuki
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

IDL: 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 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+82 lines, -42 lines) Patch
M LayoutTests/fast/events/constructors/custom-event-constructor.html View 1 chunk +3 lines, -2 lines 0 comments Download
M LayoutTests/fast/events/constructors/custom-event-constructor-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/core/v8/ScriptValue.h View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M Source/bindings/core/v8/ScriptValue.cpp View 1 2 2 chunks +15 lines, -0 lines 0 comments Download
M Source/bindings/core/v8/custom/V8CustomEventCustom.cpp View 2 chunks +11 lines, -22 lines 0 comments Download
M Source/bindings/scripts/v8_dictionary.py View 1 3 chunks +1 line, -3 lines 0 comments Download
M Source/bindings/scripts/v8_types.py View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/bindings/tests/idls/core/TestDictionary.idl View 1 chunk +1 line, -0 lines 0 comments Download
M Source/bindings/tests/results/core/TestDictionary.h View 2 chunks +5 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestDictionary.cpp View 2 chunks +22 lines, -0 lines 0 comments Download
M Source/core/core.gypi View 1 2 chunks +3 lines, -0 lines 0 comments Download
M Source/core/events/CustomEvent.h View 1 3 chunks +4 lines, -7 lines 0 comments Download
M Source/core/events/CustomEvent.cpp View 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/events/CustomEvent.idl View 1 chunk +3 lines, -3 lines 0 comments Download
A + Source/core/events/CustomEventInit.idl View 1 chunk +4 lines, -2 lines 0 comments Download

Messages

Total messages: 11 (3 generated)
bashi
Haraken-san, what do you think about this CL? A developer asked me a question about ...
5 years, 7 months ago (2015-05-13 09:44:35 UTC) #2
haraken
(I might not have time to look at this until the weekend :-)
5 years, 7 months ago (2015-05-13 14:58:36 UTC) #3
haraken
https://codereview.chromium.org/1130763006/diff/1/Source/bindings/core/v8/custom/V8CustomEventCustom.cpp File Source/bindings/core/v8/custom/V8CustomEventCustom.cpp (right): https://codereview.chromium.org/1130763006/diff/1/Source/bindings/core/v8/custom/V8CustomEventCustom.cpp#newcode66 Source/bindings/core/v8/custom/V8CustomEventCustom.cpp:66: if (SerializedScriptValue* serializedValue = event->serializedDetail()) This will be problematic ...
5 years, 7 months ago (2015-05-18 01:59:44 UTC) #4
bashi
https://codereview.chromium.org/1130763006/diff/1/Source/bindings/core/v8/custom/V8CustomEventCustom.cpp File Source/bindings/core/v8/custom/V8CustomEventCustom.cpp (right): https://codereview.chromium.org/1130763006/diff/1/Source/bindings/core/v8/custom/V8CustomEventCustom.cpp#newcode66 Source/bindings/core/v8/custom/V8CustomEventCustom.cpp:66: if (SerializedScriptValue* serializedValue = event->serializedDetail()) On 2015/05/18 01:59:44, haraken ...
5 years, 7 months ago (2015-05-20 00:22:01 UTC) #5
haraken
LGTM https://codereview.chromium.org/1130763006/diff/20001/Source/bindings/core/v8/ScriptValue.cpp File Source/bindings/core/v8/ScriptValue.cpp (right): https://codereview.chromium.org/1130763006/diff/20001/Source/bindings/core/v8/ScriptValue.cpp#newcode75 Source/bindings/core/v8/ScriptValue.cpp:75: ASSERT(!targetScriptState->world().isWorkerWorld()); Are these isWorkerWorld checks useful? https://codereview.chromium.org/1130763006/diff/20001/Source/bindings/core/v8/ScriptValue.h File ...
5 years, 7 months ago (2015-05-20 00:43:42 UTC) #6
bashi
https://codereview.chromium.org/1130763006/diff/20001/Source/bindings/core/v8/ScriptValue.cpp File Source/bindings/core/v8/ScriptValue.cpp (right): https://codereview.chromium.org/1130763006/diff/20001/Source/bindings/core/v8/ScriptValue.cpp#newcode75 Source/bindings/core/v8/ScriptValue.cpp:75: ASSERT(!targetScriptState->world().isWorkerWorld()); On 2015/05/20 00:43:42, haraken wrote: > > Are ...
5 years, 7 months ago (2015-05-20 00:52:22 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1130763006/40001
5 years, 7 months ago (2015-05-20 01:02:02 UTC) #10
commit-bot: I haz the power
5 years, 7 months ago (2015-05-20 02:28:22 UTC) #11
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=195573

Powered by Google App Engine
This is Rietveld 408576698