Skip to content

Latest commit

 

History

History
21 lines (12 loc) · 2.15 KB

Adding-a-protocol-scheme-to-Brave.md

File metadata and controls

21 lines (12 loc) · 2.15 KB

We currently have 3 different types of protocol handlers in Brave:

  • External protocol handler used for handling magnet URLs
  • External protocol handlers used for oauth flows (cryptocurrency exchanges at the time of writing)
  • brave:// being an alias for chrome://

Below is a description of changes and patching we've had to do for schemes:

  • AddAdditionalSchemes is only used for adding brave:// to the same list of URLs as chrome://. Example

  • GrantRequestScheme - Allows a webui to access it so no reason for that. Example

  • RegisterURLSchemeAsNotAllowingJavascriptURLs - Registers an URL scheme to not allow manipulation of the loaded page by bookmarklets or javascript: URLs typed in the omnibox. Example

  • RegisterURLSchemeAsDisplayIsolated - Registers a URL scheme to be treated as display-isolated. This means that pages cannot display these URLs unless they are from the same scheme. For example, pages in another origin cannot create iframes or hyperlinks to URLs with the scheme. Example

  • CanAddURLToHistory - Prevents a URL from being added to history, note that redirects do not appear in history. So this is probably not needed for oauth related schemes. Example

  • IsHandledProtocol - Needed for protocol handlers, but not needed for external protocol handlers. Example

  • ExtensionTabUtil::IsKillURL - This is only needed because brave:// is an alias for chrome:// and an explicit check is made. Example