Project

General

Profile

sometimes I get logged out of all

Added by ask low 8 months ago

This happened a lot of times. And still continue to happen. Donno how but, I get logged out of all existing open tabs. And when I reload them one by one, I get logged in again.
This means the existing tabs refuse to access cookies for a brief amount of time. Then access again after reloading. Why do you think this happen ?


Replies (4)

RE: sometimes I get logged out of all - Added by Soren Stoutner 8 months ago

Does Privacy Browser restart when this happens? You can tell if it is restarting because the privacy shield will briefly display in the center of the screen.

RE: sometimes I get logged out of all - Added by ask low 8 months ago

Nop. If PB restarts, that would obviously close all tabs & start fresh.

RE: sometimes I get logged out of all - Added by Soren Stoutner 8 months ago

What I am referring to is if the Android OS runs the `onStop` command because it decides that Privacy Browser has been running in the background too long or because some other app needs the RAM.

Refer to the attached image with a simplified version of the Android Activity Lifecycle.

When that happens (which is quite frequent), then Android will call `onCreate`, then `onStart`, and then `onResume` the next time Privacy Browser is brought to the focus. When Privacy Browser is killed in the background by the OS, it stores a copy of each WebViews state in the saved instance state bundle.

https://developer.android.com/topic/libraries/architecture/saving-states

When it is restarted, it restores those states, which involved reloading the URL. You can tell that this is happening because the filter lists must also be reloaded, which causes the blue Privacy Shield to briefly display on the screen before you see any of the other interface elements.

The key to understanding why this might be a problem for you is to remember that currently, due to limitations in Android's system WebView, cookies is an app-wide settings, not a tab setting. This is explained with some details in the Guide inside the app under the section for Local Storage, but the summary is that if you are on a tab where cookies are enabled they are enabled for all the other tabs that might make a network request in the background. And, if you are on a tab where cookies are disabled, they are disabled for all the other tabs that might make a network request in the background. When switching tabs, the cookie status for the foreground tab is applied to the entire app.

My guess as to what is happening is that when Privacy Browser is restarting, if you are on a tab where cookies are disabled, all the other tabs load in the background with cookies disabled. But when you switch to them and cookies are enabled, you can refresh them and any login cookies are then sent to that tab.

This is a cookie limitation that will be removed in with Privacy WebView in the 4.x series with Feature #409: Enable/disable first-party cookies by WebView.

RE: sometimes I get logged out of all - Added by ask low 8 months ago

Oh. Now I see why I sometimes get shielded view. That's exactly when those open tabs had logged out state.
I usually have github notifications tab open all the time. When this occurs, the site throws this page doesn't exist. As soon as I reload, cookies kick in & signed back in.
Thia behavior is very weird though.

    (1-4/4)