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

Closing one tab of many sometimes closes browser #50

Closed
oonet opened this issue Apr 19, 2020 · 34 comments
Closed

Closing one tab of many sometimes closes browser #50

oonet opened this issue Apr 19, 2020 · 34 comments
Labels
bug Something isn't working P0: Very high priority Needs to be fixed as soon as possible stale This probably won't be worked on

Comments

@oonet
Copy link

oonet commented Apr 19, 2020

Open a page in SmartCookieWeb

Link to another page from app other than SmartCookieWeb. SmartCookieWeb opens page correctly in a new tab.

Close tab (ie by pressing back arrow or Close current tab in Close Browser menu)

Window closes and SmartCookieWeb quits. (Should remain open.)

Running SmartCookieWeb returns to first tab as expected.

@CookieJarApps CookieJarApps added the bug Something isn't working label Apr 20, 2020
@CookieJarApps
Copy link
Owner

Back button seems to work as intended (i.e. you want to go back to the previous page which is the app that redirected you to Smart Cookie), but closing the tab shouldn't close. Thanks for reporting this - I'll work on a fix.

@oonet
Copy link
Author

oonet commented Apr 20, 2020

Fixed!

Prior tests always dumped back to the home screen whenever a tab opened by an external app was closed.

Now, closing tab - by either method - returns to the app that opened it. Nice refinement over simply remaining in the browser :-)

@oonet
Copy link
Author

oonet commented May 1, 2020

When SmartCookieWeb shares to SmartCookieWeb (eg via URL Forwarder), page opens in a new tab. Closing the tab returns to the home screen instead of remaining in SmartCookieWeb.

@oonet
Copy link
Author

oonet commented Jun 17, 2020

SmartCookieWeb 7.7.3 - problem persists.

@CookieJarApps
Copy link
Owner

I'm still working out the best way to fix this, but I hope to get it done in an update over the next 2 weeks or so.

@stale
Copy link

stale bot commented Sep 11, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale This probably won't be worked on label Sep 11, 2020
@CookieJarApps
Copy link
Owner

Still going to fix

@stale stale bot removed the stale This probably won't be worked on label Sep 11, 2020
@CookieJarApps
Copy link
Owner

Finally fixed in f5bb436. It was pretty easy to do - sorry this took so long. Once I've finished testing the update to make sure there are no crashes, I'll release it (probably tomorrow or the day after).

@oonet
Copy link
Author

oonet commented Sep 21, 2020

SmartCookieWeb 8.4.0
URL Forwarder 0.3

Forward random text to web form - works as expected :-)

Hit back arrow - form resubmits (should go to previous page)

Close tab - tab closes and SmartCookieWeb exits (should close tab, go to previous tab, leave SmartCookieWeb open)

@CookieJarApps
Copy link
Owner

Ok, I can fix the tab closing making the browser close, but it seems like it will break the back button functionality (taking you back to the previous app). Do you think that it would be worth it?

@RickyM7
Copy link
Contributor

RickyM7 commented Oct 7, 2020

On my Redmi Note 4 (Miui 11 - Android 7.0) these bugs don't happen, they happened in versions before v9.0.0, if I'm not mistaken.

@oonet
Copy link
Author

oonet commented Oct 7, 2020

Ok, I can fix the tab closing making the browser close, but it seems like it will break the back button functionality (taking you back to the previous app). Do you think that it would be worth it?

Not ideal. Maybe remain in SmartCookieWeb when previous app seems invalid?

On my Redmi Note 4 (Miui 11 - Android 7.0) these bugs don't happen, they happened in versions before v9.0.0, if I'm not mistaken.

Testing on a BLU G90, Android 10, SCW 8.4.0, URL Forwarder 0.3 . . . bugs happen. Android version doesn't appear to be the difference. Any ideas?

@RickyM7
Copy link
Contributor

RickyM7 commented Oct 7, 2020

Maybe something related to battery optimization? When you have the opportunity, please try v9.0.3 from here on GitHub, maybe it will solve something. You can edit the app's package name to test the new version without erasing your data. In fact, in the SCW in (Settings>General Settings) you have the setting "Close browser with last tab", see if the error stops when you turn it off.

@RickyM7
Copy link
Contributor

RickyM7 commented Oct 7, 2020

@oonet I just tested the URL Forwarder and in fact the app closes when trying to close the page that was created. It is as if that page was identified as separate, as is the private mode.

Note: I'm sorry, I didn't know the URL Forwarder, so I ended up making a mistake and confusing this bug with a very similar one that I had before and has already been solved.

@oonet
Copy link
Author

oonet commented Oct 7, 2020

I'm sorry, I didn't know the URL Forwarder, so I ended up making a mistake and confusing this bug with a very similar one that I had before and has already been solved.

Bug not just with URL Forwarder, but URL Forwarder makes the bug easy to reproduce.

That being said, you might want to take a look at it for use with SCW. For instance, for sharing data (not in SCW) with online scripts.

Maybe something related to battery optimization?

Maybe. Battery Saver is off. Not sure what else to try.

In fact, in the SCW in (Settings>General Settings) you have the setting "Close browser with last tab", see if the error stops when you turn it off.

Close browser with last tab already off.

When you have the opportunity, please try v9.0.3 from here on GitHub, maybe it will solve something.

I'll try to get to it later today. . . .

@oonet
Copy link
Author

oonet commented Oct 12, 2020

SmartCookieWeb 9.1.0

Going back continues to go to home page instead of remaining in SmartCookieWeb.

@ghost
Copy link

ghost commented Oct 15, 2020

i'm on 9.1.0-fdroid and honestly this is the only complaint i have.
even though i have turned off "close browser with last tab" but if i close the last tab(while i'm on it) it closes the whole browser.
as a workaround i'd switch tab and then close the last one tab.

thank you though and keep it up!
cheers

@stale
Copy link

stale bot commented Jan 13, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added stale This probably won't be worked on and removed stale This probably won't be worked on labels Jan 13, 2021
@CookieJarApps CookieJarApps added the P0: Very high priority Needs to be fixed as soon as possible label Jan 13, 2021
@CookieJarApps
Copy link
Owner

I've (finally) fixed the bug on the local copy on my PC, so the next update won't have this bug, but unfortunately my PC stopped working entirely so I'll only be able to commit the fix this weekend.

@CookieJarApps
Copy link
Owner

Ok, as of cf59574 when you open a link from another app, the back button works as before, but the close tab button no longer closes the app.

@RickyM7
Copy link
Contributor

RickyM7 commented Jan 15, 2021

@CookieJarApps I tested and the app still closes if you use the back button of the phone (and apparently only if the tab has not fully loaded yet), however only in this case the app closes.

Maybe this will help with something (this was generated by LeakCanary):

┬───
│ GC Root: System class

├─ com.huxq17.download.DownloadProvider class
│ Leaking: NO (BrowserApp↓ is not leaking and a class is never leaking)
│ ↓ static DownloadProvider.context
├─ com.cookiegames.smartcookie.BrowserApp instance
│ Leaking: NO (Application is a singleton)
│ ↓ BrowserApp.mLoadedApk
│ ~~~~~~~~~~
├─ android.app.LoadedApk instance
│ Leaking: UNKNOWN
│ ↓ LoadedApk.mReceivers
│ ~~~~~~~~~~
├─ android.util.ArrayMap instance
│ Leaking: UNKNOWN
│ ↓ ArrayMap.mArray
│ ~~~~~~
├─ java.lang.Object[] array
│ Leaking: UNKNOWN
│ ↓ Object[].[1]
│ ~~~
├─ android.util.ArrayMap instance
│ Leaking: UNKNOWN
│ ↓ ArrayMap.mArray
│ ~~~~~~
├─ java.lang.Object[] array
│ Leaking: UNKNOWN
│ ↓ Object[].[0]
│ ~~~
├─ com.cookiegames.smartcookie.rx.BroadcastReceiverObservable$subscribeActual$receiver$1 instance
│ Leaking: UNKNOWN
│ Anonymous subclass of android.content.BroadcastReceiver
│ ↓ BroadcastReceiverObservable$subscribeActual$receiver$1.$observer
│ ~~~~~~~~~
├─ io.reactivex.internal.operators.observable.ObservableMap$MapObserver instance
│ Leaking: UNKNOWN
│ ↓ ObservableMap$MapObserver.downstream
│ ~~~~~~~~~~
├─ io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver instance
│ Leaking: UNKNOWN
│ ↓ ObservableObserveOn$ObserveOnObserver.downstream
│ ~~~~~~~~~~
├─ io.reactivex.internal.observers.LambdaObserver instance
│ Leaking: UNKNOWN
│ ↓ LambdaObserver.onNext
│ ~~~~~~
├─ com.cookiegames.smartcookie.view.SmartCookieView$sam$io_reactivex_functions_Consumer$0 instance
│ Leaking: UNKNOWN
│ Anonymous class implementing io.reactivex.functions.Consumer
│ ↓ SmartCookieView$sam$io_reactivex_functions_Consumer$0.function
│ ~~~~~~~~
├─ com.cookiegames.smartcookie.view.SmartCookieView$1 instance
│ Leaking: UNKNOWN
│ Anonymous subclass of kotlin.jvm.internal.FunctionReference
│ ↓ SmartCookieView$1.receiver
│ ~~~~~~~~
├─ com.cookiegames.smartcookie.view.SmartCookieView instance
│ Leaking: UNKNOWN
│ ↓ SmartCookieView.activity
│ ~~~~~~~~
╰→ com.cookiegames.smartcookie.MainActivity instance
​ Leaking: YES (ObjectWatcher was watching this because com.cookiegames.smartcookie.MainActivity received Activity#onDestroy() callback and Activity#mDestroyed is true)
​ key = 02154f4f-4827-4400-92d5-24644aedd0d4
​ watchDurationMillis = 13453
​ retainedDurationMillis = 8453

METADATA

Build.VERSION.SDK_INT: 24
Build.MANUFACTURER: Xiaomi
LeakCanary version: 2.4
App process name: com.cookiejarapps.smartcookiebeta
Analysis duration: 12676 ms

@CookieJarApps
Copy link
Owner

In theory the back button is working as expected now (opening a link in another app - back button returns to the previous app, but close tab button doesn't), but is there another instance where the app is closing when it shouldn't?

@RickyM7
Copy link
Contributor

RickyM7 commented Jan 15, 2021

opening a link in another app - back button returns to the previous app, but close tab button doesn't

If this is the expected behavior then it is working as expected, I think. My test is to share a link from another app to open on scw (In case the scw was already open previously and now it will have two tabs open), but I expected that by clicking the back button of the phone the newly opened tab would be closed and the scw would open the tab that was opened first (this is the behavior of when we closed the tab by the close tab button).
The current behavior is this: Clicking the back button closes the current page (shared page of another app) and scw opens the previous page, but it closes as soon as the previous page opens and the phone returns to the previous app.

@RickyM7
Copy link
Contributor

RickyM7 commented Jan 24, 2021

@CookieJarApps I was testing the debug build #88 (Android CI #88) and saw a bug related to that issue. To make this bug occur you must:

  1. Install the "ApkMirrorButton" UserScript
  2. Open a link to any playstore app on SCW
  3. Click the "APKMirror" button when it appears
  4. When the new tab loads, or even while it is loading click the back button of your phone. This will cause the SCW to close.
  • Device: Redmi Note 4 (MIUI 11 - Android 7.0)

@CookieJarApps
Copy link
Owner

I managed to recreate the bug once, but strangely it stopped happening afterwards. I'll try on some more devices to try and see what might be causing the issue.

@RickyM7
Copy link
Contributor

RickyM7 commented Jan 24, 2021

@CookieJarApps I just tested the latest debug build (Android CI #91) and the bug really isn't happening anymore, it looks like the commit 79f84c9 solved it. In fact if you minimize and go back to SCW and try again the bug will occur.

@CookieJarApps
Copy link
Owner

CookieJarApps commented Jan 24, 2021

The issue with the script should be fixed in 1a272ff

@RickyM7
Copy link
Contributor

RickyM7 commented Jan 24, 2021

The issue with the script should be fixed in 1a272ff

Sorry for the delay. I just tested v12.0.0-rc1 and the bug still continues.

@CookieJarApps
Copy link
Owner

@CookieJarApps I was testing the debug build #88 (Android CI #88) and saw a bug related to that issue. To make this bug occur you must:

  1. Install the "ApkMirrorButton" UserScript
  2. Open a link to any playstore app on SCW
  3. Click the "APKMirror" button when it appears
  4. When the new tab loads, or even while it is loading click the back button of your phone. This will cause the SCW to close.
  • Device: Redmi Note 4 (MIUI 11 - Android 7.0)

Is the ApkMirror tab the only tab or is the play store tab still open?

@RickyM7
Copy link
Contributor

RickyM7 commented Jan 25, 2021

Is the ApkMirror tab the only tab or is the play store tab still open?

Still open because by clicking the "APKMirror" button a new tab opens.
If the "Allow sites to open new windows" option is turned off, the bug does not occur.

@RickyM7
Copy link
Contributor

RickyM7 commented Jan 25, 2021

Looks like the bug was fixed with the 957b87d, but I discovered another bug. To make this new bug occur you must:

  1. Go to the extensions settings and click "UserScript store"
  2. The dialog to select in which browser to open this will appear, click to open in SCW
  3. A new tab will open on SCW. When this tab loads completely or even while it is still loading click the back button of your phone. SCW will close.

@CookieJarApps
Copy link
Owner

Ok, good that that's fixed now. I might release v12 now, and then fix the 2nd bug with another update at the end of the week, but I'll try and see how easy it might be to fix.

@0xRustlang
Copy link

I had these problem with latest version of lightning so this bug may be related to its code.

@stale
Copy link

stale bot commented Jun 25, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale This probably won't be worked on label Jun 25, 2021
@stale stale bot closed this as completed Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0: Very high priority Needs to be fixed as soon as possible stale This probably won't be worked on
Projects
None yet
Development

No branches or pull requests

4 participants