DescriptionThis 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. #
MessagesTotal messages: 5
|
||||||||||||||||||||||||||||