fix: add handling for non-absolute extension paths (#25068)
This commit is contained in:
		
					parent
					
						
							
								42409d860b
							
						
					
				
			
			
				commit
				
					
						26f28b6ae4
					
				
			
		
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -684,6 +684,13 @@ v8::Local<v8::Promise> Session::LoadExtension(
 | 
				
			||||||
  v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
 | 
					  v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
 | 
				
			||||||
  gin_helper::Promise<const extensions::Extension*> promise(isolate);
 | 
					  gin_helper::Promise<const extensions::Extension*> promise(isolate);
 | 
				
			||||||
  v8::Local<v8::Promise> handle = promise.GetHandle();
 | 
					  v8::Local<v8::Promise> handle = promise.GetHandle();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!extension_path.IsAbsolute()) {
 | 
				
			||||||
 | 
					    promise.RejectWithErrorMessage(
 | 
				
			||||||
 | 
					        "The path to the extension in 'loadExtension' must be absolute");
 | 
				
			||||||
 | 
					    return handle;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (browser_context()->IsOffTheRecord()) {
 | 
					  if (browser_context()->IsOffTheRecord()) {
 | 
				
			||||||
    promise.RejectWithErrorMessage(
 | 
					    promise.RejectWithErrorMessage(
 | 
				
			||||||
        "Extensions cannot be loaded in a temporary session");
 | 
					        "Extensions cannot be loaded in a temporary session");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue