cztomczak / cefpython

Python bindings for the Chromium Embedded Framework (CEF)
Other
3.08k stars 473 forks source link

Breaking changes on Mac in v70+ #440

Open cztomczak opened 6 years ago

cztomczak commented 6 years ago

There are a few breaking changes on Mac in v70. There are also several issues reported on CEF Forums with latest CEF and Mojave update for Mac, so it needs to be thoroughly tested on the latest Mac OS.

It is required to change the way CEF library is loaded on Mac. See the changes to sandbox in upstream CEF issue: https://bitbucket.org/chromiumembedded/cef/issues/2459/macos-enable-the-macv2sandbox

See references to CefScopedLibraryLoader in upstream CEF source codes: https://github.com/chromiumembedded/cef/search?utf8=%E2%9C%93&q=CefScopedLibraryLoader&type=

See also Issue #448 ("Chromium v68 (branch 3440) no longer supports Mac 10.9 Mavericks").

cztomczak commented 5 years ago

Main app entry-point new code before CefMainArgs init or any other CEF code:

  // Load the CEF framework library at runtime instead of linking directly
  // as required by the macOS sandbox implementation.
  CefScopedLibraryLoader library_loader;
  if (!library_loader.LoadInMain())
    return 1;

New code in Sub-process application entry-point function:

  // Initialize the macOS sandbox for this helper process.
  CefScopedSandboxContext sandbox_context;
  if (!sandbox_context.Initialize(argc, argv))
    return 1;

  // Load the CEF framework library at runtime instead of linking directly
  // as required by the macOS sandbox implementation.
  CefScopedLibraryLoader library_loader;
  if (!library_loader.LoadInHelper())
    return 1;
cztomczak commented 5 years ago

Info from cef-announce group.

[cef-announce] Framework linking and loading changes on macOS starting with 3538 branch.

CEF framework linking and loading on macOS has changed starting with 3538 branch as described below. These changes are necessary to support Chromium's V2 sandbox and must be made irrespective of whether the sandbox is enabled in your application.

The changes can be summarized as follows:

Examples of the necessary changes to client applications can be found here and here. For complete background and details see this issue.

To verify that the V2 sandbox is enabled you can look for the --seatbelt-client=[id] flag passed to the renderer process (using ps -ax | grep cefclient, for example).