Bug #321

Browser crashes when switching from it while a page is starting to load

Added by Rayleigh Rayleigh over 3 years ago. Updated almost 3 years ago.

Next Release
Start date:
Due date:
% Done:


Estimated time:



there's a bug that's been... bugging (sorry for the pun) me for quite a while now.

General info:

Android 8.1 Resurrection Remix w/ Magisk and Xposed
Privacy Browser 2,12 from FDroid
Android WebView 61.0.3163.98


If I start loading a webpage in Privacy Browser, but the progress bar doesn't get further than the menu button in the top left corner, when I switch away from the app (e.g. open recents or switch to another app), PB crashes as soon as the webpage starts to "really load" (signified by increased network activity in the statusbar).

I'm going to attach a log. It's also easily reproducible, at least for me, so I can even do a screen recording if it's needed.


stack.log (1.08 KB) stack.log Caught stack trace of the error Rayleigh Rayleigh, 08/05/2018 10:45 PM



Updated by Soren Stoutner over 3 years ago

  • Assignee set to Soren Stoutner

Thank you for the stack trace. This crash is caused because `Can not perform this action after onSaveInstanceState` is crashing the system when the webpage finishes loading `onPageFinished`. `onSaveInstanceState` is called every time you switch away from the app, which matches your description. However, it isn't clear why this is a problem, as it doesn't happen on my test device.

It is possible that this might be caused because you are using an older WebView. You might try upgrading to the most recent (, but I don't think this is the root of the problem.

It is more likely that there is something specific about your ROM or the modifications (Magisk and Xposed) that is causing problems.

Attached is a debug build of Privacy Browser Free (you can install it without having to uninstall your current Privacy Browser and lose all your settings). Could you please get a stack track of this crashing? Hopefully it will tell us the line number of the command that is not working after `onSaveInstanceState`.


Updated by Soren Stoutner over 3 years ago

  • File app-free-debug.apk added

Updated by Rayleigh Rayleigh over 3 years ago

Hmm... it seems that neither the debug free app nor the normal free app that I just downloaded using Yalp Store crash.

They don't crash, because they don't load the webpages in the background for some reason.

I've also updated my WebView to the Bromite-privacy-enhanced webview, but it didn't change a thing in how PB behaves. (Before you create privacy WebView, what about using Bromite's?)

I'll just wait until the next release to see if it'll magicaly fix itself, seen as I seem to be the only one experiencing the issue.

I've also got a question. If the Librem 5 becomes a successful libre phone, would you consider making a version of PB for it?


Updated by Soren Stoutner over 3 years ago

I don't think the problem has to do with loading the web pages in the background. When switching away from Privacy Browser all WebView activity is paused. When switching back to the app the activity is resumed. The crash is caused because of some unspecified command that is run when the page finishes loading says it can't run after the app has been paused (`onSaveInstanceState`). It isn't clear to me which command this could be. I have reviewed the code that runs in `onPageFinished` and it all looks fine to me.

Could you try resetting all your settings to default by clearing Privacy Browser's data and see if you can still replicate the problem? There might be some combination of settings that cause this bug to appear. If using the default settings work, you could slowly re-enable your custom settings and see if you can duplicate the issue. (You might want to backup your settings/bookmarks first if you have a lot of them.)

There is also some possibility that there is a problem with the APK hosted by F-Droid. But I downloaded it onto one of my testing devices and was not able to replicate the bug. If nothing else works, try downloading the APK hosted at


Updated by Soren Stoutner over 3 years ago

Bromite's SystemWebView is interesting. I will take a look.


Updated by Soren Stoutner over 3 years ago

I am planning to begin working on other platforms once the 4.x series is well established. The Librem 5 phone is on my radar. If it gets enough market share I am planning on developing Privacy Browser for it.


Updated by Rayleigh Rayleigh over 3 years ago

And now I've become even more confused.

The browser stopped crashing, but I haven't done anything at all, except for uninstaling Brevent, linstalling Greenify and enablng it as an Xposed module, but this should all be unrelated.

On one side, I am glad it has fixed itself, but I'd still like to know what caused this bug.

My hypothesises are:

1. Brevent stopped working for me and maybe it was causing some conflict on the system level, as it had root access

2. Installing another Xposed module changed something during the loading of Xposed which was causing this random bug

3. It might have also been related to the fact that I've been internationally roaming for the whole time.

Either way, I'm glad this has fixed itself and I'm also glad I could bring your attention to Bromite's WebView.


Updated by Rayleigh Rayleigh over 3 years ago


A wild thought has crossed my mind connected with the fact I was roaming and I've found the root of the problem!

The bug occurs when data saver is enabled and PB tries to load websites from the start in the background!


Updated by Soren Stoutner over 3 years ago

  • Status changed from New to Closed

That is interesting. I am not able to reproduce the problem with data saver enabled on my Pixel 2 XL running stock Android 8.1.0. However, I have discovered that a lot of crashes are related to how individual ROMs/OEMs customize Android's power/data/RAM management features.

Thanks for the followup info.


Updated by Soren Stoutner over 3 years ago

  • File deleted (app-free-debug.apk)

Updated by Soren Stoutner almost 3 years ago

  • Priority changed from 2 to Next Release

Also available in: Atom PDF