Refactor browser extension graphql functions
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 toPlatformContext.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 globalisPrivateRepository()
, 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