Event handler IDL attributes for non-fully-active documents
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 9.4k
- Forks
- 3.2k
- PR merge metrics
- PR metrics pending
Description
What is the issue with the HTML Standard?
I believe that per spec, something like:
frames[0].document.body.setAttribute("onclick", "void(0)");
const frames0Document = frames[0].document;
await navigate0thFrame();
const f = frames0Document.body.onclick;
gives different results depending on whether frames[0] is in bfcache or not. Reasoning: the onclick getter algorithm will return null in step 3.2 if evicted from bfcache, because in that case frames[0].document does not have a browsing context. Whereas, if it is still in bfcache, then the algorithm will proceed, and f will become a Function from the frames[0].document.defaultView global.
Similarly, if instead of "void(0)" I'd put "++++++syntaxerror+++++", if the document is in bfcache an error event would be fired on frames[0].document.defaultView, whereas if it's evicted then nothing would happen.
In practice I believe this is not a problem because no browser allows bfcaching of iframes (or of windows with openers), so there is no way to actually run the code frames0Document.body.onclick while in bfcache.
If people wanted to fix this, some possibilities:
- Expand "scripting is disabled" to say that scripting is disabled whenever the document is not fully active, instead of only when the document has no browsing context. (This could have unintended consequences.)
- Add a fully active check to "get the current value of the event handler".
- Codify the requirement not to bfcache globals for which there exists a JavaScript reference (i.e., iframes or windows with openers).
A bit of related discussion in https://github.com/web-platform-tests/wpt/pull/4089#issuecomment-3248026536.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the HTML Standard's "getting the current value of the event handler" algorithm and the scripting-disabled definition referenced in the issue. Read the related discussion in web-platform-tests pull request 4089, then compare the proposed specification changes. Done means the behavior for non-fully-active documents is resolved and the corresponding standard requirements are agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100