fix: crash in webRequest due to unsafe static_cast
upstream was changed to wrap the network delegate see https://chromium.googlesource.com/chromium/src/+/69.0.3497.106/services/network/network_context.cc#948
This commit is contained in:
		
					parent
					
						
							
								e548ed1a6e
							
						
					
				
			
			
				commit
				
					
						a71755e1b6
					
				
			
		
					 3 changed files with 9 additions and 5 deletions
				
			
		|  | @ -49,11 +49,9 @@ void CallNetworkDelegateMethod( | ||||||
|     URLPatterns patterns, |     URLPatterns patterns, | ||||||
|     Listener listener) { |     Listener listener) { | ||||||
|   // Force creating network delegate.
 |   // Force creating network delegate.
 | ||||||
|   net::URLRequestContext* context = |  | ||||||
|   url_request_context_getter->GetURLRequestContext(); |   url_request_context_getter->GetURLRequestContext(); | ||||||
|   // Then call the method.
 |   // Then call the method.
 | ||||||
|   AtomNetworkDelegate* network_delegate = |   auto* network_delegate = url_request_context_getter->network_delegate(); | ||||||
|       static_cast<AtomNetworkDelegate*>(context->network_delegate()); |  | ||||||
|   (network_delegate->*method)(type, std::move(patterns), std::move(listener)); |   (network_delegate->*method)(type, std::move(patterns), std::move(listener)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -313,7 +313,9 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { | ||||||
|   if (!url_request_context_) { |   if (!url_request_context_) { | ||||||
|     std::unique_ptr<network::URLRequestContextBuilderMojo> builder = |     std::unique_ptr<network::URLRequestContextBuilderMojo> builder = | ||||||
|         std::make_unique<network::URLRequestContextBuilderMojo>(); |         std::make_unique<network::URLRequestContextBuilderMojo>(); | ||||||
|     builder->set_network_delegate(std::make_unique<AtomNetworkDelegate>()); |     auto network_delegate = std::make_unique<AtomNetworkDelegate>(); | ||||||
|  |     network_delegate_ = network_delegate.get(); | ||||||
|  |     builder->set_network_delegate(std::move(network_delegate)); | ||||||
| 
 | 
 | ||||||
|     ct_delegate_.reset(new brightray::RequireCTDelegate); |     ct_delegate_.reset(new brightray::RequireCTDelegate); | ||||||
|     auto cert_verifier = std::make_unique<AtomCertVerifier>(ct_delegate_.get()); |     auto cert_verifier = std::make_unique<AtomCertVerifier>(ct_delegate_.get()); | ||||||
|  |  | ||||||
|  | @ -26,6 +26,7 @@ class RequireCTDelegate; | ||||||
| namespace atom { | namespace atom { | ||||||
| 
 | 
 | ||||||
| class AtomBrowserContext; | class AtomBrowserContext; | ||||||
|  | class AtomNetworkDelegate; | ||||||
| class AtomURLRequestJobFactory; | class AtomURLRequestJobFactory; | ||||||
| class ResourceContext; | class ResourceContext; | ||||||
| 
 | 
 | ||||||
|  | @ -44,6 +45,8 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { | ||||||
|     return top_job_factory_.get(); |     return top_job_factory_.get(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   AtomNetworkDelegate* network_delegate() const { return network_delegate_; } | ||||||
|  | 
 | ||||||
|  private: |  private: | ||||||
|   friend class AtomBrowserContext; |   friend class AtomBrowserContext; | ||||||
| 
 | 
 | ||||||
|  | @ -99,6 +102,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { | ||||||
| 
 | 
 | ||||||
|   URLRequestContextGetter::Handle* context_handle_; |   URLRequestContextGetter::Handle* context_handle_; | ||||||
|   net::URLRequestContext* url_request_context_; |   net::URLRequestContext* url_request_context_; | ||||||
|  |   AtomNetworkDelegate* network_delegate_; | ||||||
|   content::ProtocolHandlerMap protocol_handlers_; |   content::ProtocolHandlerMap protocol_handlers_; | ||||||
|   content::URLRequestInterceptorScopedVector protocol_interceptors_; |   content::URLRequestInterceptorScopedVector protocol_interceptors_; | ||||||
|   bool context_shutting_down_; |   bool context_shutting_down_; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jeremy Apthorp
				Jeremy Apthorp