Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Issue 9447044: Refactor Domado property definitions. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 10 months ago by kpreid2
Modified:
12 years, 9 months ago
Reviewers:
felix8a
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Previously, Domado internally used a property definition helper called 'definePropertiesAwesomely' which wrapped getters/setters so that they get an additional argument which is the property name. We now replace 'definePropertiesAwesomely' with 'Props.define', where Props also contains functions for generating property descriptors. Props.define accepts, in addition to property descriptors, functions which generate property descriptors given context ('env') information including the property name, the object (thus being able to provide setOwn-like override functionality), and the applicable Confidence. Including the Confidence in the context also means that PropertyTaming (renamed PT) does not need to be explicitly instantiated for a particular Confidence; thus the vocabulary used for amplifying access is not dependent on the the particular type being defined. The context-based design of Props is also intended to be of future use in refactoring the canvas 2D context taming to prototypical style while keeping its short taming definitions. User-visible changes: * There may be more cases where read-only inherited properties can be overridden by assignment on instances. Additional changes: * Nearly all methods are now defined using Props.define rather than as TameFoo.prototype.bar = nodeAmp(function(privates) { ... }). Reordered so accessor definitions come before method definitions. * Introduced PT.ROView to express non-writable tamed properties with a value transformation. * browser-test-case.js no longer defines a guest '$' function (because document.getElementById ends up being an accessor property, which can't be retrieved without using an inES5Mode conditional) and tests which used it now define it internally. * window's reflexive properties are defined in its constructor rather than separately. @r5420

Patch Set 1 #

Total comments: 6

Patch Set 2 : Refactor Domado property definitions. #

Total comments: 25

Patch Set 3 : Refactor Domado property definitions. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1665 lines, -1553 lines) Patch
M src/com/google/caja/plugin/domado.js View 1 2 75 chunks +1654 lines, -1544 lines 0 comments Download
M tests/com/google/caja/plugin/browser-test-case.js View 1 2 1 chunk +0 lines, -6 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-basic-functions-guest.html View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-dom-guest.html View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-forms-guest.html View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-scan-guest.js View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 13
kpreid2
12 years, 10 months ago (2013-05-16 21:09:34 UTC) #1
felix8a
I haven't figured out yet how to get solid results, but so far I'm not ...
12 years, 10 months ago (2013-05-16 23:26:39 UTC) #2
kpreid2
On 2013/05/16 23:26:39, felix8a wrote: > I haven't figured out yet how to get solid ...
12 years, 10 months ago (2013-05-16 23:35:18 UTC) #3
felix8a
On 2013/05/16 23:35:18, kpreid2 wrote: > On 2013/05/16 23:26:39, felix8a wrote: > > I haven't ...
12 years, 10 months ago (2013-05-16 23:36:57 UTC) #4
kpreid2
ping
12 years, 9 months ago (2013-05-20 23:01:55 UTC) #5
felix8a
frankly I'm finding the new code much more confusing, and it's taking me a while ...
12 years, 9 months ago (2013-05-21 19:43:50 UTC) #6
kpreid2
Previously, Domado internally used a property definition helper called 'definePropertiesAwesomely' which wrapped getters/setters so that ...
12 years, 9 months ago (2013-05-21 21:37:27 UTC) #7
kpreid2
New snapshot: changes as described and conflict resolution. On 2013/05/21 19:43:50, felix8a wrote: > frankly ...
12 years, 9 months ago (2013-05-21 21:40:50 UTC) #8
felix8a
I'm about halfway through domado.js now, the env stuff is ok, the rest is just ...
12 years, 9 months ago (2013-05-22 21:26:40 UTC) #9
felix8a
ok, done reading domado.js. lgtm++ https://codereview.appspot.com/9447044/diff/8001/src/com/google/caja/plugin/domado.js File src/com/google/caja/plugin/domado.js (right): https://codereview.appspot.com/9447044/diff/8001/src/com/google/caja/plugin/domado.js#newcode393 src/com/google/caja/plugin/domado.js:393: get: cajaVM.constFunc(function setOwnGetter() { ...
12 years, 9 months ago (2013-05-23 09:13:08 UTC) #10
kpreid2
Previously, Domado internally used a property definition helper called 'definePropertiesAwesomely' which wrapped getters/setters so that ...
12 years, 9 months ago (2013-05-23 17:00:21 UTC) #11
kpreid2
Submitting since you said LGTM++, but Props.cond and Props.rename remain issues; please comment and I'll ...
12 years, 9 months ago (2013-05-23 17:05:52 UTC) #12
felix8a
12 years, 9 months ago (2013-05-23 19:07:24 UTC) #13
https://codereview.appspot.com/9447044/diff/8001/src/com/google/caja/plugin/d...
File src/com/google/caja/plugin/domado.js (right):

https://codereview.appspot.com/9447044/diff/8001/src/com/google/caja/plugin/d...
src/com/google/caja/plugin/domado.js:3791: contains:
Props.cond(containsAvailable,
On 2013/05/23 17:05:52, kpreid2 wrote:
> On 2013/05/22 21:26:40, felix8a wrote:
> > nontrivial Props.cond use is hard to read. maybe instead of cond(test,
> > then, else) make it cond(test1, then1, test2, then2, ...)?
> 
> Now it feels like we're heading in the direction of Greenspun's tenth rule.
> 
> Should we just use ?: and expose Props.NO_PROPERTY, either for all cases, or
for
> the complex ones and keep Props.cond in two-arg form?

ok, I'm fine with that

https://codereview.appspot.com/9447044/diff/8001/src/com/google/caja/plugin/d...
src/com/google/caja/plugin/domado.js:3855: var textAccessor =
Props.rename('nodeValue', PT.filterProp(identity,
On 2013/05/23 17:05:52, kpreid2 wrote:
> On 2013/05/22 21:26:40, felix8a wrote:
> > 'rename' seems like the wrong verb. maybe something like 'useProp' or
'alias'
> > instead?
> 
> I agree the names here are bad, but I haven't been able to think of better
ones.
> Further suggestions welcome.
> 
> 'useProp' is uncommunicative to me. 'alias' is better, but I already use
'alias'
> for something else! Also, 'rename' was the name for this concept in the old
> PropertyTaming as well.
> 
> Maybe something like 'altTargetProp' or 'altFeralProp'?

retargetTo? actAs?
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b