Reviewers: felix8a,

Description:
http://code.google.com/p/google-caja/issues/detail?id=1352

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

Affected files:
  M     src/com/google/caja/plugin/caja.js
  M     tests/com/google/caja/plugin/browser-test-case.js
  M     tests/com/google/caja/plugin/es53-test-taming-errors.js


Index: tests/com/google/caja/plugin/browser-test-case.js
===================================================================
--- tests/com/google/caja/plugin/browser-test-case.js   (revision 4463)
+++ tests/com/google/caja/plugin/browser-test-case.js   (working copy)
@@ -110,7 +110,6 @@
 }

 function pageLoaded___() {
-  caja.initFeralFrame(window);
   var scriptTag = document.createElement('script');
   scriptTag.setAttribute('src',
       getUrlParam('test-driver')
Index: tests/com/google/caja/plugin/es53-test-taming-errors.js
===================================================================
--- tests/com/google/caja/plugin/es53-test-taming-errors.js     (revision 4463)
+++ tests/com/google/caja/plugin/es53-test-taming-errors.js     (working copy)
@@ -22,8 +22,16 @@

 (function () {

-  jsunitRegister('testInitFeralFrame',
-                 function testInitFeralFrame() {
+  jsunitRegister('testInitFeralFrameSelf',
+                 function testInitFeralFrameSelf() {
+    assertTrue(!!window.___);
+    assertTrue(!!window.Object.FERAL_FRAME_OBJECT___);
+    assertEquals(window.Object, window.Object.FERAL_FRAME_OBJECT___);
+    jsunit.pass('testInitFeralFrameSelf');
+  });
+
+  jsunitRegister('testInitFeralFrameOther',
+                 function testInitFeralFrameOther() {
     var frame = document.createElement('iframe');
     document.body.appendChild(frame);

@@ -46,7 +54,7 @@
           win.getComputedStyle(inner, null)
               .getPropertyValue('position'));

-      jsunit.pass('testInitFeralFrame');
+      jsunit.pass('testInitFeralFrameOther');
     }, 0);
   });

Index: src/com/google/caja/plugin/caja.js
===================================================================
--- src/com/google/caja/plugin/caja.js  (revision 4463)
+++ src/com/google/caja/plugin/caja.js  (working copy)
@@ -16,7 +16,7 @@
  * @fileoverview ... TODO ihab.awad
  * @author [email protected]
  * @author [email protected]
- * @requires document, setTimeout, console
+ * @requires document, setTimeout, console, window
  * @provides caja
  */

@@ -439,6 +439,9 @@
     aWindow.Object.FERAL_FRAME_OBJECT___ = aWindow.Object;
   }

+  // Initialize the current frame as feral.
+  initFeralFrame(window);
+
   // The global singleton Caja object
   return {
     configure: configure,


Reply via email to