web-platform-tests/wpt

Add coverage for discarded browsing contexts

Open

#3310 aperta il 19 lug 2016

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)HTML (2898 fork)batch import
good first issuehtmltype:missing-coverage

Metriche repository

Star
 (4581 star)
Metriche merge PR
 (Merge medio 6g 7h) (626 PR mergiate in 30 g)

Descrizione

In https://github.com/whatwg/html/pull/1539 and linked issues we are having a voyage of discovery over what happens when you remove an iframe from a document. The browsing context is "discarded," but what does that imply?

Browsers vary wildly in exactly how they implement this. Most seem to agree on things "going away" in some fashion. But sometimes they return undefined instead of null, and Edge likes to give a strange "Object expected" error.

After that PR, the following are some good test cases I think could be added, per new spec. Assume iframeWindow and iframeDocument are saved references to an iframe's contentWindow and contentDocument, saved before removing the iframe.

  • iframeWindow.{top, parent, frameElement} should be null
  • iframeWindow.{window, self, frames} should be iframeWindow
  • iframeWindow.document should be iframeDocument
  • iframeDocument.defaultView should be null
  • iframeDocument.location should be null

There are also a series of possible tests around ensuring that such documents do not have a browsing context:

  • Inserting a stylesheet into iframeDocument should not cause fetches
  • Inserting an image into iframeDocument should not cause fetches
  • Inserting a script into iframeDocument should not cause script execution

Here are some live dom viewers that can give a start:

Guida contributor