Page 1 of 1

LoadExtension always calls OnExtensionLoadFailed

PostPosted: Wed Jun 07, 2023 12:29 pm
by ndesktop
Environment: cefclient with --enable-chrome-runtime and --load-extension=<path to disk to existing Chrome extension>
Code: Select all
void CefBrowserContext::LoadExtension(
    const CefString& root_directory,
    CefRefPtr<CefDictionaryValue> manifest,
    CefRefPtr<CefExtensionHandler> handler,
    CefRefPtr<CefRequestContext> loader_context) {
  NOTIMPLEMENTED();
  if (handler) {
    handler->OnExtensionLoadFailed(ERR_ABORTED);
  }
}

It starts with NOTIMPLEMENTED, then calls OnExtensionLoadFailed - although it succeeds.
Is this behavior intentional? Or it might be an artifact from Alloy times :)

Re: LoadExtension always calls OnExtensionLoadFailed

PostPosted: Wed Jun 07, 2023 12:40 pm
by magreenblatt
The --load-extension flag is supported by Chrome, so the Alloy-specific implementation in cefclient should be disabled. You can add a new issue at https://github.com/chromiumembedded/cef/issues

Re: LoadExtension always calls OnExtensionLoadFailed

PostPosted: Wed Jun 07, 2023 12:47 pm
by ndesktop
So CefExtensionHandler implementation is unnecessary when --enable-chrome-runtime and --load-extension are present?
Edit: I still see that OnrequestContextInitialized is handling --load-extension and calls extension_util::LoadExtension.

Re: LoadExtension always calls OnExtensionLoadFailed

PostPosted: Wed Jun 07, 2023 12:52 pm
by ndesktop
magreenblatt wrote:The --load-extension flag is supported by Chrome, so the Alloy-specific implementation in cefclient should be disabled. You can add a new issue at https://github.com/chromiumembedded/cef/issues

So
Code: Select all
if (command_line->HasSwitch(switches::kLoadExtension)) {

changed in
Code: Select all
if (!command_line->HasSwitch(switches::kLoadExtension) && command_line->HasSwitch(switches::kLoadExtension)) {

or something like this would suffice?

Re: LoadExtension always calls OnExtensionLoadFailed

PostPosted: Wed Jun 07, 2023 12:57 pm
by magreenblatt
Bypass all usage of switches::kLoadExtension in cefclient when UseChromeRuntime() returns true.

Re: LoadExtension always calls OnExtensionLoadFailed

PostPosted: Mon Jun 12, 2023 3:25 am
by ndesktop
Done, filed issue 3529.

Re: LoadExtension always calls OnExtensionLoadFailed

PostPosted: Mon Jun 12, 2023 3:51 am
by magreenblatt
ndesktop wrote:Done, filed issue 3529.

Thanks.