GithubHelp home page GithubHelp logo

lvsti / cef.swift Goto Github PK

View Code? Open in Web Editor NEW
89.0 7.0 29.0 1.9 MB

Swift bindings for the Chromium Embedded Framework

License: BSD 3-Clause "New" or "Revised" License

Swift 86.71% Python 12.84% Objective-C 0.07% Shell 0.28% C 0.10%
cef swift chromium-embedded-framework chromiumembedded

cef.swift's People

Contributors

jansauer avatar lvsti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cef.swift's Issues

Code signature invalid

Hi,
I try to code sign CEFDemo with a developer ID.
On a macOS 10.11 no problem, but on 10.12 the app crash.

Error message :

Termination Reason: DYLD, [0x5] Code Signature

Dyld Error Message:
Library not loaded: @rpath/CEFswift.framework/Versions/A/CEFswift
Referenced from: /Users/USER/Desktop/*/CEFDemo.app/Contents/MacOS/CEFDemo
Reason: no suitable image found. Did find:

XXX/CEFDemo.app/Contents/MacOS/../Frameworks/CEFswift.framework/Versions/A/CEFswift: code signature invalid for 'XXX/CEFDemo.app/Contents/MacOS/../Frameworks/CEFswift.framework/Versions/A/CEFswift'

Binary Images:
0x100e67000 - 0x100e71fff +xx.xxx.cef.demo (1.0 - 1) <2274C00E-C137-374F-93E3-A4B9410D9895> /Users/USER/Desktop/*/CEFDemo.app/Contents/MacOS/CEFDemo
0x10dedd000 - 0x10df1adc7 dyld (433.5) <8239D0D7-66F6-3C44-A77F-586F74525DA3> /usr/lib/dyld

Have you ever tried to code sign this app ?

thanks

Support Mac sandbox v2 (branch 3538 and above)

Branch 3538 (based on Chromium 70) changed the way helper processes are sandboxed, basically by eliminating the unsandboxed warmup phase (spanning from when the dynamic linker has loaded CEFswift/CEF up to the point CEFExecuteProcess was invoked). This will affect considerably how CEFswift may be used in the helper process, and I haven't yet figured out the answer.

