Breaking changes (NetworkService) (Draft)

This document describes changes to Electron APIs after migrating network code to NetworkService API.

We don’t currently have an estimate of when we will enable NetworkService by default in Electron, but as Chromium is already removing non-NetworkService code, we might switch before Electron 10.

The content of this document should be moved to breaking-changes.md once we have determined when to enable NetworkService in Electron.

计划中的 API 更改

protocol.unregisterProtocol

protocol.uninterceptProtocol

The APIs are now synchronous and the optional callback is no longer needed.

  1. // Deprecated
  2. protocol.unregisterProtocol(scheme, () => { /* ... */ })
  3. // Replace with
  4. protocol.unregisterProtocol(scheme)

protocol.registerFileProtocol

protocol.registerBufferProtocol

protocol.registerStringProtocol

protocol.registerHttpProtocol

protocol.registerStreamProtocol

protocol.interceptFileProtocol

protocol.interceptStringProtocol

protocol.interceptBufferProtocol

protocol.interceptHttpProtocol

protocol.interceptStreamProtocol

The APIs are now synchronous and the optional callback is no longer needed.

  1. // Deprecated
  2. protocol.registerFileProtocol(scheme, handler, () => { /* ... */ })
  3. // Replace with
  4. protocol.registerFileProtocol(scheme, handler)

The registered or intercepted protocol does not have effect on current page until navigation happens.

protocol.isProtocolHandled

This API is deprecated and users should use protocol.isProtocolRegistered and protocol.isProtocolIntercepted instead.

  1. // Deprecated
  2. protocol.isProtocolHandled(scheme).then(() => { /* ... */ })
  3. // Replace with
  4. const isRegistered = protocol.isProtocolRegistered(scheme)
  5. const isIntercepted = protocol.isProtocolIntercepted(scheme)