fix: load source maps from custom protocols and asar bundles (#28573)
* fix: load source maps from custom protocols and asar bundles * chore: fix lint
This commit is contained in:
parent
ef4954fa1f
commit
6bd13cc98f
6 changed files with 99 additions and 44 deletions
|
@ -41,6 +41,8 @@
|
|||
#include "services/network/public/cpp/simple_url_loader.h"
|
||||
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
|
||||
#include "services/network/public/cpp/wrapper_shared_url_loader_factory.h"
|
||||
#include "shell/browser/net/asar/asar_url_loader_factory.h"
|
||||
#include "shell/browser/protocol_registry.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_delegate.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
||||
#include "shell/browser/ui/inspectable_web_contents_view_delegate.h"
|
||||
|
@ -673,12 +675,20 @@ void InspectableWebContents::LoadNetworkResource(DispatchCallback callback,
|
|||
resource_request.site_for_cookies = net::SiteForCookies::FromUrl(gurl);
|
||||
resource_request.headers.AddHeadersFromString(headers);
|
||||
|
||||
auto* protocol_registry = ProtocolRegistry::FromBrowserContext(
|
||||
GetDevToolsWebContents()->GetBrowserContext());
|
||||
NetworkResourceLoader::URLLoaderFactoryHolder url_loader_factory;
|
||||
if (gurl.SchemeIsFile()) {
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_remote =
|
||||
content::CreateFileURLLoaderFactory(
|
||||
base::FilePath() /* profile_path */,
|
||||
nullptr /* shared_cors_origin_access_list */);
|
||||
AsarURLLoaderFactory::Create();
|
||||
url_loader_factory = network::SharedURLLoaderFactory::Create(
|
||||
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
|
||||
std::move(pending_remote)));
|
||||
} else if (protocol_registry->IsProtocolRegistered(gurl.scheme())) {
|
||||
auto& protocol_handler = protocol_registry->handlers().at(gurl.scheme());
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_remote =
|
||||
ElectronURLLoaderFactory::Create(protocol_handler.first,
|
||||
protocol_handler.second);
|
||||
url_loader_factory = network::SharedURLLoaderFactory::Create(
|
||||
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
|
||||
std::move(pending_remote)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue