Revision: 3836
Author: felix8a
Date: Mon Nov  9 19:39:03 2009
Log: fix bug introduced by window.onload change
http://codereview.appspot.com/151065

window.onload commit causes an error if window.onload is not set.
oops.

added a todo for testing that case, because it requires
having more than one domita test, which is dependent on
resolution of splitting up domita_test

[email protected]

http://code.google.com/p/google-caja/source/detail?r=3836

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

=======================================
--- /trunk/src/com/google/caja/plugin/domita.js Mon Nov  9 18:26:36 2009
+++ /trunk/src/com/google/caja/plugin/domita.js Mon Nov  9 19:39:03 2009
@@ -3389,9 +3389,10 @@
// Called by the html-emitter when the virtual document has been loaded.
     TameHTMLDocument.prototype.signalLoaded___ = function () {
       var onload = ((___.canRead(imports, '$v')
-                     && ___.canCallPub(imports.$v, 'ro')
-                     && imports.$v.ro('onload'))
-                    || ___.readPub(imports.window, 'onload'));
+                     && ___.canCallPub(imports.$v, 'ros')
+                     && imports.$v.ros('onload'))
+                    || (imports.window &&
+                        ___.readPub(imports.window, 'onload')));
       if (onload) {
         setTimeout(
             function () { ___.callPub(onload, 'call', [___.USELESS]); },
=======================================
--- /trunk/tests/com/google/caja/plugin/domita_test_untrusted.html Mon Nov 9 18:26:36 2009 +++ /trunk/tests/com/google/caja/plugin/domita_test_untrusted.html Mon Nov 9 19:39:03 2009
@@ -1946,6 +1946,7 @@
   window.addEventListener('load', setb2);
   window.removeEventListener('load', setb1);
   window.onload = setb3;
+  //TODO(felix8a): also need to test when onload isn't set

   assertAsynchronousRequirement(
       'onload listeners',

Reply via email to