Reviewers: MarkM,
Description:
Extract the notion of tests and repairs from repairES5.js and make it
available as a reusable algorithm, in new file repair-framework.js.
All state is now bundled in the new Repairer class, of which there is
a singleton instance ses._repairer; this structure allows the
test/repair algorithm to be unit-tested.
* "Kludge records" are now known as "problem records" consistently.
* Define "absence of WeakMap" as a problem and use ses._repairer in
WeakMap.js; WeakMap.js no longer uses its top level control flow to
control what patching is done.
SES API changes (most likely of interest to custom loggers):
* The meaning of ses.ok() is changed. It will now return whether tests
and repairs _have been done_ and the system is safe, as opposed to
returning false only if we've decided to fail. Introduce
ses.okToLoad() with the old meaning, which is used to decide whether
to continue loading parts of SES. I hope to make the startSES "dirty"
flag subsumed by this mechanism, but have left that for future work.
* ses.maxSeverity no longer exists, since its role has been replaced
by internal state of the repairer object. The same value is available
as ses.getMaxSeverity(); note that it retains the original meaning
corresponding to ses.okToLoad() rather than ses.ok().
* logger.reportRepairs may be called more than once (currently, when
WeakMap performs its "add WeakMap" test/repair after repairES5 has
completed). We may want to improve this design later.
Please review this at https://codereview.appspot.com/54450044/
Affected files (+1616, -860 lines):
M build.xml
M src/com/google/caja/ses/WeakMap.js
M src/com/google/caja/ses/compileExprLater.js
M src/com/google/caja/ses/debug.js
M src/com/google/caja/ses/explicit.html
M src/com/google/caja/ses/hookupSESPlus.js
M src/com/google/caja/ses/logger.js
A src/com/google/caja/ses/repair-framework.js
M src/com/google/caja/ses/repairES5.js
M src/com/google/caja/ses/startSES.js
M src/com/google/caja/ses/useHTMLLogger.js
M tests/com/google/caja/ses/ses-tests.json
A tests/com/google/caja/ses/test-repair-framework.js
--
---
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.