we are using the CEF framework on linux for many years now. The version we have used so far is cef-3.2785.1485. Due to availability/visualization problems with newer JS/CSS functions, we have to update to a newer CEF version.
We have seen that there are many, many changes in the new CEF-API and the used concepts. I know we should actually go through the changes between the different versions in order to see how the new concepts are. But we can't make that effort. We have adapted our code to the new API, in order to successfully compile it. But we consider some runtime problems.
1. We have used the CefFrame::LoadString method to make a screenshot of the visualized content. Our approach was to use a CefStringVisitor to get the visualized content in the current frame, and then create a separate OSR-Browser and load the string. The resulting screenshot was very close to the original.
Now, after the LoadString method has gone, we used the LoadURL method with an in-place url (using createDataURI from ceftests). Unfortunately the result is anything but close to the original and we don't know why.
We googled a bit and found a hint on the CDP which would enable us to get rid of the OSR approach. We have tried to use the Page.notifications to make a screenshot but without any luck. We are getting the error, that the requested methods can't be found.
The following code shows the output from the js console whithin chromium of our attempt to call a method over CDP within cefsimple (cef_binary_90.6.7+g19ba721+chromium-90.0.4430.212).
- Code: Select all
> var ws = new WebSocket("ws://127.0.0.1:9222/devtools/browser/d61e61a5-a45c-46aa-835d-77181fb1449c");
undefined
> ws.onmessage = function(m){console.log(m)};
ƒ (m){console.log(m)}
> ws.readyState
1
> ws.send(JSON.stringify({id:1,method:"Page.enable"}));
undefined
VM450:1 MessageEvent {isTrusted: true, data: "{"id":1,"error":{"code":-32601,"message":"'Page.enable' wasn't found"}}", origin: "ws://127.0.0.1:9222", lastEventId: "", source: null, …}
> ws.send(JSON.stringify({id:1,method:"Page.captureScreenshot"}));
undefined
VM450:1
MessageEvent {isTrusted: true, data: "{"id":1,"error":{"code":-32601,"message":"'Page.captureScreenshot' wasn't found"}}", origin: "ws://127.0.0.1:9222", lastEventId: "", source: null, …}
isTrusted: true
data: "{"id":1,"error":{"code":-32601,"message":"'Page.captureScreenshot' wasn't found"}}"
origin: "ws://127.0.0.1:9222"
lastEventId: ""
source: null
ports: []
userActivation: null
type: "message"
target: WebSocket {url: "ws://127.0.0.1:9222/devtools/browser/d61e61a5-a45c-46aa-835d-77181fb1449c", readyState: 1, bufferedAmount: 0, onopen: null, onerror: null, …}
currentTarget: WebSocket
url: "ws://127.0.0.1:9222/devtools/browser/d61e61a5-a45c-46aa-835d-77181fb1449c"
readyState: 1
bufferedAmount: 0
onopen: null
onerror: null
onclose: null
extensions: "permessage-deflate; client_max_window_bits=15"
protocol: ""
onmessage: ƒ (m)
binaryType: "blob"
__proto__: WebSocket
eventPhase: 0
bubbles: false
cancelable: false
defaultPrevented: false
composed: false
timeStamp: 316029.43000011146
srcElement: WebSocket {url: "ws://127.0.0.1:9222/devtools/browser/d61e61a5-a45c-46aa-835d-77181fb1449c", readyState: 1, bufferedAmount: 0, onopen: null, onerror: null, …}
returnValue: true
cancelBubble: false
path: []
__proto__: MessageEvent
Do you have any hints or ideas where the problem is?
2. We have our own certificate handling, with the ability to import a certificate into the nss database. To decide wether or not a certificate should be imported, we have used url schemes like "certificate_import://..." in combination with the LoadString method. Now when the in-place url is used instead, this is not going to work any longer.
Same here, do you have any hints or ideas how we can support the certificate handling with the new API?
Thanks in advance!