Skip to content

Commit 05e8c7e

Browse files
authored
another attempt to fix unloading (#36)
1 parent 83e5fc9 commit 05e8c7e

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/second_sidebar/controllers/web_panel.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,19 @@ export class WebPanelController {
104104
return this.webPanel.getCurrentUrl();
105105
}
106106

107+
hackAsyncTabSwitcher() {
108+
const tabBrowser = this.webPanel.getTabBrowser();
109+
tabBrowser._printPreviewBrowsers.add(this.webPanel.getXUL());
110+
}
111+
112+
unhackAsyncTabSwitcher() {
113+
const tabBrowser = this.webPanel.getTabBrowser();
114+
tabBrowser._printPreviewBrowsers.delete(this.webPanel.getXUL());
115+
}
116+
107117
initWebPanel() {
118+
this.hackAsyncTabSwitcher();
119+
108120
this.webPanel.listenBrowserProgressListener(() => {
109121
this.webPanel.setZoom(this.webPanel.zoom);
110122
if (this.webPanel.isActive()) {
@@ -175,6 +187,7 @@ export class WebPanelController {
175187
}
176188

177189
unload() {
190+
this.unhackAsyncTabSwitcher();
178191
this.sidebarController.close();
179192
this.webPanel.remove();
180193
this.webPanelTab.remove();
@@ -333,6 +346,7 @@ export class WebPanelController {
333346
}
334347

335348
remove() {
349+
this.unhackAsyncTabSwitcher();
336350
this.webPanel.remove();
337351
this.webPanelTab.remove();
338352
this.webPanelButton.remove();

src/second_sidebar/controllers/web_panels.mjs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,6 @@ export class WebPanelsController {
166166
delete(uuid) {
167167
const index = this.getIndex(uuid);
168168
if (index !== -1) {
169-
const webPanelController = this.get(uuid);
170-
const webPanel = webPanelController.webPanel;
171-
172-
// Revert hack to deceive AsyncTabSwitcher
173-
const tabBrowser = webPanel.getTabBrowser();
174-
tabBrowser._printPreviewBrowsers.delete(webPanel.getXUL());
175-
176169
delete this.webPanelControllers[uuid];
177170
}
178171
}
@@ -292,11 +285,6 @@ export class WebPanelsController {
292285
unloadOnClose,
293286
hideToolbar,
294287
);
295-
296-
// Hack to deceive AsyncTabSwitcher
297-
const tabBrowser = webPanel.getTabBrowser();
298-
tabBrowser._printPreviewBrowsers.add(webPanel.getXUL());
299-
300288
return webPanel;
301289
}
302290

0 commit comments

Comments
 (0)