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

Issue 362993004: Implement Blink-in-JS for DOM attributes (Closed)

Created:
6 years, 5 months ago by haraken
Modified:
6 years, 5 months ago
CC:
arv+blink, blink-reviews, blink-reviews-bindings_chromium.org, Inactive, watchdog-blink-watchlist_google.com
Project:
blink
Visibility:
Public.

Description

Implement Blink-in-JS for DOM attributes * This CL implements the core infrastructure of Blink-in-JS to support DOM attributes. * Developers can use DOM attributes in Blink-in-JS as follows: (1) Implement DOM attribute getters/setters in JavaScript. // Foo.js installClass("Foo", function(window) { var FooPrototype = {}; FooPrototype.initialize = function() { // Initialize properties of |this| object. this.m_attr = "initial value"; } Object.defineProperty(FooPrototype, "attr", { get: function() { return this.m_attr; }, // DOM attribute getter set: function(value) { return this.m_attr = attr; } // DOM attribute setter }) return FooPrototype; }); (2) Add an [ImplementedInPrivateScript] IDL attribute to Foo.idl. // Foo.idl interface Foo { [ImplementedInPrivateScript] attribute DOMString attr; }; * For more details, see changes to Internals.js and Internals.idl. * bindings/scripts/v8_attributes.py and bindings/templates/attributes.cpp implement the binding layer that connects DOM attributes with private scripts. Only primitive types and DOM wrappers are allowed as types of attribute values used in Blink-in-JS. BUG=341031 TEST=fast/dom/private_script_unittest.html Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=177511

Patch Set 1 #

Total comments: 2

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 13

Patch Set 5 : #

Total comments: 4

Patch Set 6 : #

Patch Set 7 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+567 lines, -44 lines) Patch
M LayoutTests/fast/dom/Window/resources/window-property-collector.js View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M LayoutTests/fast/dom/private_script_unittest.html View 1 2 1 chunk +12 lines, -0 lines 0 comments Download
M LayoutTests/fast/dom/private_script_unittest-expected.txt View 1 2 1 chunk +7 lines, -0 lines 0 comments Download
M Source/bindings/core/v8/PrivateScriptRunner.h View 1 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/core/v8/PrivateScriptRunner.cpp View 1 2 3 4 5 2 chunks +67 lines, -7 lines 2 comments Download
M Source/bindings/core/v8/V8HiddenValue.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M Source/bindings/scripts/v8_attributes.py View 1 2 3 4 12 chunks +42 lines, -5 lines 0 comments Download
M Source/bindings/scripts/v8_methods.py View 1 2 3 4 3 chunks +6 lines, -7 lines 0 comments Download
M Source/bindings/scripts/v8_types.py View 1 5 chunks +17 lines, -9 lines 0 comments Download
M Source/bindings/templates/attributes.cpp View 1 2 3 4 2 chunks +61 lines, -1 line 0 comments Download
M Source/bindings/templates/interface_base.cpp View 1 chunk +10 lines, -2 lines 0 comments Download
M Source/bindings/templates/methods.cpp View 1 2 3 4 2 chunks +7 lines, -7 lines 0 comments Download
M Source/bindings/tests/idls/TestObject.idl View 1 1 chunk +4 lines, -0 lines 0 comments Download
M Source/bindings/tests/results/V8TestObject.cpp View 1 2 3 4 7 chunks +297 lines, -5 lines 0 comments Download
M Source/core/testing/Internals.idl View 1 2 chunks +5 lines, -0 lines 0 comments Download
M Source/core/testing/Internals.js View 1 2 3 4 5 2 chunks +25 lines, -0 lines 0 comments Download

Messages

Total messages: 31 (0 generated)
haraken
This is still work-in-progress. Not ready for review.
6 years, 5 months ago (2014-07-02 14:16:07 UTC) #1
abarth-chromium
https://codereview.chromium.org/362993004/diff/1/Source/core/testing/Internals.js File Source/core/testing/Internals.js (right): https://codereview.chromium.org/362993004/diff/1/Source/core/testing/Internals.js#newcode114 Source/core/testing/Internals.js:114: } This is pretty ugly. It would be much ...
6 years, 5 months ago (2014-07-02 14:26:31 UTC) #2
haraken
https://codereview.chromium.org/362993004/diff/1/Source/core/testing/Internals.js File Source/core/testing/Internals.js (right): https://codereview.chromium.org/362993004/diff/1/Source/core/testing/Internals.js#newcode114 Source/core/testing/Internals.js:114: } On 2014/07/02 14:26:31, abarth wrote: > This is ...
6 years, 5 months ago (2014-07-02 15:47:20 UTC) #3
haraken
abarth@, arv@: I supported formal getters and setters of DOM attributes. PTAL at PrivateScriptRunner.{h,cpp} and ...
6 years, 5 months ago (2014-07-03 11:10:25 UTC) #4
Jens Widell
https://codereview.chromium.org/362993004/diff/60001/Source/bindings/scripts/v8_attributes.py File Source/bindings/scripts/v8_attributes.py (right): https://codereview.chromium.org/362993004/diff/60001/Source/bindings/scripts/v8_attributes.py#newcode138 Source/bindings/scripts/v8_attributes.py:138: 'argument_cpp_type': idl_type.cpp_type_args(used_as_argument=True), Alphabetical order. :-) https://codereview.chromium.org/362993004/diff/60001/Source/bindings/scripts/v8_attributes.py#newcode194 Source/bindings/scripts/v8_attributes.py:194: if 'ImplementedInPrivateScript' ...
6 years, 5 months ago (2014-07-03 11:33:14 UTC) #5
haraken
Thanks for review! https://codereview.chromium.org/362993004/diff/60001/Source/bindings/scripts/v8_attributes.py File Source/bindings/scripts/v8_attributes.py (right): https://codereview.chromium.org/362993004/diff/60001/Source/bindings/scripts/v8_attributes.py#newcode138 Source/bindings/scripts/v8_attributes.py:138: 'argument_cpp_type': idl_type.cpp_type_args(used_as_argument=True), On 2014/07/03 11:33:14, Jens ...
6 years, 5 months ago (2014-07-03 11:56:09 UTC) #6
Jens Widell
IDL compiler LGTM. https://codereview.chromium.org/362993004/diff/80001/Source/bindings/scripts/v8_types.py File Source/bindings/scripts/v8_types.py (right): https://codereview.chromium.org/362993004/diff/80001/Source/bindings/scripts/v8_types.py#newcode484 Source/bindings/scripts/v8_types.py:484: macro = 'TONATIVE_DEFAULT_EXCEPTIONSTATE' if used_in_private_script else ...
6 years, 5 months ago (2014-07-03 13:23:26 UTC) #7
haraken
On 2014/07/03 13:23:26, Jens Lindström wrote: > IDL compiler LGTM. > > https://codereview.chromium.org/362993004/diff/80001/Source/bindings/scripts/v8_types.py > File ...
6 years, 5 months ago (2014-07-04 00:44:00 UTC) #8
haraken
abarth@: Would you take a look at PrivateScriptRunner.{h,cpp} and Internals.{idl,js} ?
6 years, 5 months ago (2014-07-04 00:44:24 UTC) #9
abarth-chromium
A thing of beauty is a joy forever. LGTM https://codereview.chromium.org/362993004/diff/80001/Source/bindings/core/v8/PrivateScriptRunner.cpp File Source/bindings/core/v8/PrivateScriptRunner.cpp (right): https://codereview.chromium.org/362993004/diff/80001/Source/bindings/core/v8/PrivateScriptRunner.cpp#newcode92 Source/bindings/core/v8/PrivateScriptRunner.cpp:92: ...
6 years, 5 months ago (2014-07-04 01:28:15 UTC) #10
haraken
https://codereview.chromium.org/362993004/diff/80001/Source/bindings/core/v8/PrivateScriptRunner.cpp File Source/bindings/core/v8/PrivateScriptRunner.cpp (right): https://codereview.chromium.org/362993004/diff/80001/Source/bindings/core/v8/PrivateScriptRunner.cpp#newcode92 Source/bindings/core/v8/PrivateScriptRunner.cpp:92: v8::Handle<v8::Value> initializeFunction = classObject->Get(v8String(isolate, "initialize")); On 2014/07/04 01:28:15, abarth ...
6 years, 5 months ago (2014-07-04 01:32:22 UTC) #11
haraken
After landing this CL, I'll try to make your marquee element workable. I guess it ...
6 years, 5 months ago (2014-07-04 01:33:44 UTC) #12
haraken
The CQ bit was checked by haraken@chromium.org
6 years, 5 months ago (2014-07-04 01:36:30 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/362993004/100001
6 years, 5 months ago (2014-07-04 01:37:27 UTC) #14
abarth-chromium
On 2014/07/04 at 01:32:22, haraken wrote: > At first I avoided to use 'constructor', since ...
6 years, 5 months ago (2014-07-04 02:04:06 UTC) #15
abarth-chromium
On 2014/07/04 at 01:33:44, haraken wrote: > After landing this CL, I'll try to make ...
6 years, 5 months ago (2014-07-04 02:05:31 UTC) #16
haraken
On 2014/07/04 02:05:31, abarth wrote: > On 2014/07/04 at 01:33:44, haraken wrote: > > After ...
6 years, 5 months ago (2014-07-04 02:13:56 UTC) #17
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_rel on tryserver.blink ...
6 years, 5 months ago (2014-07-04 02:40:09 UTC) #18
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 5 months ago (2014-07-04 03:06:13 UTC) #19
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/14707)
6 years, 5 months ago (2014-07-04 03:06:14 UTC) #20
haraken
The CQ bit was checked by haraken@chromium.org
6 years, 5 months ago (2014-07-04 03:13:36 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/362993004/100001
6 years, 5 months ago (2014-07-04 03:14:24 UTC) #22
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_rel on tryserver.blink ...
6 years, 5 months ago (2014-07-04 03:39:19 UTC) #23
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 5 months ago (2014-07-04 04:03:13 UTC) #24
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/14715)
6 years, 5 months ago (2014-07-04 04:03:14 UTC) #25
haraken
The CQ bit was checked by haraken@chromium.org
6 years, 5 months ago (2014-07-04 05:11:24 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/362993004/120001
6 years, 5 months ago (2014-07-04 05:11:43 UTC) #27
commit-bot: I haz the power
Change committed as 177511
6 years, 5 months ago (2014-07-04 06:16:24 UTC) #28
arv (Not doing code reviews)
LGTM This is truly a piece of art. https://codereview.chromium.org/362993004/diff/120001/Source/bindings/core/v8/PrivateScriptRunner.cpp File Source/bindings/core/v8/PrivateScriptRunner.cpp (right): https://codereview.chromium.org/362993004/diff/120001/Source/bindings/core/v8/PrivateScriptRunner.cpp#newcode90 Source/bindings/core/v8/PrivateScriptRunner.cpp:90: v8::Handle<v8::Value> ...
6 years, 5 months ago (2014-07-09 15:48:22 UTC) #29
haraken
https://codereview.chromium.org/362993004/diff/120001/Source/bindings/core/v8/PrivateScriptRunner.cpp File Source/bindings/core/v8/PrivateScriptRunner.cpp (right): https://codereview.chromium.org/362993004/diff/120001/Source/bindings/core/v8/PrivateScriptRunner.cpp#newcode90 Source/bindings/core/v8/PrivateScriptRunner.cpp:90: v8::Handle<v8::Value> isInitialized = V8HiddenValue::getHiddenValue(isolate, holderObject, V8HiddenValue::privateScriptObjectIsInitialized(isolate)); On 2014/07/09 15:48:22, ...
6 years, 5 months ago (2014-07-09 15:59:09 UTC) #30
haraken
6 years, 5 months ago (2014-07-11 04:29:56 UTC) #31
Message was sent while issue was closed.
https://codereview.chromium.org/362993004/diff/80001/Source/bindings/scripts/...
File Source/bindings/scripts/v8_types.py (right):

https://codereview.chromium.org/362993004/diff/80001/Source/bindings/scripts/...
Source/bindings/scripts/v8_types.py:484: macro =
'TONATIVE_DEFAULT_EXCEPTIONSTATE' if used_in_private_script else
'TONATIVE_VOID_EXCEPTIONSTATE'
On 2014/07/03 13:23:26, Jens Lindström wrote:
> This might be somewhat nicer if we had
> "TONATIVE_(|EXCEPTIONSTATE)_(VOID|DEFAULT)" instead, in which case we would
have
> 
>   macro = 'TONATIVE' / 'TONATIVE_EXCEPTIONSTATE' / 'TOSTRING'
> 
> first, then
> 
>   if used_in_private_script:
>       macro += '_DEFAULT'
>       args.append('false')
>   else:
>       macro += '_VOID'
> 
> And also, at least in this context, "DEFAULT" is a bit strange. "WITH_RETVAL"
> maybe? Not overwhelmingly perfect either, but a bit less confusing. (Also
> unrelated to this CL, of course.)

I took a look at this. I agree that "TONATIVE_(|EXCEPTIONSTATE)_(VOID|DEFAULT)"
makes the code generator nicer, but in terms of the macro name,
TO*_RETURNTYPE[_ARGTYPE] would make more sense, as commented in
V8BindingMacros.h. So I'm leaning toward keeping the current name as is.

Powered by Google App Engine
This is Rietveld 408576698