fix: add handling for non-absolute extension paths (#25068)

This commit is contained in:
Samuel Attard 2020-08-20 20:47:10 -07:00 committed by GitHub
parent 42409d860b
commit 26f28b6ae4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -684,6 +684,13 @@ v8::Local<v8::Promise> Session::LoadExtension(
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
gin_helper::Promise<const extensions::Extension*> promise(isolate);
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()) {
promise.RejectWithErrorMessage(
"Extensions cannot be loaded in a temporary session");