Reviewers: metaweta,

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

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

Affected files:
  M     src/com/google/caja/demos/playground/client/ui/PlaygroundView.java


Index: src/com/google/caja/demos/playground/client/ui/PlaygroundView.java
===================================================================
--- src/com/google/caja/demos/playground/client/ui/PlaygroundView.java (revision 4794) +++ src/com/google/caja/demos/playground/client/ui/PlaygroundView.java (working copy)
@@ -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