Hi module-dev,
FYI: haraken, masonfreed
hiroshige@ and I chatted and we agreed that we should remove most of the methods from Modulator.
I had always regretted its design, and we are now confident that it is no longer providing the values that it originally intended to provide.
blink::Modulator [cs] today serves multiple purposes. It serves - as a holder for various module specific states bound to a document's lifetime
- as an entrypoint to fetch algorithms, and
- as an entrypoint to bindings/v8
We believe that there is not much value of it being the latter two. There were some original intents when I designed the class, but they no longer make sense:
- [fetch] custom steps may be inserted for some worker module fetches.
-- -> turns out that we use the same ModulatorImplBase implementations, and switch by ModuleScriptCustomFetchType [
cs]
- [bindings] centralize callpath to bindings/v8
-- -> Indirection is hurting the readability, and there were some codepaths (on classic script ScriptController) which didn't use the "centralized" path, leading to confusing fork.
- Misuse ScriptState of worker hosting page / worker global scope.
-- -> hiroshige@ said they should be much easier now?
- Use mock implementation of some fetch algorithms in unit tests. (e.g. ModuleTreeLinkerTestModulator [
cs])
-- we should be introducing a test-only overridable constructor hook (global variable or something), the common pattern seen in content/ code. This enough doesn't seem to justify Modulator being an entrypoint to fetch algorithms.
kouhei@ plans to start making the changes as his P2-3-ish work. Let me know if you have any concerns.
Thanks,