MixinNetwork / MixinNetwork/flutter-plugins

[desktop_webview_window] Can't open URL about:srcdoc on macOS

Open
#357 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
512
Forks
292
Avg merge
15h 8m
Merged PRs (30d)
7

Description

Can't open URL about:srcdoc on macOS...
Is there any reason why the URL "about" is not on the scheme guard block?
Thank you.

On WebViewLayoutController.swift:

extension WebViewLayoutController: WKNavigationDelegate {
  func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
    guard let url = navigationAction.request.url else {
      decisionHandler(.cancel)
      return
    }

    guard ["http", "https", "file"].contains(url.scheme?.lowercased() ?? "") else {
      decisionHandler(.cancel)
      return
    }

    methodChannel.invokeMethod("onUrlRequested", arguments: [
      "id": viewId,
      "url": url.absoluteString,
    ] as [String: Any])

    decisionHandler(.allow)
  }

Version:

  • Flutter Version: v3.24.0
  • OS: macOS
  • plugin: desktop_webview_window: 0.2.3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the macOS WebViewLayoutController.swift WKNavigationDelegate method shown in the issue and inspect how navigation URL schemes are filtered. Reproduce the about:srcdoc navigation on macOS, then verify that the intended URL opens without breaking the existing http, https, and file handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
flutter, swift
Domain
desktop
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.