| 60 | }; |
| 61 | |
| 62 | export const createFrameCleanupController = () => { |
| 63 | let shouldDisableEmbeddingOnCleanup = false; |
| 64 | |
| 65 | return { |
| 66 | markEmbeddingEnabled() { |
| 67 | // Only tear the rule down if this frame was the one that enabled it. |
| 68 | shouldDisableEmbeddingOnCleanup = true; |
| 69 | }, |
| 70 | async disableEmbeddingForTab() { |
| 71 | if (!shouldDisableEmbeddingOnCleanup) { |
| 72 | return; |
| 73 | } |
| 74 | |
| 75 | shouldDisableEmbeddingOnCleanup = false; |
| 76 | |
| 77 | try { |
| 78 | await disableFrameEmbeddingViaBackground(); |
| 79 | } catch (error) { |
| 80 | errorLog('[frame] failed to disable frame embedding for tab:', error); |
| 81 | } |
| 82 | }, |
| 83 | }; |
| 84 | }; |
| 85 | |
| 86 | export const initializeFrame = async ({ |
| 87 | root, |