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

Issue 14156046: Use distinct Confidences for tame node subtypes. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 5 months ago by kpreid2
Modified:
12 years, 4 months ago
Reviewers:
felix8a
CC:
caja-discuss-undisclosed_googlegroups.com, MarkM, felix8a, ihab.awad, Jasvir, kpreid2, metaweta, MikeSamuel
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

This ensures that a method for a given subtype of TameNode cannot be applied to a different one, possibly allowing unexpected access. Fixes <https://code.google.com/p/google-caja/issues/detail?id=1576>. Core changes: * Add method confidence.subtype('name') to generate subtypes. Each subtype has its own table but shares the private state record. Arguably, they should each have their own record to have their own namespace, but that would require major changes to handle the distinction and mean many tamed methods would have to perform multiple WeakMap lookups for one invocation. * Introduce subtypes for TameBackedNode, TameElement, TameDocument, TameBackedAttributeNode, and all specific element interfaces. * Confiding in proxies is handled by an init method on the handler ctor rather than finishNode. Support for using the right subtypes: * Added Props.ampAccessor, like Props.ampGetter plus setter. * PT.TameMemoIf's tamer, and defineElement's constructor hook, are passed the private state record instead of having to do their own amplification. Other changes: * Remove shorthands nodeAmp and nodeAmplify as they encourage not thinking about subtypes, and eventAmp because it was unused. * Updated foreign node test to expect a misapplied method to throw. @r5620

Patch Set 1 #

Total comments: 2

Patch Set 2 : Use distinct Confidences for tame node subtypes. #

Patch Set 3 : Use distinct Confidences for tame node subtypes. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+195 lines, -108 lines) Patch
M src/com/google/caja/plugin/domado.js View 1 2 64 chunks +181 lines, -99 lines 0 comments Download
M tests/com/google/caja/plugin/test-domado-foreign-guest.html View 1 2 2 chunks +14 lines, -9 lines 0 comments Download

Messages

Total messages: 5
kpreid2
12 years, 5 months ago (2013-09-30 23:01:51 UTC) #1
felix8a
lgtm https://codereview.appspot.com/14156046/diff/1/src/com/google/caja/plugin/domado.js File src/com/google/caja/plugin/domado.js (right): https://codereview.appspot.com/14156046/diff/1/src/com/google/caja/plugin/domado.js#newcode415 src/com/google/caja/plugin/domado.js:415: function _SubConfidence(typename, opt_superTable, opt_superTypename) { _SubConfidence always gets ...
12 years, 5 months ago (2013-10-01 12:46:53 UTC) #2
kpreid2
This ensures that a method for a given subtype of TameNode cannot be applied to ...
12 years, 5 months ago (2013-10-01 16:54:24 UTC) #3
kpreid2
https://codereview.appspot.com/14156046/diff/1/src/com/google/caja/plugin/domado.js File src/com/google/caja/plugin/domado.js (right): https://codereview.appspot.com/14156046/diff/1/src/com/google/caja/plugin/domado.js#newcode415 src/com/google/caja/plugin/domado.js:415: function _SubConfidence(typename, opt_superTable, opt_superTypename) { On 2013/10/01 12:46:54, felix8a ...
12 years, 5 months ago (2013-10-01 16:55:38 UTC) #4
kpreid2
12 years, 4 months ago (2013-10-28 18:44:00 UTC) #5
This ensures that a method for a given subtype of TameNode cannot
be applied to a different one, possibly allowing unexpected access.

Fixes <https://code.google.com/p/google-caja/issues/detail?id=1576>.

Core changes:
* Add method confidence.subtype('name') to generate subtypes. Each
  subtype has its own table but shares the private state record.
  Arguably, they should each have their own record to have their own
  namespace, but that would require major changes to handle the
  distinction and mean many tamed methods would have to perform multiple
  WeakMap lookups for one invocation.
* Introduce subtypes for TameBackedNode, TameElement, TameDocument,
  TameBackedAttributeNode, and all specific element interfaces.
* Confiding in proxies is handled by an init method on the handler ctor
  rather than finishNode.

Support for using the right subtypes:
* Added Props.ampAccessor, like Props.ampGetter plus setter.
* PT.TameMemoIf's tamer, and defineElement's constructor hook, are
  passed the private state record instead of having to do their own
  amplification.

Other changes:
* Remove shorthands nodeAmp and nodeAmplify as they encourage not
  thinking about subtypes, and eventAmp because it was unused.
* Updated foreign node test to expect a misapplied method to throw.
Sign in to reply to this message.

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