fix: make webRequest work with WebSocket (#22040)
* fix: web request support proxying websocket * fix: make tests work * chore: do not use api:: code outside api/ folder * chore: do not create proxy when no listener * test: use separate session to avoid conflicts * chore: address review
This commit is contained in:
parent
80dd16aa78
commit
c608d6d7fb
14 changed files with 897 additions and 59 deletions
|
@ -20,13 +20,6 @@
|
|||
#include "shell/common/options_switches.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
namespace {
|
||||
|
||||
int64_t g_request_id = 0;
|
||||
|
||||
} // namespace
|
||||
|
||||
ProxyingURLLoaderFactory::InProgressRequest::FollowRedirectParams::
|
||||
FollowRedirectParams() = default;
|
||||
ProxyingURLLoaderFactory::InProgressRequest::FollowRedirectParams::
|
||||
|
@ -677,6 +670,7 @@ ProxyingURLLoaderFactory::ProxyingURLLoaderFactory(
|
|||
const HandlersMap& intercepted_handlers,
|
||||
content::BrowserContext* browser_context,
|
||||
int render_process_id,
|
||||
uint64_t* request_id_generator,
|
||||
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data,
|
||||
base::Optional<int64_t> navigation_id,
|
||||
network::mojom::URLLoaderFactoryRequest loader_request,
|
||||
|
@ -688,6 +682,7 @@ ProxyingURLLoaderFactory::ProxyingURLLoaderFactory(
|
|||
intercepted_handlers_(intercepted_handlers),
|
||||
browser_context_(browser_context),
|
||||
render_process_id_(render_process_id),
|
||||
request_id_generator_(request_id_generator),
|
||||
navigation_ui_data_(std::move(navigation_ui_data)),
|
||||
navigation_id_(std::move(navigation_id)),
|
||||
loader_factory_type_(loader_factory_type) {
|
||||
|
@ -765,7 +760,7 @@ void ProxyingURLLoaderFactory::CreateLoaderAndStart(
|
|||
// per-BrowserContext so extensions can make sense of it. Note that
|
||||
// |network_service_request_id_| by contrast is not necessarily unique, so we
|
||||
// don't use it for identity here.
|
||||
const uint64_t web_request_id = ++g_request_id;
|
||||
const uint64_t web_request_id = ++(*request_id_generator_);
|
||||
|
||||
// Notes: Chromium assumes that requests with zero-ID would never use the
|
||||
// "extraHeaders" code path, however in Electron requests started from
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue