Repository: tauri-apps/tauri
File: crates/tauri-runtime/src/webview.rs (Rust)

Code before:
  /// - **Android on Wry:** The Android WebView does not provide an API for initialization scripts,
  ///   so we prepend them to each HTML head. They are only implemented on custom protocol URLs.
  #[must_use]
  pub fn initialization_script(mut self, script: &str) -> Self {
    self.initialization_scripts.push(InitializationScript {
      script: script.to_string(),
      for_main_frame_only: true,
    });
    self
  }

  /// Adds an init script for all frames.
  ///
  /// When webview load a new page, this initialization code will be executed.
  /// It is guaranteed that code is executed before `window.onload`.
  ///
  /// This is executed on all frames, main frame and also sub frames.
  /// If you only want to run it in the main frame, use [Self::initialization_script] instead.
  ///
  /// ## Platform-specific
  ///
  /// - **Android on Wry:** The Android WebView does not provide an API for initialization scripts,
  ///   so we prepend them to each HTML head. They are only implemented on custom protocol URLs.
  ///
  /// - On **macOS** and **iOS** you can use this to overwrite browser apis to make them inacessible even in iframes.
  ///   You can disable WebRTC this way, for example.
  #[must_use]
  pub fn initialization_script_on_all_frames(mut self, script: &str) -> Self {
    self.initialization_scripts.push(InitializationScript {
      script: script.to_string(),
      for_main_frame_only: false,
    });
    self
  }

  /// Data directory for the webview.
  #[must_use]
  pub fn data_directory(mut self, data_directory: PathBuf) -> Self {
    self.data_directory.replace(data_directory);
    self
  }

  /// Disables the drag and drop handler. This is required to use HTML5 drag and drop APIs on the frontend on Windows.
  #[must_use]
  pub fn disable_drag_drop_handler(mut self) -> Self {
    self.drag_drop_handler_enabled = false;
    self
  }

  /// Enables clipboard access for the page rendered on **Linux** and **Windows**.
  ///

Review comment (suggestion):
```suggestion
```

Let's remove these, they're not specific to macos and ios and I think it's obvious enough what an initialization script can do

Code after:
  pub fn initialization_script(mut self, script: &str) -> Self {
    self.initialization_scripts.push(InitializationScript {
      script: script.to_string(),
      for_main_frame_only: true,
    });
    self
  }

  /// Adds an init script for all frames.
  ///
  /// When webview load a new page, this initialization code will be executed.
  /// It is guaranteed that code is executed before `window.onload`.
  ///
  /// This is executed on all frames, main frame and also sub frames.
  /// If you only want to run it in the main frame, use [Self::initialization_script] instead.
  ///
  /// ## Platform-specific
  ///
  /// - **Android on Wry:** The Android WebView does not provide an API for initialization scripts,
  ///   so we prepend them to each HTML head. They are only implemented on custom protocol URLs.
  #[must_use]
  pub fn initialization_script_on_all_frames(mut self, script: &str) -> Self {
    self.initialization_scripts.push(InitializationScript {
      script: script.to_string(),
      for_main_frame_only: false,
    });
    self
  }

  /// Data directory for the webview.
  #[must_use]
  pub fn data_directory(mut self, data_directory: PathBuf) -> Self {
    self.data_directory.replace(data_directory);
    self
  }

  /// Disables the drag and drop handler. This is required to use HTML5 drag and drop APIs on the frontend on Windows.
  #[must_use]
  pub fn disable_drag_drop_handler(mut self) -> Self {
    self.drag_drop_handler_enabled = false;
    self
  }

  /// Enables clipboard access for the page rendered on **Linux** and **Windows**.
  ///
  /// **macOS** doesn't provide such method and is always enabled by default,
  /// but you still need to add menu item accelerators to use shortcuts.
  #[must_use]
  pub fn enable_clipboard_access(mut self) -> Self {
    self.clipboard = true;
    self