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

Extend webview testcases with MSTG-Platform-10 #1487

Open
1 of 2 tasks
commjoen opened this issue Oct 4, 2019 · 0 comments
Open
1 of 2 tasks

Extend webview testcases with MSTG-Platform-10 #1487

commjoen opened this issue Oct 4, 2019 · 0 comments

Comments

@commjoen
Copy link
Collaborator

commjoen commented Oct 4, 2019

MSTG-Platform-10: A WebView's cache, storage, and loaded resources (JavaScript, etc.) should be cleared before the WebView is destroyed.

Maybe include to do the cleanup when a webview has hung? https://developer.android.com/about/versions/10/features#webview-hung

Research notes for iOS

Check WebView Config / init for params/functions preventing files from being stored in the first place

One option is to use WKWebsiteDataStore.nonPersistent(). Example here:

https://github.com/duckduckgo/iOS/blob/cb600c312c1c9884f72d0cffe00318dd0de9faab/Core/WKWebViewConfigurationExtension.swift

This is old code but check if it's good for whenever nonPersistent is not an option:

// https://gist.github.com/insidegui/4a5de215a920885e0f36294d51263a15

    HTTPCookieStorage.shared.removeCookies(since: Date.distantPast)
WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in
    records.forEach { record in
        WKWebsiteDataStore.default().removeData(ofTypes: record.dataTypes, for: [record], completionHandler: {})
        print("Cookie ::: \(record) deleted")
    }
}

More useful linnks for the research:

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

3 participants