Focus-android: GeckoView doesn't clear data from the session before closing

Created on 7 Sep 2018  路  6Comments  路  Source: mozilla-mobile/focus-android

From some inspection of the Fennec code and how user data is deleted, the GeckoView version of Focus doesn't seem to be sending the clear data event in the IWebView#cleanup.

Currently in Focus, we're only closing a session which (according to the docs) destroys only the page state:

override fun cleanup() {
    geckoSession.close()
}

An example of how I believe it should be:

override fun cleanup() {
    val data = GeckoBundle()
    listOf("openTabs", "history", "searchHistory", "downloadFiles", "formdata",
        "cookies_sessions", "cache", "offlineApps", "siteSettings", "syncedTabs",
        "passwords").map {
        data.putBoolean(it, true)
    }
    geckoSession.eventDispatcher.dispatch("Sanitize:ClearData", data)
    geckoSession.close()
}

The attributes provided above are from the string-array options in Fennec as well.

  • Android device: N/A
  • Focus version: master (06/09/2018)

Most helpful comment

Yeah as @pocmo says, Focus uses private mode, so no data is stored; therefore no need to clear it.

It's pretty difficult to have an exhaustive test for private mode, though I think Gecko has one. We probably just need a simple test to ensure the GeckoView API is actually activating private mode.

All 6 comments

@pocmo if I'm correct, then this would be the GeckoEngineSession implementation as well for mozilla-mobile/android-components#644

I'm not sure if looking at Fennec tells us much about how we should be using GV, but I can ask the GV team if we should be clearing data this way. cc @snorp

@jonalmeida Focus is running GeckoView in private mode. There shouldn't be the need to clean up anything here - I think?

@pocmo if I'm correct, then this would be the GeckoEngineSession implementation as well for mozilla-mobile/android-components#644

This may be correct but the GV team discourages us from using prefs or events directly (They are an internal implementation detail that is currently public for technical reasons). We should file an issue on Bugzilla so that they add an API with tests for that.

Sounds good, thanks all for clarifying!

Yeah as @pocmo says, Focus uses private mode, so no data is stored; therefore no need to clear it.

It's pretty difficult to have an exhaustive test for private mode, though I think Gecko has one. We probably just need a simple test to ensure the GeckoView API is actually activating private mode.

Was this page helpful?
0 / 5 - 0 ratings