Revision: 4494
Author:   [email protected]
Date:     Mon Jun  6 15:55:09 2011
Log:      Playground needs to mark GWT's frame as feral
http://codereview.appspot.com/4527099

So the future of FERAL_FRAME_OBJECT___ is under discussion, but in
the meantime, this change makes the Playground policy tab work again.

The reason it doesn't work is the policy is eval'ed in GWT's frame,
and that frame does not have the Object.FERAL_FRAME_OBJECT___ marker,
so anything defined in the policy will tame to undefined.

This change adds a call to initFeralFrame(), which will add that
marker.

[email protected], [email protected]

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

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

=======================================
--- /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java Thu May 26 10:52:29 2011 +++ /trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java Mon Jun 6 15:55:09 2011
@@ -382,10 +382,12 @@
       Element div, String policy, String html, String js) /*-{
     var that = this;
     $wnd.caja.configure({
-      cajaServer: '/',
+      cajaServer: '',
       debug: true
     }, function (frameGroup) {
       var extraImports = {};
+      // add the feral marker to GWT's frame
+      $wnd.caja.initFeralFrame(window);  // note 'window' not '$wnd'
       try {
         var tamings___ = eval(policy);
       } catch (e) {
=======================================
--- /trunk/src/com/google/caja/plugin/caja.js   Mon Jun  6 14:12:09 2011
+++ /trunk/src/com/google/caja/plugin/caja.js   Mon Jun  6 15:55:09 2011
@@ -430,6 +430,7 @@
   }

   function initFeralFrame(aWindow) {
+ if (aWindow.Object.FERAL_FRAME_OBJECT___ === aWindow.Object) { return; }
     // Apply styles to current document
     var style = aWindow.document.createElement('style');
     style.setAttribute('type', 'text/css');

Reply via email to