DescriptionExtract 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.
For <https://code.google.com/p/google-caja/issues/detail?id=1878>.
@r5659
Patch Set 1 #
Total comments: 36
Patch Set 2 : [APICHANGE] Separate test/repair algorithm from repairES5.js and use it in WeakMap.js. #
Total comments: 2
Patch Set 3 : [APICHANGE] Separate test/repair algorithm from repairES5.js and use it in WeakMap.js. #Patch Set 4 : [APICHANGE] Separate test/repair algorithm from repairES5.js and use it in WeakMap.js. #
MessagesTotal messages: 11
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||