Revision: 4493
Author:   [email protected]
Date:     Mon Jun  6 14:12:09 2011
Log:      Label caja.js frames for debugging convenience
http://codereview.appspot.com/4576044

Chrome's debugger lets me examine the execution context of the
current statement, but it's not always obvious what frame
that's in.  This change adds a className to caja's frames,
which means I can type "frameElement.className" in the console
to help identify the frame.

The answer can be
- "caja-taming-frame"
- "caja-guest-frame"
- some other string value for some non-caja frame.
- frameElement undefined for the top-level window.

[email protected], [email protected]

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

Modified:
 /trunk/src/com/google/caja/plugin/caja.js

=======================================
--- /trunk/src/com/google/caja/plugin/caja.js   Fri May 20 14:26:06 2011
+++ /trunk/src/com/google/caja/plugin/caja.js   Mon Jun  6 14:12:09 2011
@@ -46,7 +46,7 @@
     }
   }

-  function createIframe() {
+  function createIframe(opt_className) {
     // create iframe to load Cajita runtime in
// TODO: Put a class on this so if the host page cares about 'all iframes'
     // it can filter this out?
@@ -55,6 +55,7 @@
     frame.style.display = "none";
     frame.width = 0;
     frame.height = 0;
+    frame.className = opt_className || '';
     // stick it arbitrarily in the document
     document.body.appendChild(frame);
     return frame;
@@ -108,7 +109,7 @@
     var debug = Boolean(config.debug);

     function loadCajaFrame(filename, callback) {
-      var iframe = createIframe();
+      var iframe = createIframe(filename);

       var url = joinUrl(cajaServer,
           debug ? filename + '.js' : filename + '.opt.js');

Reply via email to