Commit c0a2f89
committed
fix(core): don't tear the runtime down on a bfcache pagehide
`pagehide` also fires with persisted === true when the document is frozen
into the back-forward cache. That is not a death: `pageshow` restores the
same document without re-running initialization. Tearing down there
latched state.tornDown, stripped the listeners and injected styles, and
closed the AudioContext — leaving a restored player permanently inert with
nothing to bring it back.
The destructive path is now gated to non-persisted page hides — the
srcdoc-replacement case the listener was added for. A BFCached document is
frozen by the browser, which suspends its AudioContext and media anyway,
so skipping teardown while it sits there costs nothing, and the listener
stays armed for the eventual real hide.1 parent 70da7f8 commit c0a2f89
2 files changed
Lines changed: 63 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
652 | 652 | | |
653 | 653 | | |
654 | 654 | | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
655 | 701 | | |
656 | 702 | | |
657 | 703 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3365 | 3365 | | |
3366 | 3366 | | |
3367 | 3367 | | |
3368 | | - | |
| 3368 | + | |
3369 | 3369 | | |
3370 | 3370 | | |
3371 | 3371 | | |
| |||
3417 | 3417 | | |
3418 | 3418 | | |
3419 | 3419 | | |
3420 | | - | |
3421 | | - | |
3422 | | - | |
3423 | 3420 | | |
3424 | 3421 | | |
3425 | 3422 | | |
3426 | 3423 | | |
3427 | 3424 | | |
3428 | 3425 | | |
3429 | 3426 | | |
3430 | | - | |
| 3427 | + | |
| 3428 | + | |
| 3429 | + | |
| 3430 | + | |
| 3431 | + | |
| 3432 | + | |
| 3433 | + | |
| 3434 | + | |
| 3435 | + | |
| 3436 | + | |
| 3437 | + | |
| 3438 | + | |
| 3439 | + | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
3431 | 3443 | | |
0 commit comments