In JxBrowser 7.8 the Chromium engine has been upgraded to version 79. This Chromium version has several breaking changes in the source code that affect the public API of JxBrowser. In this migration guide we describe what API has been removed in 7.8 and what alternatives you should use instead.

Downloads

Accepting Download

v7.7.1

In order to accept a file download request the following callback is used:

Downloads downloads = engine.downloads();
downloads.set(StartDownloadCallback.class, (params, tell) -> tell.cancel());

v7.8

In 7.8 this functionality has been moved to Browser, so now you can accept a file download request for each Browser instance independently. For example:

browser.set(StartDownloadCallback.class, (params, tell) -> tell.cancel());

Network

Accessing Browser

v7.7.1

network.set(BeforeSendHeadersCallback.class, params -> {
    params.browser().ifPresent(browser -> {});
    ...
});

network.set(BeforeUrlRequestCallback.class, params -> {
    params.browser().ifPresent(browser -> {});
    ...
});

network.set(ReceiveHeadersCallback.class, params -> {
    params.browser().ifPresent(browser -> {});
    ...
});

v7.8

network.set(BeforeSendHeadersCallback.class, params -> {
    params.urlRequest().browser().ifPresent(browser -> {});
    ...
});

network.set(BeforeUrlRequestCallback.class, params -> {
    params.urlRequest().browser().ifPresent(browser -> {});
    ...
});

network.set(ReceiveHeadersCallback.class, params -> {
    params.urlRequest().browser().ifPresent(browser -> {});
    ...
});

BytesSent

v7.7.1

network.on(BytesSent.class, event -> {
    int bytesSentCount = event.count();
});

v7.8

network.on(RequestCompleted.class, event -> {
    long bytesSent = event.urlRequest().totalBytesSent();
});

BytesReceived

v7.7.1

network.on(BytesReceived.class, event -> {
    int bytesReceivedCount = event.count();
});

v7.8

network.on(RequestCompleted.class, event -> {
    long bytesReceived = event.urlRequest().totalBytesReceived();
});

Content

Taking Bitmap of a Web Page

The deprecated com.teamdev.jxbrowser.view.javafx.BitmapUtil and com.teamdev.jxbrowser.view.swing.BitmapUtil classes have been removed. Use the com.teamdev.jxbrowser.view.swing.graphics.BitmapImage and com.teamdev.jxbrowser.view.javafx.graphics.BitmapImage classes instead.

Removed API

The following classes and methods have been removed because the corresponding functionality in Chromium 79 does not exist anymore:

  • com.teamdev.jxbrowser.net.event.TransactionStarted
  • com.teamdev.jxbrowser.net.callback.CanAccessFileCallback.url()
  • com.teamdev.jxbrowser.browser.callback.CertificateErrorCallback.resourceType()
Go Top