Skip to content

[webview_flutter_tizen] Implement getCookies and setCookie - #1176

Open
seungsoo47 wants to merge 1 commit into
flutter-tizen:mainfrom
seungsoo47:webview_flutter-getcookies
Open

seungsoo47 wants to merge 1 commit into
flutter-tizen:mainfrom
seungsoo47:webview_flutter-getcookies

Conversation

@seungsoo47

Copy link
Copy Markdown
Contributor
  • Add getCookies to the cookie manager using the EWK and WV cookie getters.
  • Add setCookie to the cookie manager on the WV backend.
  • Apply tizenEnginePolicy before WV initialization.
  • Fix cookie operations using a destroyed WebView.

Implement the cookie manager on top of the web engine cookie APIs.

- getCookies calls ewk_view_get_cookies_for_url on the EWK backend and
  wv_view_get_cookies_for_url on the WV backend. Both engines return
  NULL for an empty jar, which is reported as no cookies. The EWK getter
  currently returns NULL even when cookies exist, an engine defect being
  fixed.
- setCookie calls wv_cookie_manager_set_cookie_for_url on the WV backend,
  in both standalone and EWK wrapper mode, with a host-only line built
  like upstream Android. EWK has no setter and throws
  UnimplementedError. In EWK wrapper mode the engine's setter relies on
  its EWK and WV cookie manager handles sharing a layout; an explicit
  wrapper branch has been requested from the engine side.
- Register the cookie method channel once in the plugin instead of per
  WebView. The per-WebView channel was destroyed when the constructor
  returned while its handler, which captured the WebView, stayed on the
  messenger, so a cookie call after that WebView was disposed reached
  freed memory. Calls now go to the most recently created WebView that
  has been initialized.
- Apply tizenEnginePolicy before WV engine initialization by deferring
  wv_init() to the first WebView, and do not retry it once it fails.

Verified on rpi4 (Tizen 10.1, EWK wrapper): an empty jar returns [],
setCookie reaches the request Cookie header, getCookies reads it back
with path filtering, and cookie calls keep working after the newer of
two WebViews is disposed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant