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

Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
This commit is contained in:
trop[bot]
2020-08-21 12:34:22 -07:00
committed by GitHub
parent 9193d35769
commit 50046f8df6

View File

@@ -683,6 +683,13 @@ v8::Local<v8::Promise> Session::LoadExtension(
v8::Isolate* isolate = v8::Isolate::GetCurrent();
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");