To keep up with the builds, I decided to release 3538 half-baked. What this means to you as a CEF.swift end-user:

  • if you like to live dangerously, pass --disable-features=MacV2Sandbox to the browser process in the command line (note: it won't work forever) and keep using the helpers as before (see main.swift in CEFDemo for an example)
  • otherwise, for now you can either:
    • use (and optionally extend) the updated C/C++ helpers (I know, I know)
    • stay on branch 3497 that still uses the old sandboxing model

In the meantime, I'll try to come up with a definitive solution.

More info:

How to turn on Widevine?

I want to know how to open Widevine, I called registerWidevineCDM before initializeMain and returned CEF_CDM_REGISTRATION_ERROR_NONE, but when I tested it at https://bitmovin.com/demos/drm it showed that Widevine is not turned on, I need some help, thank you very much.

Build CEF binary with flags

@diederikh can you please explain how to put the new CEF binary into project ? I am stuck in this from few hours basically I had successfully made new binary with following flags
ffmpeg_branding=Chrome
proprietary_codecs=true

When I replaced the binary in External/cef_binary with new one its throwing error that
error: install_name_tool: can't open file: External/cef_binary/Debug/Chromium Embedded Framework.framework/Chromium Embedded Framework (No such file or directory)

Its the structure of new binary
image

Originally posted by @IdleJatt in #15 (comment)

SeatbeltExecServer: Failed to initialize sandbox: -1 Operation not permitted

I've copied over the C & swift app helpers into my own app -- but I keep running into:
SeatbeltExecServer: Failed to initialize sandbox: -1 Operation not permitted when I call

void* sandboxContext = cef_sandbox_initialize(argc, argv);

This is working for me in the demo, so I'm wondering if it might have to do with some linker flags or framework setup issues.

Also, what is the difference between all the different helpers? I notice that some of them are compiled as C only, and some of them (like the renderer) are using SwiftHelper.

I know that CEF automatically looks for the helper app at Frameworks/{$PROJECT_NAME} Helper.app (unless you change CEFSettings.browserSubprocessPath). Is it doing some magic to choose each helper (i.e. CEFDemo Helper (GPU)) based on their name? Are all of them needed?

Try to load local file with Request Interception

Hi,
I try to load a local html file with Request Interception but the browser remains desperately empty.

I have created a CEFRequestHandler :

class TestRequestHandler: CEFRequestHandler {
    func onGetResourceRequestHandler(browser: CEFBrowser, frame: CEFFrame, request: CEFRequest, isNavigation: Bool, isDownload: Bool, initiator: String, disableDefault: inout Bool) -> CEFResourceRequestHandler? {
        disableDefault = true
        return TestResourceRequestHandler()
    }
}

a CEFResourceRequestHandler :

class TestResourceRequestHandler: CEFResourceRequestHandler {
    func cookieAccessFilter(browser: CEFBrowser?, frame: CEFFrame?, request: CEFRequest) -> CEFCookieAccessFilter? {
        return nil
    }
    
    func resourceHandler(browser: CEFBrowser?, frame: CEFFrame?, request: CEFRequest) -> CEFResourceHandler? {
        return TestResourceHandler()
    }

    func onResourceLoadComplete(browser: CEFBrowser?, frame: CEFFrame?, request: CEFRequest, response: CEFResponse, status: CEFURLRequestStatus, contentLength: Int64) {
        print("Load Complete")
    }
}

and a CEFResourceHandler :

class TestResourceHandler: CEFResourceHandler {
    var fileData:Data?
    var bytesDone:Int = 0
    
    func onOpenResponseStream(request: CEFRequest, callback: CEFCallback) -> CEFOnOpenResponseStreamAction {
        let fileManager = FileManager.default
        var filePath = Bundle.main.resourcePath!
        let url = request.url!.absoluteString
        let index = url.index(url.startIndex, offsetBy: "http://localhost".characters.count)
        
        filePath += url.substring(from:index)
        if fileManager.fileExists(atPath: filePath) {
            // Open the file
            let file = FileHandle(forReadingAtPath: filePath)
            fileData = file?.readDataToEndOfFile()
            // Close the file
            file?.closeFile()
        } else {
            print("File not found : " + filePath)
        }
        return .handle
    }

    
    func onGetResponseHeaders(response: CEFResponse) -> CEFOnGetResponseHeadersAction {
        if fileData != nil{
            response.status = 200;
            response.statusText = "OK";
            return .continueWithResponseLength(UInt64(fileData!.count))
        }
        return .abort
    }

    
    func onReadResponseData(buffer: UnsafeMutableRawPointer, bufferLength: Int, callback: CEFResourceReadCallback) -> CEFOnReadResponseDataAction {
        let nsData = fileData! as NSData
        let chunkSize = min(fileData!.count - bytesDone, bufferLength)
        if (chunkSize <= 0){
            return .complete
        }
        buffer.copyMemory(from: nsData.bytes.advanced(by: bytesDone), byteCount: chunkSize)
        bytesDone += chunkSize
        return .read(chunkSize)
    }
    
}

The onResourceLoadComplete is called but nothing is displayed.

I probably forgot something but what ? Do you have a sample code with request interception ?

Thank you in advance

CEFswift cannot be distributed as a self-contained framework

Currently, CEFswift is using a module map to access Chromium Embedded framework itself, but that module map is not included in CEFswift.framework. If any user wants to use compiled CEFswift.framework directly, s/he will probably meet such error

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/CEFswift.h"
        ^
~/playground/CEF.swift/Samples/CEFDemo/Library/Release/CEFswift.framework/Headers/CEFswift.h:19:9: error: module 'ChromiumEmbedded' not found
@import ChromiumEmbedded;
        ^
<unknown>:0: error: could not build Objective-C module 'CEFswift'

To reproduce this error, just compile CEFswift and remove the modules folder in CEFswift's source code, then compile the sample project.

I'm not sure if it's a common practice to include multiple module map into one single framework, or should we just define both CEFswift and ChromiumEmbedded in the same module map for CEFswift.framework itself? Anyway, I guess the compiled framework shouldn't rely on any source code.

Convert CEFTypes to CEFBinaryValue

So I'm working on multi process mode. I want to send some object (CEFV8Exception, CEFV8StackTrace ... ) directly from Render Process to Browser Process via sendProcessMessage

Is it possible to convert CEFV8Exception to CEFBinaryValue and back?
I guess it's not possible or at least not reliable. Because we don't know if the CEFV8Exception contains all the data in its memory block, or have some pointer pointing to other memory region in the Render Process.

CEFDemo outdated

func doClose(browser: CEFBrowser) -> Bool to be replaced with

func onDoClose(browser: CEFBrowser) -> CEFOnDoCloseAction {
...
return CEFOnDoCloseAction.allow
}

HTML5 video does not play in demo app

When I load a web page with a <video> (e.g. loading the http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4 sample video) the video does not load and the framework gives the following error:

[0503/135638.460276:ERROR:render_media_log.cc(30)] MediaEvent: MEDIA_ERROR_LOG_ENTRY {"error":"FFmpegDemuxer: open context failed"}
[0503/135638.461050:ERROR:render_media_log.cc(30)] MediaEvent: PIPELINE_ERROR demuxer: could not open

While the same HTML page plays in Chrome.

How to build?

I've tried "The easy way" with carthage and "The oldschool way" with setup.sh and I'm unable to build this. Mac OS 10.12.6 Xcode 8.3.3

I'm excited to use this repo, but I'm a little new to Xcode, thank you! ๐Ÿ’ซ

Carthage:

$ carthage update
*** Fetching CEF.swift
*** Checking out CEF.swift at "394a73be54e67fe3f940ba161dd21c501dced756"
*** xcodebuild output can be found in /var/folders/5k/4vq3cwgd0_95wnn91bn_15n80000gn/T/carthage-xcodebuild.WJrjb3.log
*** Building scheme "CEF.swift" in CEF.swift.xcodeproj
Build Failed
	Task failed with exit code 65:
	/usr/bin/xcrun xcodebuild -project /Users/andys/CEF.swift/Carthage/Checkouts/CEF.swift/CEF.swift.xcodeproj -scheme CEF.swift -configuration Release -derivedDataPath /Users/andys/Library/Caches/org.carthage.CarthageKit/DerivedData/CEF.swift/394a73be54e67fe3f940ba161dd21c501dced756 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build (launched in /Users/andys/CEF.swift/Carthage/Checkouts/CEF.swift)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/5k/4vq3cwgd0_95wnn91bn_15n80000gn/T/carthage-xcodebuild.WJrjb3.log

scripts/setup.sh

$ sudo scripts/setup.sh
Password:
+ '[' '' = true ']'
++ git rev-parse --abbrev-ref HEAD
+ BRANCH=cef_3071
+ '[' cef '!=' cef ']'
+ CEF_BRANCH=3071
++ which 7z
+ '[' -z /usr/local/bin/7z ']'
++ which jq
+ '[' -z /usr/local/bin/jq ']'
++ which cmake
+ '[' -z /usr/local/bin/cmake ']'
+ echo 'Fetching binary distribution...'
Fetching binary distribution...
++ curl http://opensource.spotify.com/cefbuilds/index.html
++ scripts/cefbuilds_spotify.py -x --platforms=macosx64 --branches=3071 -
++ jq '."macosx64"."3071"'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Traceback (most recent call last):
  File "scripts/cefbuilds_spotify.py", line 9, in <module>
    from lxml import html
ImportError: No module named lxml
  4 1623k    4 82536    0     0  1587k      0  0:00:01 --:--:--  0:00:01 1612k
curl: (23) Failed writing body (0 != 1448)
+ CEFBUILD_DESCRIPTOR=
++ echo
++ jq .dists.standard
++ tr -d '"'
+ CEFBUILD_URL=
++ echo
++ jq .delta
++ tr -d '"'
+ CEFBUILD_VERSION=3071.
++ mktemp -d /tmp/cefbuild.XXX
+ CEFBUILD_TEMP=/tmp/cefbuild.Rhv
+ CEFBUILD_TEMP_PATH=/tmp/cefbuild.Rhv/3071..tar.bz2
+ curl '' -k -o /tmp/cefbuild.Rhv/3071..tar.bz2
curl: (3) <url> malformed
+ echo 'Extracting package...'
Extracting package...
+ mkdir -p External
+ tar xzf /tmp/cefbuild.Rhv/3071..tar.bz2 -C External
tar: Error opening archive: Failed to open '/tmp/cefbuild.Rhv/3071..tar.bz2'
++ tar -tzf /tmp/cefbuild.Rhv/3071..tar.bz2
++ head -1
++ tr -d /
tar: Error opening archive: Failed to open '/tmp/cefbuild.Rhv/3071..tar.bz2'
+ CEFBUILD_DIR_NAME=
+ rm -rf /tmp/cefbuild.Rhv
+ '[' -e External/cef_binary ']'
+ ln -s '' External/cef_binary
ln: External/cef_binary: Invalid argument
+ pushd .
~/CEF.swift ~/CEF.swift
+ cd External/cef_binary
scripts/setup.sh: line 64: cd: External/cef_binary: No such file or directory
+ cmake -G Xcode
CMake Error: The source directory "/Users/andys/CEF.swift" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
+ set -o pipefail
+ xcodebuild clean build -project cef.xcodeproj -target 'cefsimple Helper' -arch x86_64 -configuration Debug
+ xcpretty -c
scripts/setup.sh: line 66: xcpretty: command not found
xcodebuild: error: 'cef.xcodeproj' does not exist.
+ set -o pipefail
+ xcodebuild clean build -project cef.xcodeproj -target 'cefsimple Helper' -arch x86_64 -configuration Release
+ xcpretty -c
scripts/setup.sh: line 67: xcpretty: command not found
xcodebuild: error: 'cef.xcodeproj' does not exist.
+ popd
~/CEF.swift

Not compiling

Building external dependencies
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
Command /bin/sh failed with exit code 128

Exception occur when getting stringValue from an empty-string CEFV8Value

Branch: 3239

How to reproduce:

let val = CEFV8Value.createString("")
print(val.stringValue)

Then a exception Chrome_InProcRendererThread (34): EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) is throw.

Currently there's no way to examine if the val is empty string or not, so I don't know how to avoid this.

Error from Carthage

*** Checking out CEF.swift at "33591af94c07ce8849611e0eb63628cb2940f2a3"
*** xcodebuild output can be found in /var/folders/ff/n72h5rqx61lcsld8xyq60n640000gn/T/carthage-xcodebuild.1rC86w.log
*** Building scheme "CEF.swift" in CEF.swift.xcodeproj
Build Failed
Task failed with exit code 65:
/usr/bin/xcrun xcodebuild -project /Users/vozyesmc/Documents/Cef\ test/Carthage/Checkouts/CEF.swift/CEF.swift.xcodeproj -scheme CEF.swift -configuration Release -derivedDataPath /Users/vozyesmc/Library/Caches/org.carthage.CarthageKit/DerivedData/9.4.1_9F2000/CEF.swift/33591af94c07ce8849611e0eb63628cb2940f2a3 ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/ff/n72h5rqx61lcsld8xyq60n640000gn/T/CEF.swift SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/vozyesmc/Documents/Cef test/Carthage/Checkouts/CEF.swift)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/ff/n72h5rqx61lcsld8xyq60n640000gn/T/carthage-xcodebuild.1rC86w.log

License

Wondering what license this software is.

MIT? BSD?

