Reviewers: felix8a,

Description:
document.all is native object on IE such that document.all[x] is similar
to
document.getElementById(x).

It is worth separate testing because Firefox supports it, but treats it
specially so that:

   typeof document.all === "undefined"
   !!document.all

so that feature detection code will take the no document.all path, but
code
that does not feature detect will continue to work in quirks mode:

   document.all.x

is not a TypeError.  It is in the square free shell which is in
standards
compliance mode.

http://weblogs.mozillazine.org/asa/archives/007118.html explains:
"""
December 17, 2004
mozilla 1.7.5 released

...

The new undetectable document.all support, and support for exposing
elements by their ID in the global scope for greater IE compatibility
when viewing pages that don't request standards compliant behaviour is
documented in bugs 248549 and 256932.
"""

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

Affected files:
  M     tests/com/google/caja/plugin/domita_test.html
  M     tests/com/google/caja/plugin/domita_test_untrusted.html


Index: tests/com/google/caja/plugin/domita_test.html
===================================================================
--- tests/com/google/caja/plugin/domita_test.html       (revision 4789)
+++ tests/com/google/caja/plugin/domita_test.html       (working copy)
@@ -141,7 +141,7 @@

       <div class="testcontainer" id="test-opaque-nodes-xyz___"
><!-- Comment -->a<script id="howdy-script-xyz___">/* Howdy */</script
-       >b<object>obj</object>c</div>
+       >b<object id="dangerous-object">obj</object>c</div>

       <!-- http://www.google.com/favicon.ico has been visited
            by the above IMG tag -->
Index: tests/com/google/caja/plugin/domita_test_untrusted.html
===================================================================
--- tests/com/google/caja/plugin/domita_test_untrusted.html     (revision 4789)
+++ tests/com/google/caja/plugin/domita_test_untrusted.html     (working copy)
@@ -1893,6 +1893,14 @@
   child.nodeValue = 'Foo';
   assertEquals('Foo', child.nodeValue);

+  var dangerousObject;
+  try {
+    dangerousObject= document.all['dangerous-object'];
+  } catch (e) {
+    // ok
+  }
+  assertEquals('dangerousObject', void 0, dangerousObject);
+
   pass('test-opaque-nodes');
 });



Reply via email to