Reviewers: ihab.awad, jasvir,
Description:
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.
Please review this at http://codereview.appspot.com/4576044/
Affected files:
M src/com/google/caja/plugin/caja.js
Index: src/com/google/caja/plugin/caja.js
===================================================================
--- src/com/google/caja/plugin/caja.js (revision 4492)
+++ src/com/google/caja/plugin/caja.js (working copy)
@@ -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');