Skip to content

Conversation

marcoscaceres
Copy link
Contributor

@marcoscaceres marcoscaceres commented Sep 22, 2025

This pull request adds new guidance for handling cases where documents or execution contexts are no longer fully active, such as when an iframe is removed or navigated away. The update clarifies how specifications should address the lifecycle and cleanup of asynchronous operations and UI elements associated with destroyed or inactive contexts.

Guidance for handling destroyed contexts and non-fully-active documents:

  • Added a new section (#handle-destroyed-contexts) recommending that specs explicitly define behavior when the associated document is not fully active at call time (e.g., throw or reject with InvalidStateError).
  • Specified that ongoing async operations should be aborted and rejected with AbortError if the context becomes non-fully-active or the execution context is destroyed, and that any UI should be dismissed in such cases.
  • Advised that queued tasks should check if the document is still fully active before proceeding, and to avoid relying on garbage collection for cleanup semantics.
  • Included cross-references to related guidance for the BFCache and detached iframes.

Preview | Diff

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive guidance for handling cases where documents become non-fully-active or execution contexts are destroyed, such as when iframes are removed or navigated away. The update provides clear specifications for managing the lifecycle and cleanup of asynchronous operations and UI elements in these scenarios.

  • Defines behavior for API calls when the associated document is not fully active at call time
  • Specifies handling of ongoing async operations when contexts become destroyed or non-fully-active
  • Establishes guidance for queued tasks and cleanup semantics without relying on garbage collection

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant