Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incognito windows restored as normal windows in Chrome #342

Closed
ym1234 opened this issue Nov 23, 2018 · 10 comments
Closed

Incognito windows restored as normal windows in Chrome #342

ym1234 opened this issue Nov 23, 2018 · 10 comments

Comments

@ym1234
Copy link

ym1234 commented Nov 23, 2018

Short description

Private (Incognito) aren't remembered (Even with the option enabled)

Steps to reproduce

  1. Start browser with clean profile
  2. Install Tab Session Manager
  3. Enable Save private window
  4. Save a session with a incognito windows

Expected result

Saves the incognito window

Actual result

Doesn't save the incognito window(s)

Platform information

  • Platform (OS): Arch Linux
  • Version of browser: Chromium Version 70.0.3538.67 (Official Build) Arch Linux (64-bit)
  • Version of Tab Session Manager: 4.3.2
@ym1234
Copy link
Author

ym1234 commented Nov 24, 2018

Oh, okay, I had to enable the Allow in incognito option in chrome://extensions, but still it doesn't reopen incognito windows as incognito.

@sienori
Copy link
Owner

sienori commented Dec 2, 2018

Because of Chrome's specification, it is impossible to open a session in private window.

https://developer.chrome.com/extensions/manifest/incognito

Because incognito tabs cannot use this shared process, an extension using the "spanning" incognito mode will not be able to load pages from its extension package into the main frame of an incognito tab.

@sienori sienori changed the title Private (Incognito) windows aren't remembered (Even with the option enabled) Can not open tabs in incognito window in Chrome Dec 2, 2018
@sienori sienori added the invalid label Dec 2, 2018
@ym1234
Copy link
Author

ym1234 commented Dec 2, 2018

Hmm interesting, but session buddy is able to open them in incognito windows somehow.
https://stackoverflow.com/questions/32762537/chrome-tabs-create-in-incognito-window-opens-a-tab-in-normal-window

@DedupOperator
Copy link

DedupOperator commented Dec 11, 2018

I can confirm saving incognito windows.
A requirement is Enable "Allow in incognito" in the extensions settings.

Although by reviewing the auto save history, there were times it haven't save them.
Not sure if it's consistent, it might have been accrued only in an older version.
I'll keep you updated whether I find any systematic behavior.

:EDIT: as @ym1234 stated, it should be possible to reopen saved tabs as incognito.

2018-12-11 17_20_45-extensions

@absorber
Copy link

absorber commented Jul 1, 2020

Can the "invalid" tag please be removed? As @ym1234 mentioned, Session Buddy is able to both save and restore to incognito windows, and to me that's one of the fundamental features that I use in Session Buddy which I would love to see in Tab Session manager.

Also, @DedupOperator: Do you mean that it should be generally possible to reopen saved tabs as incognito or specifically in Tab Session Manager?

@evelikov
Copy link

@ym1234 do you mind changing the issue title - say "Incognito windows restored as normal windows in Chrome"?
It took me a while to find this issue 😉

Skimming through the code:

  • the incognito tag is already set in the manifest.json
  • as seen from the code the window incognito mode is only restored on Firefox.

Looking around a single commit adds both hunks referenced - but it only adds Chrome support by reshuffling things around. There is no incognito support afaict.

So I've tried removing the Firefox guard - now all the tabs are opened in the same normal window... I think. Dropping the tabs.remove() from removeNowOpenTabs() does preserve the correct number of windows, although none are incognito.
Flipping the manifest tag to split doesn't help much either 😢

@sienori can you share some tips and ideas?
Aside: why are tabs saved as "session.windows" and windows as "session:windowsInfo" - this seem quite misleading

@ym1234 ym1234 changed the title Can not open tabs in incognito window in Chrome Incognito windows restored as normal windows in Chrome Oct 28, 2020
@ym1234
Copy link
Author

ym1234 commented Oct 28, 2020

Done, doesn't look like there is any intention to fix this issue though.

@evelikov
Copy link

evelikov commented Oct 28, 2020

I guess things got burred and/or the fix does not seems obvious... Speaking of which, I've got to the bottom of it 🎉

Tl;Dr: As the replace.html of "Tab Lazy Loading" is loader, the incognito tab moves to the normal window. Yes, the Firefox guard must be nuked.

Since lazy-loading is a must for me, I'll take a look at enabling discard for Chrome. Stay tuned I should have something over the weekend.

@evelikov
Copy link

evelikov commented Nov 2, 2020

@ym1234 didn't get the time for a proper fix, but in the meanwhile here is what I've been using:

commit 97b0ff7304a7b279963d2158ca03e68f942535b4
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Mon Nov 2 11:19:59 2020 +0000

    HACKY: chrome: restore incognito windows as such
    
    Current code, only restores the incognito mode for Firefox. Although
    by removing the guard, we end up with incognito tabs in the main
    window. That's due to the lazy loading - aka our assets are not allowed
    within the incognito tab.
    
    Note: this might be a bug, since incognito split mode (as in the json
    manifest) implies that this should work ... while the spanning mode
    explicitly forbids it.
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

diff --git a/src/background/open.js b/src/background/open.js
index a539a86..8a0b9b3 100644
--- a/src/background/open.js
+++ b/src/background/open.js
@@ -19,10 +19,8 @@ export async function openSession(session, property = "openInNewWindow") {
     const openInNewWindow = async () => {
       log.log(logDir, "openSession() openInNewWindow()");
       let createData = {};
-      if (browserInfo().name === "Firefox") {
-        const firstTab = session.windows[win][Object.keys(session.windows[win])[0]];
-        createData.incognito = firstTab.incognito;
-      }
+      const firstTab = session.windows[win][Object.keys(session.windows[win])[0]];
+      createData.incognito = firstTab.incognito;
 
       const isSetPosition =
         getSettings("isRestoreWindowPosition") && session.windowsInfo != undefined;
@@ -168,7 +166,7 @@ function openTab(session, win, currentWindow, tab, isOpenToLastIndex = false) {
     }
 
     //Lazy loading
-    if (getSettings("ifLazyLoading")) {
+    if (browserInfo().name == "Firefox" && getSettings("ifLazyLoading")) {
       if (getSettings("isUseDiscarded") && isEnabledDiscarded) {
         if (!createOption.active && !createOption.pinned) {
           createOption.discarded = true;
diff --git a/src/settings/defaultSettings.js b/src/settings/defaultSettings.js
index c010ce2..0032435 100644
--- a/src/settings/defaultSettings.js
+++ b/src/settings/defaultSettings.js
@@ -16,7 +16,9 @@ export default [
         title: "ifLazyLoadingLabel",
         captions: ["ifLazyLoadingCaptionLabel"],
         type: "checkbox",
-        default: true,
+        // TODO: Chrome: add discard support and rework/expose to users
+        default: browserInfo().name == "Firefox"
+        shouldShow: browserInfo().name == "Firefox"
         childElements: [
           {
             id: "isUseDiscarded",

@sienori
Copy link
Owner

sienori commented Aug 1, 2021

I fixed this problem in version 6.9.0. cc1aafc
The reason was that the lazy loading page could not be opened in an incognito window.
I disabled lazy loading only when opening an incognito window in Chrome.

@sienori sienori added solved and removed invalid labels Aug 1, 2021
@sienori sienori closed this as completed Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants