Reviewers: jasvir,

Description:
Changed an s to a g.  It worked in many instances because the getter
had already been marked as safe.

Also made whitelistAll only affect those properties of the given
object that had not already been whitelisted.

Please review this at http://codereview.appspot.com/4000050/

Affected files:
  M     build.xml
  M     src/com/google/caja/es53.js


Index: src/com/google/caja/es53.js
===================================================================
--- src/com/google/caja/es53.js (revision 4345)
+++ src/com/google/caja/es53.js (working copy)
@@ -3036,13 +3036,16 @@

   /**
    * Whitelists all the object's own properties that do not
-   * end in __.  If opt_deep is true, recurses on objects and
+   * end in __ and have not already been whitelisted.
+   * If opt_deep is true, recurses on objects and
    * assumes the object has no cycles through accessible keys.
    */
   function whitelistAll(obj, opt_deep) {
     var i;
     for (i in obj) {
-      if (obj.hasOwnProperty(i) && !endsWith__.test(i)) {
+      if (obj.hasOwnProperty(i) &&
+          !endsWith__.test(i) &&
+          !((i + '_v___') in obj)) {
         var isObj = (typeof obj[i]) === 'object';
         if (opt_deep && isObj) {
           whitelistAll(obj[i], true);
@@ -4488,7 +4491,7 @@
   // TODO(metaweta): Deprecate this API, since it requires that we leave
   // configurable set to true in order to use both a getter and a setter.
   function useGetHandler(obj, name, getHandler) {
-    setHandler = markFunc(getHandler);
+    getHandler = markFunc(getHandler);
     var desc = obj.GetOwnProperty___(name);
     if (!desc || !IsAccessorDescriptor(desc)) {
       desc = {
Index: build.xml
===================================================================
--- build.xml   (revision 4345)
+++ build.xml   (working copy)
@@ -187,7 +187,7 @@
description="Runs unittests. To filter tests: $ ant -Dtest.filter=My\*Test.
    To remote debug tests (on port 9999): $ ant -Dtest.debug=true">
    <condition property="jvmarg"
- value="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9999" else=""> + value="-Xdebug -Xmx2G -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9999" else="">
      <isset property="test.debug"/>
    </condition>
<!-- Instrument the compiled class files to gather code coverage stats -->


Reply via email to