Reviewers: jasvir,
Please review this at http://codereview.appspot.com/1942042/show
Affected files:
M src/com/google/caja/plugin/host-tools.js
Index: src/com/google/caja/plugin/host-tools.js
===================================================================
--- src/com/google/caja/plugin/host-tools.js (revision 4234)
+++ src/com/google/caja/plugin/host-tools.js (working copy)
@@ -89,7 +89,8 @@
// This is primarily useful when used from caja.js (Caja in an
iframe),
// since the host page doesn't have eval of the frame
- var moduleFunc;
+ var pumpkin = {};
+ var moduleFunc = pumpkin;
var oldModuleHandler = ___.getNewModuleHandler();
var newModuleHandler = ___.makeNormalNewModuleHandler();
newModuleHandler.handle = ___.markFuncFreeze(
@@ -105,6 +106,10 @@
} finally {
___.setNewModuleHandler(oldModuleHandler);
}
+ if (moduleFunc === pumpkin) {
+ throw new Error("runCajoledModuleString: the provided code did
not " +
+ "invoke the new module handler");
+ }
return moduleFunc(imports);
}