Closed michaelficarra closed 6 years ago
@ljharb
"[unavailable code]"
Firefox OS (mobile) had something similar IIRC.
@erights I invite you to voice any concerns you have in this PR.
Ping @phoddie @erights
Hi @michaelficarra I still don't like the host hook. I think it is a mistake. Most of what it legitimately tries to accomplish is better accomplished with the lexical directive. That said, in a world of scarce attention and "pick your battles" I am not inclined to pick this one.
@michaelficarra, echoing @erights, I can live with the host hook but I don't know that it is needed at this point. Would it be enough to simply modify the existing specification text, e.g. "If the implementation cannot produce a source code string that meets these criteria then it must return NativeFunction"? This defers definition of mechanisms, such as those in the new censor proposal, while guaranteeing return of a consist string, which addresses the overall goal of this proposal, as I understand it.
That sounds like just an underspecified version of the host hook, which requires hosts to say "An implementation is unable to produce a source code string under the following circumstances:" instead of "An implementation defines HostHasSourceTextAvailable as:"
Hi @phoddie I agree with @domenic on this point. The reason I think this whole mechanism is a mistake is its effect on what a correct program can assume. A correct program's correct behavior relies on some underlying platform obeying the contract the correct program correctly relies on.
Both the explicit host hook and your suggested text limits these contracts in the same painful way. But the host hook makes the pain explicit, which is better.
@domenic it is exactly an underspecified version of the host hook, underspecified precisely consistent with the current spec text. As you, @erights, and @michaelficarra are comfortable adding the host hook now, we should move ahead with that.
@phoddie In that case, can you review and approve this PR?
@michaelficarra, done.
If this is sufficient, this was way easier than I thought it would be.
/cc @domenic @phoddie
Fixes #25.