Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS Js extension doesn't work in multiprocess mode #499

Closed
bamsey2k1 opened this issue Feb 2, 2024 · 4 comments
Closed

MacOS Js extension doesn't work in multiprocess mode #499

bamsey2k1 opened this issue Feb 2, 2024 · 4 comments

Comments

@bamsey2k1
Copy link

bamsey2k1 commented Feb 2, 2024

Greetings :)
I have wrote platform app based on CEF4Delphi and I've noticed an issue on MacOS platform.

JS Extension doesn't work when property
GlobalCEFApp.SingleProcess := False;

it is working when
GlobalCEFApp.SingleProcess := True.

My extension is like below:

TempExtensionCode := 'var ui;' +
'if (!ui)' +
' ui = {};' +
'(function() {';
(... some functions ... );
TempExtensionCode :=
TempExtensionCode + '})();';

Extension is working in each case on Windows.

There is minor problem with resizing DevTools (Align := alRight) using splitter, it's not anchoring to the right side of the form.
Zrzut ekranu 2024-02-2 o 07 42 42

Tested on latest stable release:
https://github.com/salvadordf/CEF4Delphi/releases/tag/120.0.6099.234

@salvadordf
Copy link
Owner

Are you using Delphi or Lazarus?

MacOS has several projects and the JS extension runs in the render process. Move the code in GlobalCEFApp.OnWebKitInitialized to the render project.

I would recommend creating a Windows demo with a different executable for the CEF subprocesses. Move the GlobalCEFApp.OnWebKitInitialized code to the subprocess project and check if it works in Windows.

@bamsey2k1
Copy link
Author

I'm using Lazarus which is installed on Mac. I've modified ExternalPumpBrowser demo to show You how I made it.
ExternalPumpBrowser.zip

In this example You will find both inconveniences I've mentioned above.

@salvadordf
Copy link
Owner

I just uploaded a new demo called JSExtensionSubProcess.

It has a JSExtension_sp project that creates the executable for the CEF subprocesses and I moved all the code from GlobalCEFApp.OnWebKitInitialized to that project.

In the case of MacOS, you should move the code in GlobalCEFApp.OnWebKitInitialized to the AppHelper project.

Also try calling Chromium1.ShowDevTools with a nil value for the aDevTools parameter. This will create the devtools in a new window handled by CEF.

@bamsey2k1
Copy link
Author

bamsey2k1 commented Mar 6, 2024

So I have moved GlobalCEFApp.OnWebKitInitialized to AppHelper and it worked :)
ShowDevTools with a nil value also worked which is fine, but shame it doesn't work like on Windows.
Nevertheless thank for help in solving my issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants