Revision: 4796
Author:   jasvir
Date:     Tue Feb 28 23:32:59 2012
Log:      Ignore setLogFunc in ES5 in the playground
http://codereview.appspot.com/5703050

r4784 breaks ES5 in the playground. This change avoids calling setLogFunc in ES5 mode.

[email protected]

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

Modified:
 /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java

=======================================
--- /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java Tue Feb 28 15:48:15 2012 +++ /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java Tue Feb 28 23:32:59 2012
@@ -500,11 +500,14 @@
     extraImports.alert = caja.tame(
       caja.markFunction(
         function(msg) { alert('Untrusted code says: ' + String(msg)); }));
-    guestFrame.iframe.contentWindow.___.setLogFunc(caja.tame(
-      caja.markFunction(function(msg) {
- [email protected]::addRuntimeMessage(Ljava/lang/String;)
-            (msg);
-      })));
+      if ("undefined" !== typeof guestFrame.iframe.contentWindow.___ &&
+ "function" === typeof guestFrame.iframe.contentWindow.___.setLogFunc) {
+        guestFrame.iframe.contentWindow.___.setLogFunc(caja.tame(
+          caja.markFunction(function(msg) {
+ [email protected]::addRuntimeMessage(Ljava/lang/String;)
+                (msg);
+          })));
+      }
     return extraImports;
   }-*/;

Reply via email to