Author: felix8a
Date: Wed Jul  8 02:56:49 2009
New Revision: 3559

Modified:
   trunk/src/com/google/caja/plugin/domita.js
   trunk/tests/com/google/caja/plugin/domita_test_untrusted.html

Log:
document.documentElement.innerHTML has a weird value
http://codereview.appspot.com/88115

If you cajole this in the testbed
  <script>document.documentElement.innerHTML</script>
you get back a weird value:
"<head>function () {\n return this.innerHTMLGetter___();\n}</head><body></body>"

This change fixes it.

[email protected]


Modified: trunk/src/com/google/caja/plugin/domita.js
==============================================================================
--- trunk/src/com/google/caja/plugin/domita.js  (original)
+++ trunk/src/com/google/caja/plugin/domita.js  Wed Jul  8 02:56:49 2009
@@ -2880,7 +2880,8 @@
           function () { return [tameHeadElement, tameBodyElement]; },
           function () { return tameDoc; },
           function () {
- return ('<head>' + tameHeadElement.getInnerHTML + '<\/head><body>'
+            return ('<head>' + tameHeadElement.getInnerHTML()
+                    + '<\/head><body>'
                     + tameBodyElement.getInnerHTML() + '<\/body>');
           },
           tameBody,

Modified: trunk/tests/com/google/caja/plugin/domita_test_untrusted.html
==============================================================================
--- trunk/tests/com/google/caja/plugin/domita_test_untrusted.html       
(original)
+++ trunk/tests/com/google/caja/plugin/domita_test_untrusted.html Wed Jul 8 02:56:49 2009
@@ -2091,6 +2091,10 @@
       ]
     }, document);

+  var html = document.documentElement.innerHTML;
+  assertTrue(!!html.match(
+    '<head><title>&lt;Untrusted Content Title&gt;</title></head><body>'));
+
   pass('test-document-element');
 });

Reply via email to