Reviewers: jasvir, ihab.awad,

Description:
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.

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

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


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


Reply via email to