Comment #3 on issue 1878 by kpreid.switchb.org: Refactor repairES5
http://code.google.com/p/google-caja/issues/detail?id=1878

That complete-inversion proposal would mean that "phases" would have to be a _reified_ concept, which is additional complexity. But then, repairES5 already has baseKludges and supportedKludges, which is essentially a hardcoded version of just that.

I don't like the idea of loading _all_ the code and then executing it, because of the risk of load-time capturing platform misbehavior in higher-level code. For example, if startSES at load time closed over a built-in function, it would not get the benefit of repairES5's patch of that function.

On the other hand, now that you point it out it clearly makes sense to define WeakMap as a "repairES6" kind of thing.

What I'm thinking now is that these things are registered as 'repairs', but that the execution time is still under main-line control. That is, the flow is something like this:

  repair-framework.js (placeholder name)
    create structures for registering kludges and tracking state
  repairES5.js
    register ES5 kludges
    execute them
  WeakMap.js
    register 'ensure WeakMap exists' kludge
    execute it
  startSES.js+hookupSES.js
    SES-ify and tell repair-framework to run final tests

This still does not allow us to test specific kludges, but it allows us to test the framework, which is what I am currently worried about. Furthermore, if we did want to test specific kludges it would be easy to take the 'execute it' step out.

Some questions on terminology:

1. I believe the name "kludge record" or "kludge" is somewhat poorly fitting, because if anything is properly named a kludge then the _repair_ is (not the whole record), but more so if it's potentially going to grow to include all of SES initialization. In the exposed API of repairES5 I've been calling them 'problems' (ses.acceptableProblems, ses.es5ProblemReports); do you agree this can simply be the new name?

2. If the test-and-repair framework of repairES5 is separated out from the repairs that are actually about ES5, what should that framework be called? (I note that what we are talking about is related to the notion of 'polyfilling', but I don't propose using that for naming.)

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--

--- 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.

Reply via email to