feat: migrate webRequest module to NetworkService (Part 7) (#19820)
* fix: gin treats Function as Dictionary when doing convertions * fix: check if listener exists * fix: listener callback should be executed in next tick * feat: make InProgressRequest work * test: re-enable protocol test that relies on webRequest * chore: merge conditions
This commit is contained in:
parent
1dc02e6dbc
commit
cd1b15a155
5 changed files with 38 additions and 14 deletions
|
@ -697,14 +697,13 @@ void ProxyingURLLoaderFactory::CreateLoaderAndStart(
|
|||
return;
|
||||
}
|
||||
|
||||
// Pass-through to the original factory.
|
||||
target_factory_->CreateLoaderAndStart(std::move(loader), routing_id,
|
||||
request_id, options, request,
|
||||
std::move(client), traffic_annotation);
|
||||
|
||||
// TODO(zcbenz): Remove the |CreateLoaderAndStart| call and create
|
||||
// InProgressRequest when the webRequest API is used.
|
||||
return;
|
||||
if (!web_request_api()->HasListener()) {
|
||||
// Pass-through to the original factory.
|
||||
target_factory_->CreateLoaderAndStart(
|
||||
std::move(loader), routing_id, request_id, options, request,
|
||||
std::move(client), traffic_annotation);
|
||||
return;
|
||||
}
|
||||
|
||||
// The request ID doesn't really matter. It just needs to be unique
|
||||
// per-BrowserContext so extensions can make sense of it. Note that
|
||||
|
|
|
@ -31,6 +31,7 @@ class WebRequestAPI {
|
|||
const std::set<std::string>& set_headers,
|
||||
int error_code)>;
|
||||
|
||||
virtual bool HasListener() const = 0;
|
||||
virtual int OnBeforeRequest(extensions::WebRequestInfo* info,
|
||||
const network::ResourceRequest& request,
|
||||
net::CompletionOnceCallback callback,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue