This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
I'd like a WebIDL attribute I can put on interfaces that says "anything on this that gets called should throw if it is not [magic hook]" (where [magic hook] would be "its Document is the active document of its Document's browsing context" for the History interface, for instance). Right now I only have one use case, but I have a feeling this will come up more often. For example, maybe that would be a good way to handle objects that are neutered by the structure cloning stuff.
On IRC you suggested maybe we don't even need an extended attribute for this, just a hook that gets invoked at the right places. Just like we have the "perform a security check" on operation invocation, attribute access, etc. Are the cases you want to handle here just another kind of security check, and we can use the same mechanism? The spec throws a SecurityError if the security check fails. Is that appropriate for the cases you want to handle? Can you do some testing to find out?
Is there a reason this can't happen effectively in the "prose" section (i.e. after argument conversion)? In practice it only matters if your argument conversions trigger side-effects (including exceptions), but doing this sort of check before argument conversions imposes a significant cost in implementation complexity that doesn't seem warranted here.
Taking to do further research.
I'll deal with the History case in prose.