Skip to content

Handle resume event and log BFCache pageshow event#2236

Merged
Kuuuube merged 1 commit intoyomidevs:masterfrom
Kuuuube:resume-event
Nov 9, 2025
Merged

Handle resume event and log BFCache pageshow event#2236
Kuuuube merged 1 commit intoyomidevs:masterfrom
Kuuuube:resume-event

Conversation

@Kuuuube
Copy link
Copy Markdown
Member

@Kuuuube Kuuuube commented Nov 7, 2025

Part 2 of #2216 to fix the frozen popup issue

Pages can be set in a "frozen" state. When pages are "resumed", it is very similar to when a page is restored from the BFCache.

To test for a frozen page:

  1. Open chrome://discards/ and whichever page you want to freeze
  2. Click [Freeze] on the page to freeze
    Do not have any dev tools open (such as console logs) while waiting for the page to freeze. It will prevent the page from freezing.
  3. Wait a minute and do not open the page in this time

https://developer.chrome.com/blog/freezing-on-energy-saver
https://developer.chrome.com/docs/web-platform/page-lifecycle-api#event-resume

This does not exist on Firefox. But I have tested that attempting to put a listener on this event in Firefox does not cause any issue.

Also added logging for when this happens as well as the BFCache pageshow event.

resume and pageshow may be called together in some cases. Potentially spamming _onDisconnect should not cause any issues here.

@Kuuuube Kuuuube requested a review from a team as a code owner November 7, 2025 04:06
@Kuuuube Kuuuube added kind/bug The issue or PR is regarding a bug browser/chrome The issue is Chrome-only browser/edge The issue is Edge-only labels Nov 7, 2025
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Nov 7, 2025

CodSpeed Performance Report

Merging #2236 will improve performances by ×2.4

Comparing Kuuuube:resume-event (018e0c6) with master (1eecf11)

Summary

⚡ 4 improvements
✅ 1 untouched

Benchmarks breakdown

Benchmark BASE HEAD Change
japanese transformations (n=78) 17.8 ms 8.3 ms ×2.2
japanese transformations-full (n=212) 47.3 ms 22.4 ms ×2.1
spanish transformations (n=97) 15.2 ms 6.4 ms ×2.4
Translator.prototype.findTerms - (n=45) 193.8 ms 113.3 ms +71.06%

@Kuuuube Kuuuube added this pull request to the merge queue Nov 9, 2025
Merged via the queue into yomidevs:master with commit 5f5d03d Nov 9, 2025
25 checks passed
@Kuuuube Kuuuube deleted the resume-event branch November 9, 2025 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

browser/chrome The issue is Chrome-only browser/edge The issue is Edge-only kind/bug The issue or PR is regarding a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants