Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

DevTools: Console Object Copy to Clipboard is disabled (due to unhandled exception)

Post Reply
jchoover
Posts: 14
Joined: Tue Apr 30, 2019 5:45 pm

DevTools: Console Object Copy to Clipboard is disabled (due to unhandled exception)

Post by jchoover »

Ref: https://github.com/salvadordf/CEF4Delphi/issues/461

The issue at hand is I've copied all the CEF related code into the MiniBrowser demo, and I can't reproduce the issue there.

I am at a loss as to what I could do on my end to cause the verbose logs to log:

[ERROR:CONSOLE(1)] "Uncaught (in promise) TypeError: Invalid resource type name "undefined"", source: devtools://devtools/panels/sources/sources.js (1)

On right click of the "i" icon. Also, why would this work if I enable the remote debugging port and launch a browser but not if I internally call ShowDevTools?

Currently using 111.0.5563.148.

Do you know where the dev tools sources are located? I ponder unpacking/repacking the resource, such that I could inject the non-minified versions so I could get a meaningful line number that might point me in a more productive direction.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: DevTools: Console Object Copy to Clipboard is disabled (due to unhandled exception)

Post by salvadordf »

Hi,

Perhaps some file from the CEF binaries is missing. Please, check that you see these files (except MiniBrowser.exe) :
Image
The "locales" directory should have 55 PAK files with language codes as names.

If you use a custom directory for the CEF binaries then check that the application sets these properties correctly :
  • GlobalCEFApp.FrameworkDirPath
  • GlobalCEFApp.ResourcesDirPath
  • GlobalCEFApp.LocalesDirPath
jchoover
Posts: 14
Joined: Tue Apr 30, 2019 5:45 pm

Re: DevTools: Console Object Copy to Clipboard is disabled (due to unhandled exception)

Post by jchoover »

I've pushed CEF to a cef sub folder, and in this case it's an exact copy and paste of my applications cef folder. I've also limited the locales to just one, but I have accounted for all this in the initialization.
jchoover
Posts: 14
Joined: Tue Apr 30, 2019 5:45 pm

Re: DevTools: Console Object Copy to Clipboard is disabled (due to unhandled exception)

Post by jchoover »

After further review, it isn't the right click on the Object that is broken, but rather the entire sources tab is dead. And every time one right clicks on an object in the console, something is trying to interact w/ the sources tab.
jchoover
Posts: 14
Joined: Tue Apr 30, 2019 5:45 pm

Re: DevTools: Console Object Copy to Clipboard is disabled (due to unhandled exception)

Post by jchoover »

Now I fee like an idiot. There was something wrong w/ my cache directory that was causing the problem. I renamed it so CEF created a new one, and now all is well.
jchoover
Posts: 14
Joined: Tue Apr 30, 2019 5:45 pm

Re: DevTools: Console Object Copy to Clipboard is disabled (due to unhandled exception)

Post by jchoover »

Ok, now for more feedback:

https://github.com/salvadordf/CEF4Delphi/issues/234

In the use case of

Code: Select all

GlobalCEFApp.SingleProcess := False;
GlobalCEFApp.BrowserSubprocessPath := 'SomeOther.exe';
CEF doesn't call OleUnintialize before creating

Code: Select all

TempApp := TCustomCefApp.Create(self);
in

Code: Select all

function TCefApplicationCore.MultiExeProcessing : boolean;
Which exhibits the same error as https://magpcss.org/ceforum/viewtopic.php?f=6&t=15526


Since CEF4DelphiVCLRTL.bpl depends on the RTL, which uses Vcl.Controls, the VCL inheriently spins up a TApplication, which calls OleInitialize.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: DevTools: Console Object Copy to Clipboard is disabled (due to unhandled exception)

Post by salvadordf »

Sorry for not answering all your issues sooner but I'm very busy these days.

I don't have much time right now to investigate your last message but it might be related to this old issue :
https://github.com/salvadordf/CEF4Delphi/issues/139
jchoover
Posts: 14
Joined: Tue Apr 30, 2019 5:45 pm

Re: DevTools: Console Object Copy to Clipboard is disabled (due to unhandled exception)

Post by jchoover »

The fix was to change the sub process to not reference uCEFApplication, and instead substitute uCEFApplicationCore / TCefApplicationCore.

No rush, I just went deep into the weeds and wanted to provide the feedback.

Would it be valid to ...

Code: Select all

function TCefApplicationCore.StartSubProcess : boolean;
var
  TempApp : ICefApp;
begin
  Result  := False;
  TempApp := nil;

  try
    try
      if not(FSingleProcess) and
         (ProcessType <> ptBrowser) and
         LoadCEFlibrary then
        begin

add this

Code: Select all

          if (FProcessType <> ptBrowser) then
            BeforeInitSubProcess;

Code: Select all

          TempApp := TCustomCefApp.Create(self);

          if (ExecuteProcess(TempApp) >= 0) then
            Result := True
           else
            TempApp.RemoveReferences;
        end;
    except
      on e : exception do
        if CustomExceptionHandler('TCefApplicationCore.StartSubProcess', e) then raise;
    end;
  finally
    TempApp := nil;
  end;
end;

That would allow for users who initialized a TCefApplication in the subprocess to presumeably inherit all the oter fixes that are in StartSubProcess.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: DevTools: Console Object Copy to Clipboard is disabled (due to unhandled exception)

Post by salvadordf »

The GlobalCEFApp.OnBrowserCreated event can be used to pass custom data from the main process to the render processes in the "extra_info" parameter.

You can also use a common unit to set the GlobalCEFApp properties between all the Chromium processes and you can send messages between the processes with custom information.

Additionally you can use databases, websockets or any other way to send information or IPC messages between the processes.

...or you can add your custom modifications to the CEF4Delphi code. This is an open source project! ;)
Post Reply