clean up usage of Sourcegraph extensions API (controller, platform context) in client/browser
Created by: sqs
See individual commits.
reuse browser extension CodeHost#{buildJumpURLLocation => urlToFile}
in PlatformContext
The purpose of this commit is to reduce the differences between how the web app and browser extension construct URLs to files.
- Add
PlatformContext#urlToFile
- Rename
CodeHost#{buildJumpURLLocation => urlToFile}
- Use
CodeHost#urlToFile
to populatePlatformContext#urlToFile
in the browser extension - Use
toPrettyBlobURL
forPlatformContext#urlToFile
in the web app
always use extensionsController/platformContext in browser extension
This shrinks the delta between code paths in the browser extension for "Use extensions" and non-"Use extensions". It makes it so that the platformContext and extensionsController are always instantiated.
This change is tested to be backwards-compatible with Sourcegraph 2.10. In older Sourcegraph versions with extensions not enabled by default (2.10-2.11 inclusive), the user settings will not contain any extensions, and so the extensions controller will effectively be a noop. It is useful to still call it (even if it's a noop) to shrink the delta between the 2 code paths.