Skip to content

Refactor browser extension graphql functions

Warren Gifford requested to merge refactor-bext-graphql into master

Created by: lguychard

Fixes #3233 (closed)

  • Remove all sourcegraph.com fallback logic
  • Remove global repoUrlCache
  • Removes bext-specific graphQL API functions and their wonky error handling logic (eg. throwing the whole response object)
  • Refactors all browser extension code to use injected PlatformContext.requestGraphQL()
  • Keeps the mightContainPrivateInfo argument to PlatformContext.requestGraphQL(), because '/shared' code might need to flag a request as sensitive. For example, arbitrary graphQL requests made by extensions through the 'queryGraphQL' command are potentially sensitive, but cannot know whether the current repository is private.
  • Moves mightContainPrivateInfo checking in platform context, where it is testable (see new tests for platform context and extensions)
  • Adds CodeHostContext.privateRepository. This allows to get rid of the global isPrivateRepository(), which contained github-specific logic & selectors.
  • Refactors the browser extension code to either inject the sourcegraphURL, or observe it directly from sync storage / local storage / window.SOURCEGRAPH_URL.

Test Plan

Code Hosts
  • GitHub
  • GitHub Enterprise
  • Refined GitHub
  • Phabricator
  • Phabricator integration
  • Bitbucket
  • Gitlab
Browsers
  • Chrome
  • Firefox

Merge request reports

Loading