Bug 1476570 - allow proxy to work on restricted domains, r=aswan

Proxies must work with all requests, however the new onRequest proxy api
has maching logic using ChannelWrapper which uses WebExtensionPolicy which
checks against restricted domains.  We need to bypass that check when
matching for proxy requests.

MozReview-Commit-ID: 5zCdmV1b9M7
This commit is contained in:
Shane Caraveo
2018-08-02 14:03:00 -03:00
parent a7955fc610
commit ecf7aa7e22
3 changed files with 12 additions and 10 deletions

View File

@@ -521,13 +521,14 @@ ChannelWrapper::Matches(const dom::MozRequestFilter& aFilter,
}
if (aExtension) {
if (!aExtension->CanAccessURI(urlInfo)) {
bool isProxy = aOptions.mIsProxy && aExtension->HasPermission(nsGkAtoms::proxy);
// Proxies are allowed access to all urls, including restricted urls.
if (!aExtension->CanAccessURI(urlInfo, false, !isProxy)) {
return false;
}
// If this isn't the proxy phase of the request, check that the extension
// has origin permissions for origin that originated the request.
bool isProxy = aOptions.mIsProxy && aExtension->HasPermission(nsGkAtoms::proxy);
if (!isProxy) {
if (IsSystemLoad()) {
return false;