Get rid of client/browser/src/browser
Created by: felixfbecker
This was added as an abstraction layer for Safari, which we don't support anymore, and to wrap APIs in Promises, which we get through the browser
API (#3200 (closed)).
The way they wrap APIs is highly problematic and inconsistent. For example:
https://github.com/sourcegraph/sourcegraph/blob/master/client/browser/src/browser/permissions.ts
uses global chrome.permission
APIs with inconsistent and questionable handling of global chrome
not being defined (e.g. in Phabricator integration or Firefox). Some functions cause a "Cannot read property permissions of undefined" error which is currently spammed as unhandled rejections when running tests. Other functions will never settle the returned Promise if chrome
is not defined, which doesn't seem like a good solution either. We need to think about a consistent, predictable behaviour here and prevent the unhandled rejections. Example: When asking if we are permitted to do something that is only restricted in Chrome extensions, if chrome
is not defined, we could return true
. If it is only allowed in Chrome extensions, we would return false
in that case.
We should
- migrate references to src/browser/* to using the
browser
API directly - as we do that, make sure they are never called from the Phabricator integration, so the hacky
if (chrome)
checks are not needed