I'd like to use it as a dependency in one of my projects.
Thanks!
Romi

CEFRenderProcessHandler.onContextCreated not called when using multi-process mode

In my app, I wrote something like this:

class CustomCEFApp: CEFApp, CEFRenderProcessHandler {
  var renderProcessHandler: CEFRenderProcessHandler? { return self }
  func onContextCreated(browser: CEFBrowser, frame: CEFFrame, context: CEFV8Context) {
     print("ContextCreated")
  }
}

var settings = CEFSettings()
settings.useSingleProcess = true

_ = CEFProcessUtils.initializeMain(
  with: CEFMainArgs(arguments: CommandLine.arguments),
  settings: settings,
  app: CustomCEFApp()
)

ContextCreated will be printed.
However, if I set useSingleProcess to false, ContextCreated will not be printed.

I guess I might need to implement some logic in the helper app, but I'm not sure how.
Please shed some light on how to use multi-process mode. Many thanks~

Atomic ref count

While pthread works, using atomics would be better.(not an issue but a todo)

SOCKS5 Proxy

I am trying to configure SOCKS proxy as CommandLineArg but doesn't work

cmdLine?.appendArgument("--proxy-server=socks://127.0.0.1:4799")

Eliminate pointer magic

The current marshalling implementation relies on a dangerous assumption about class memory layout (see CEFMarshaller.swift), which can break without notice from one Swift version to another. This logic should be replaced with an ABI-agnostic solution ASAP, preferably without sacrificing performance.

onBeforeClose not called?

I don't manage to have CEFLifeSpanHandler.onBeforeClose(browser: CEFBrowser) triggered after windowShouldClose(_ sender: NSWindow) returns true and the window is destroyed. (browser's view being child of a view in the window of the app in my test sample, i.e. the window is not created by CEF)

Unable to Read Post Data

Hi,

I try to read post data on a request (done by the web part). I see post data with the dev tools, but in the code, I have always the elements list empty (whereas elementCount = 1) :

if request.postData != nil && request.postData!.elementCount == 1{
            let elements = request.postData!.elements
            print ("----> element.count : \(elements!.count) ---- elementCount : \(request.postData!.elementCount)  ---  \(request.postData!.hasExcludedElements)" )
}

Trace :
----> element.count : 0 ---- elementCount : 1 --- false

Version used : 2924

Have you also the same problem ?

Thanks, regards

Cef-Swift project setup up issue script is not working

I am new in Mac OS development and also new for using cefSwift. I am following this repository https://github.com/lvsti/CEF.swift and after doing step by step guide as mention in project I am stuck at one point when I run script it gives me error as seen in the screen shot.I am using branch 3497. But this same error occur when i switch to others branch too.

image

I have done all the steps right and install each and everything mention in repository. Anyone help me out so I can compile the sample project given in this repo project.

CEFResourceHandler does not seem to work as expected

Hi,
I have a problem with CEFResourceHandler in branch cef_4280.
The bufferLength parameter is not set correctly for onReadResponseData.

class TestResourceHandler: CEFResourceHandler {
var fileData:Data?
var bytesDone:Int = 0

func onOpenResponseStream(request: CEFRequest, callback: CEFCallback) -> CEFOnOpenResponseStreamAction {
    let fileManager = FileManager.default
    var filePath = Bundle.main.resourcePath!
    let url = request.url!.absoluteString
    let index = url.index(url.startIndex, offsetBy: "http://localhost".characters.count)
    
    filePath += url.substring(from:index)
    if fileManager.fileExists(atPath: filePath) {
        // Open the file
        let file = FileHandle(forReadingAtPath: filePath)
        fileData = file?.readDataToEndOfFile()
        // Close the file
        file?.closeFile()
    } else {
        print("File not found : " + filePath)
    }
    return .handle
}


func onGetResponseHeaders(response: CEFResponse) -> CEFOnGetResponseHeadersAction {
    if fileData != nil{
        response.status = 200;
        response.statusText = "OK";
        return .continueWithResponseLength(UInt64(fileData!.count)) // Here value = 96
    }
    return .abort
}


func onReadResponseData(buffer: UnsafeMutableRawPointer, bufferLength: Int, callback: CEFResourceReadCallback) -> CEFOnReadResponseDataAction {
   // Here bufferLength = 65536 expected -> 96
    let nsData = fileData! as NSData
    buffer.copyMemory(from: nsData.bytes.advanced(by: bytesDone), byteCount: bufferLength)
    bytesDone += bufferLength
    if bytesDone == UInt64(fileData!.count) {
        return .complete
    } else {
        return .read(bufferLength)
    }
}

}

Did I forget something? Do you have an example of use?

Thanks

Setting status code on CEFResourceHandler fails : status remains at 0

Hi,

I try to use CEF.swift (thanks for your nice work), but I have a problem.
I use the project CEFDemo, and I want to use my own ResourceHandler. So I create this one :

class XXXResourceHandler: CEFResourceHandler{
    func onProcessRequest(request: CEFRequest, callback: CEFCallback) -> CEFOnProcessRequestAction{
        print("XXXResourceHandler : onProcessRequest")
        callback.doContinue()
        return .allow
    }
    
    func onGetResponseHeaders(response: CEFResponse) -> CEFOnGetResponseHeadersAction {
        print("XXXResourceHandler : onGetResponseHeaders")
        response.status = 404
        response.statusText = "Not Found"
        print ("status after : " + String(response.status));
        print ("status text after : " + String(response.statusText));
        response.mimeType = "text/html"
        return .continueWithResponseLength(0)
    }
    
    func onReadResponse(buffer: UnsafeMutableRawPointer,bufferLength: Int, callback: CEFCallback) -> CEFOnReadResponseAction{
        print("XXXResourceHandler : onReadResponse")
        
        return .read(0)
    }
}

And on the response (CEFResponse), the value of the status doesn't change, only the statusText works :

XXXResourceHandler : onProcessRequest
XXXResourceHandler : onGetResponseHeaders
status after : 0
status text after : Not Found

I tried with other status code value, it never works (and I see never the good status in chromium Dev Tools).
I tried with branch 2987, 2924 and 2743 : same problem.
OS : MacOS 10.11

Do you see any mistake ?

Thanks for your help,
Regards

Started start at https domains other than .com

Is there a setting for acceptable domains that do not end with .com?

If I start a new app pointing to .io or .me over https:// I get an SSL error (white screen)

If I go to google.com, I am able to surf to an https:// website ending in .io or .me

Thank you for your time!

Mac OS X 10.9 Support

Hi,
I would like to use CEF.swift in a project, where I have to support Mac OS X 10.9.
Do you see any Issues with changing the deployment target of CEF.swift?
I tried to run the sample App on 10.9 and it worked fine.
The cef framework supports 10.9 as well.

in CEFRequestHandler

  1. onAuthCredentialsRequired has different signature in extension.

  2. /// CEF name: GetResourceHandler
    func resourceHandlerForBrowser(browser: CEFBrowser ...
    Not an issue, just odd naming IMHO.

How to build CEFDemo? Got build error...

Xcode build error for CEFDemo (Xcode 12.0, Macos 10.15.6)
Log:
SwiftHelper
CEFDemo/main.swift:10:8: No such module 'CEFswift'

CEFDemo Helper (GPU)
library not found for -lCEFSandbox

Step I did.
1.git clone this project (Nov092020), switch to cef_4240, build pass CEF.swift from setup.sh in the command line.
2.build pass from CEF.swift Xcode project and got CEFswift.framework, libCEFSandbox.a in the products folder.
3.cd to the CEFDemo project folder, double click to open the CEFDemo Xcode project file, simply press build for CEFDemo.

Did I miss some steps to include the CEFswift and libCEFSandbox for the CEFDemo.app project on Xcode?
Thank you so much.

Can CEF.swift be embedded in UIKit/SwiftUI?

Hello, is it possible to embed CEF.swift in a UIKit/SwiftUI app? I looked at the demo code, but it looks like CEF creates its own window. I'm wondering if this can be a drop-in replacement for WKWebView. Thanks

Update CEF Demo to use multiple helper app bundles

Latest Cef Demo app fails to run after successful build.

[0428/182914.654404:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 1 time(s)
[0428/182914.656717:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 2 time(s)
[0428/182914.658700:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 3 time(s)
[0428/182914.660397:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 4 time(s)
[0428/182914.662200:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 5 time(s)
[0428/182914.664022:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 6 time(s)
[0428/182914.665793:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 7 time(s)
2020-04-28 18:29:15.967900+0530 CEFDemo[11374:84964] Metal API Validation Enabled
Unable to create basic Accelerated OpenGL renderer.
Unable to create basic Accelerated OpenGL renderer.
Core Image is now using the software OpenGL renderer. This will be slow.
[0428/182917.408874:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 8 time(s)
2020-04-28 18:29:18.369486+0530 CEFDemo[11374:84964] [logging-persist] cannot open file at line 43353 of [378230ae7f]
2020-04-28 18:29:18.369950+0530 CEFDemo[11374:84964] [logging-persist] os_unix.c:43353: (0) open(/var/db/DetachedSignatures) - Undefined error: 0
[0428/182918.874837:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 9 time(s)
[0428/182918.874942:FATAL:gpu_data_manager_impl_private.cc(986)] The display compositor is frequently crashing. Goodbye.

After searching online I found this forum link which mentions helper app bundles.

More information could be found on CefPython repo.

Can you please Update CEF.swift to use these helper bundles or provide a workaround.

Chromium Embedded Framework, libCEFSandbox.a are all required, correct?

I'm trying to add CEF into an existing project (that already has an AppDelegate, etc). Just looking at the CEFDemo project, it looks like I'll need to link against all three frameworks /libraries, right?

Carthage only builds the CEFSwift.framework (which is fine), I'm just trying to understand what pieces are needed as I migrate over the build environment.

BTW, thank you for all your work on this.

Following link with target=_blank crashes

I'm on build 3029. When I run CEF Demo and load a page with a link that has target=_blank set it crashes the app.

Try this with URL http://html.com/attributes/a-target/

cefsimple does open the page in a new window.

crashed thread:

Thread 15 Crashed:: Chrome_IOThread
0   me.cocoagrinder.CEF-swift     	0x00000001075cac86 _TTSf4n_d___TZFV8CEFswift13CEFWindowInfo7fromCEFfVSC18_cef_window_info_tS0_ + 278 (CEFString.swift:12)
1   me.cocoagrinder.CEF-swift     	0x00000001073aca76 _TF8CEFswift34CEFLifeSpanHandler_on_before_popupFT3ptrGSqGSpVSC24_cef_life_span_handler_t__7browserGSqGSpVSC14_cef_browser_t__5frameGSqGSpVSC12_cef_frame_t__3urlGSqGSPVSC19_cef_string_utf16_t__9frameNameGSqGSPS3___11dispositionVSC29cef_window_open_disposition_t11userGestureVs5Int328featuresGSqGSPVSC21_cef_popup_features_t__10windowInfoGSqGSpVSC18_cef_window_info_t__9cefClientGSqGSpGSqGSpVSC13_cef_client_t____11cefSettingsGSqGSpVSC23_cef_browser_settings_t__10noJSAccessGSqGSpS5____S5_ + 454
2   org.chromium.ContentShell.framework	0x000000010c07de6b CefLifeSpanHandlerCToCpp::OnBeforePopup(scoped_refptr<CefBrowser>, scoped_refptr<CefFrame>, CefStringBase<CefStringTraitsUTF16> const&, CefStringBase<CefStringTraitsUTF16> const&, cef_window_open_disposition_t, bool, CefStructBase<CefPopupFeaturesTraits> const&, CefWindowInfo&, scoped_refptr<CefClient>&, CefStructBase<CefBrowserSettingsTraits>&, bool*) + 795 (life_span_handler_ctocpp.cc:57)
3   org.chromium.ContentShell.framework	0x000000010da914c3 CefBrowserInfoManager::CanCreateWindow(GURL const&, content::Referrer const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, WindowOpenDisposition, blink::mojom::WindowFeatures const&, bool, bool, int, int, bool*) + 2323 (browser_info_manager.cc:213)
4   org.chromium.ContentShell.framework	0x000000010da9d0f9 CefContentBrowserClient::CanCreateWindow(int, int, GURL const&, GURL const&, GURL const&, content::mojom::WindowContainerType, GURL const&, content::Referrer const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, WindowOpenDisposition, blink::mojom::WindowFeatures const&, bool, bool, content::ResourceContext*, bool*) + 185 (content_browser_client.cc:860)
5   org.chromium.ContentShell.framework	0x000000010d3bab7a content::RenderMessageFilter::CreateNewWindow(mojo::StructPtr<content::mojom::CreateNewWindowParams>, base::Callback<void (mojo::InlinedStructPtr<content::mojom::CreateNewWindowReply>), (base::internal::CopyMode)1, (base::internal::RepeatMode)1> const&) + 794 (render_message_filter.cc:217)
6   org.chromium.ContentShell.framework	0x000000010cd76e34 content::mojom::RenderMessageFilterStubDispatch::AcceptWithResponder(content::mojom::RenderMessageFilter*, mojo::Message*, mojo::MessageReceiverWithStatus*) + 1988 (render_message_filter.mojom.cc:1212)
7   org.chromium.ContentShell.framework	0x000000010e7bdc83 mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message*) + 723
8   org.chromium.ContentShell.framework	0x000000010e7bd736 mojo::FilterChain::Accept(mojo::Message*) + 150 (filter_chain.cc:40)
9   org.chromium.ContentShell.framework	0x000000010e7bee55 mojo::InterfaceEndpointClient::HandleIncomingMessage(mojo::Message*) + 117 (interface_endpoint_client.cc:295)
10  org.chromium.ContentShell.framework	0x000000010e7a9f4e IPC::(anonymous namespace)::ChannelAssociatedGroupController::Accept(mojo::Message*) + 606 (ipc_mojo_bootstrap.cc:755)
11  org.chromium.ContentShell.framework	0x000000010e7bd736 mojo::FilterChain::Accept(mojo::Message*) + 150 (filter_chain.cc:40)
12  org.chromium.ContentShell.framework	0x000000010e7bbecb mojo::Connector::ReadSingleMessage(unsigned int*) + 123 (connector.cc:258)
13  org.chromium.ContentShell.framework	0x000000010e7bc2e1 mojo::Connector::OnHandleReadyInternal(unsigned int) + 177 (connector.cc:214)
14  org.chromium.ContentShell.framework	0x000000010e7d1be6 mojo::Watcher::OnHandleReady(unsigned int) + 278 (heap_profiler.h:54)
15  org.chromium.ContentShell.framework	0x000000010e7d1d0b void base::internal::FunctorTraits<void (mojo::Watcher::*)(unsigned int), void>::Invoke<base::WeakPtr<mojo::Watcher> const&, unsigned int const&>(void (mojo::Watcher::*)(unsigned int), base::WeakPtr<mojo::Watcher> const&&&, unsigned int const&&&) + 155 (bind_internal.h:215)
16  org.chromium.ContentShell.framework	0x000000010dd20075 base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*) + 309 (task_annotator.cc:59)
17  org.chromium.ContentShell.framework	0x000000010dd55179 base::MessageLoop::RunTask(base::PendingTask*) + 441 (message_loop.cc:421)
18  org.chromium.ContentShell.framework	0x000000010dd5553c base::MessageLoop::DeferOrRunPendingTask(base::PendingTask) + 44 (message_loop.cc:431)
19  org.chromium.ContentShell.framework	0x000000010dd559d3 base::MessageLoop::DoWork() + 483 (message_loop.cc:524)
20  org.chromium.ContentShell.framework	0x000000010dd59405 base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) + 245 (message_pump_libevent.cc:219)
21  org.chromium.ContentShell.framework	0x000000010dd54e3b base::MessageLoop::RunHandler() + 235 (message_loop.cc:385)
22  org.chromium.ContentShell.framework	0x000000010dd7e7c7 base::RunLoop::Run() + 151 (run_loop.cc:38)

Building fails using Carthage on macOS 10.15 and 11.0

I'm unable to build CEF.swift using Cartridge as it fails compiling at the steps below.
This is true for environments on both macOS 10.15 (Xcode 11.6) and macOS 11.0 (Xcode 12.0 beta 5).

The following build commands failed: CompileC /Users/[user]/Library/Caches/org.carthage.CarthageKit/DerivedData/11.6_11E708/CEF.swift/[id]/Build/Intermediates.noindex/ArchiveIntermediates/CEF.swift/IntermediateBuildFilesPath/CEF.swift.build/Release/CEFSandbox.build/Objects-normal/x86_64/cef_library_loader_mac.o /Users/[user]/[project]/Carthage/Checkouts/CEF.swift/External/cef_binary/libcef_dll/wrapper/cef_library_loader_mac.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler CompileC /Users/[user]/Library/Caches/org.carthage.CarthageKit/DerivedData/11.6_11E708/CEF.swift/[id]/Build/Intermediates.noindex/ArchiveIntermediates/CEF.swift/IntermediateBuildFilesPath/CEF.swift.build/Release/CEFSandbox.build/Objects-normal/x86_64/libcef_dll_dylib.o /Users/[user]/[project]/Carthage/Checkouts/CEF.swift/External/cef_binary/libcef_dll/wrapper/libcef_dll_dylib.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (2 failures)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.