web-platform-tests/wpt

Add coverage for discarded browsing contexts

Open

#3,310 创建于 2016年7月19日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)HTML (4,581 star) (2,898 fork)batch import
good first issuehtmltype:missing-coverage

描述

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:

贡献者指南

Add coverage for discarded browsing contexts · web-platform-tests/wpt#3310 | Good First Issue