Revision: 5456
Author: [email protected]
Date: Thu Jun 20 09:19:45 2013
Log: Tweaks to test-scan.
https://codereview.appspot.com/10326045
* On obtainInstance failure, print the full context details rather than
just a program.
* obtainInstance's second parameter was misnamed.
* Make the args definition for dispatchEvent more correct and explained.
[email protected]
http://code.google.com/p/google-caja/source/detail?r=5456
Modified:
/trunk/tests/com/google/caja/plugin/es53-test-scan-guest.js
=======================================
--- /trunk/tests/com/google/caja/plugin/es53-test-scan-guest.js Tue Jun 18
13:18:13 2013
+++ /trunk/tests/com/google/caja/plugin/es53-test-scan-guest.js Thu Jun 20
09:19:45 2013
@@ -71,6 +71,12 @@
for (var i = 0; i < a.length; i++) {
callback(a[i]);
}
+ };
+ },
+ /** One value, computed on demand. */
+ lazyValue: function lazyValue(thunk) {
+ return function GlazyValueGen(callback) {
+ callback(thunk());
};
},
/** All of the provided generators. */
@@ -218,9 +224,9 @@
return x;
}
var instances = new WeakMap();
- function obtainInstance(ctor, label) {
+ function obtainInstance(ctor, infoThunk) {
if (!instances.has(ctor)) {
- instances.set(ctor, invokeConstructor(ctor, label));
+ instances.set(ctor, invokeConstructor(ctor, infoThunk));
}
return instances.get(ctor);
}
@@ -399,7 +405,7 @@
function() {
var selfC = getSelfC();
return makeContext(
- obtainInstance(selfC.get(), selfC.getProgram),
+ obtainInstance(selfC.get(), selfC.toDetailsString),
path + '<instance>',
'self',
function() { return noThisContext; },
@@ -1397,8 +1403,8 @@
argsByProp('initKeyEvent', G.none); // implemented like initEvent
argsByProp('initKeyboardEvent', G.none); // implemented like initEvent
argsByProp('initMouseEvent', G.none); // implemented like initEvent
- argsByProp('dispatchEvent', genMethod(
- function(c) { c(obtainInstance(Event)); }));
+ argsByProp('dispatchEvent', genMethod(G.lazyValue(function() {
+ return obtainInstance(Event, function() { return 'Event'; }); })));
argsByProp('getAttribute',
argsByProp('getAttributeNode',
argsByProp('hasAttribute', genMethod(genString))));
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.