Repository: tauri-apps/tauri
File: core/tauri-runtime-wry/src/lib.rs (Rust)

Code before:
      if let Ok(url) = url.parse() {
        download_handler(DownloadEvent::Finished { url, path, success });
      }
    });
  }

  if let Some(page_load_handler) = pending.on_page_load_handler {
    webview_builder = webview_builder.with_on_page_load_handler(move |event, url| {
      let _ = Url::parse(&url).map(|url| {
        page_load_handler(
          url,
          match event {
            wry::PageLoadEvent::Started => tauri_runtime::window::PageLoadEvent::Started,
            wry::PageLoadEvent::Finished => tauri_runtime::window::PageLoadEvent::Finished,
          },
        )
      });
    });
  }

  if let Some(user_agent) = webview_attributes.user_agent {
    webview_builder = webview_builder.with_user_agent(&user_agent);
  }

  if let Some(proxy) = webview_attributes.proxy {
    let config = parse_proxy(&proxy).unwrap();

    webview_builder = webview_builder.with_proxy_config(config);
  }

  #[cfg(windows)]
  {
    if let Some(additional_browser_args) = webview_attributes.additional_browser_args {
      webview_builder = webview_builder.with_additional_browser_args(&additional_browser_args);
    }

    if let Some(theme) = window_theme {
      webview_builder = webview_builder.with_theme(match theme {
        TaoTheme::Dark => wry::Theme::Dark,
        TaoTheme::Light => wry::Theme::Light,
        _ => wry::Theme::Light,
      });
    }
  }

  #[cfg(windows)]
  {
    webview_builder = webview_builder.with_https_scheme(false);
  }

  if let Some(handler) = ipc_handler {

Review comment (suggestion):
```suggestion
    let config = parse_proxy_url(&proxy_url)?;
```

Code after:
    Event::NewEvents(StartCause::Poll) => {
      callback(RunEvent::Resumed);
    }

    Event::MainEventsCleared => {
      callback(RunEvent::MainEventsCleared);
    }

    Event::LoopDestroyed => {
      callback(RunEvent::Exit);
    }

    #[cfg(any(feature = "tracing", windows))]
    Event::RedrawRequested(id) => {
      #[cfg(windows)]
      if let Some(window_id) = webview_id_map.get(&id) {
        let mut windows_ref = windows.borrow_mut();
        if let Some(window) = windows_ref.get_mut(&window_id) {
          if window.is_window_transparent {
            if let Some(surface) = &mut window.surface {
              if let Some(window) = &window.inner {
                clear_window_surface(window, surface)
              }
            }
          }
        }
      }

      #[cfg(feature = "tracing")]
      active_tracing_spans.remove_window_draw(id);
    }

    Event::UserEvent(Message::Webview(
      window_id,
      _webview_id,
      WebviewMessage::WebviewEvent(event),
    )) => {
      if let Some(event) = WindowEventWrapper::from(event).0 {
        let windows = windows.borrow();
        let window = windows.get(&window_id);
        if let Some(window) = window {
          callback(RunEvent::WindowEvent {
            label: window.label.clone(),
            event: event.clone(),
          });

          let listeners = window.window_event_listeners.lock().unwrap();
          let handlers = listeners.values();
          for handler in handlers {
            handler(&event);
          }