Skip to content

Commit

Permalink
[FB] PWA | Make do not save PWA Window
Browse files Browse the repository at this point in the history
  • Loading branch information
surapunoyousei committed Nov 7, 2023
1 parent c251f4a commit d675965
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
9 changes: 1 addition & 8 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2357,13 +2357,6 @@ var gBrowserInit = {
let uri = window.arguments?.[0];

/*** Floorp Injections *********************************************************************************************/
let firstTab = gBrowser.tabs[0];
let pwaIsTrue = firstTab.getAttribute("floorpSSB");

if (pwaIsTrue) {
window.close();
return
}

if (uri) {
try {
Expand Down Expand Up @@ -2399,7 +2392,7 @@ var gBrowserInit = {
);
}
} catch (e) {
console.log(e);
console.error(e);
}
}

Expand Down
4 changes: 3 additions & 1 deletion browser/base/content/tabbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3159,7 +3159,9 @@
let tabWasReused = false;
let floorpWorkspace = tabData.floorpWorkspace ? tabData.floorpWorkspace : Services.prefs.getStringPref("floorp.browser.workspace.all").split(",")[0];
let floorpSSB = tabData.floorpSSB;
console.log(floorpSSB)
if (floorpSSB) {
window.close();
}

// Re-use existing selected tab if possible to avoid the overhead of
// selecting a new tab.
Expand Down
16 changes: 15 additions & 1 deletion browser/components/sessionstore/SessionSaver.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ var SessionSaverInternal = {
for (let window of windows) {
for (let tab of window.tabs) {
let ssbEnabled = tab.floorpSSB == "true";

if (ssbEnabled && windows.length == 1){
this.updateLastSaveTime();
return Promise.resolve();
Expand All @@ -267,6 +266,21 @@ var SessionSaverInternal = {
}
}

for (let windowKey in state.windows) {
let window = state.windows[windowKey];
for (let tab of window.tabs) {
let ssbEnabled = tab.floorpSSB == "true";
if (ssbEnabled && Object.keys(state.windows).length == 1){
this.updateLastSaveTime();
return Promise.resolve();
} else if (ssbEnabled) {
// Remove Window
delete state.windows[windowKey];
delete state._closedWindows[windowKey];
}
}
}

lazy.PrivacyFilter.filterPrivateWindowsAndTabs(state);

// Make sure we only write worth saving tabs to disk.
Expand Down

0 comments on commit d675965

Please sign in to comment.