Commit Graph

2151 Commits

Author SHA1 Message Date
Marshall Greenblatt 81064faac3 Fix crash in ProxyURLLoaderFactory::MaybeDestroySelf (see issue #2622).
This is a speculative fix for a crash where |on_disconnect_| appears to be null
in ProxyURLLoaderFactory::MaybeDestroySelf. The hypothesis here is that
OnURLLoaderClientError is being called while the proxy object is still in-flight
to ResourceContextData::AddProxy (e.g. before SetDisconnectCallback has been
called for the proxy object). Additonally, this change protects against
MaybeDestroySelf attempting to execute |on_disconnect_| multiple times.
2019-06-14 18:52:31 +02:00
David Sowa f0c82200ba Add ARM64 build and binary distribution support (see issue #1990)
Adds a new `--arm64-build` option to automate-git.py and make_distrib.py.
2019-06-13 11:52:32 +02:00
Marshall Greenblatt c3c3af34fd Fix inclusion of cookies with restarted requests (fixes issue #2672, see issue #2622) 2019-06-12 17:19:09 +02:00
Marshall Greenblatt dd04583dcb macOS: Don't disable custom libc++ for cef_sandbox build (see issue #2677) 2019-06-12 12:02:50 +02:00
Marshall Greenblatt 0b7c0be29a Use FrameTreeNodeId to find delay loaded iframes for OnBeforeBrowse (fixes issue #2675, see issue #2498) 2019-06-12 11:48:57 +02:00
Marshall Greenblatt d277dcd5d7 Windows: cmake: Add newer VS versions 2019-06-11 18:12:29 +02:00
Marshall Greenblatt 939e9f40b5 Windows: Disable custom libc++ for cef_sandbox build (fixes issue #2677) 2019-06-11 18:12:23 +02:00
Marshall Greenblatt 6546556a14 Add NetworkService support for DevTools source maps (fixes issue #2671, see issue #2622) 2019-06-06 18:37:45 +02:00
Marshall Greenblatt 6193d8c554 Update to Chromium version 75.0.3770.0 (#652427) 2019-06-06 18:37:45 +02:00
Marshall Greenblatt ab6fd322d1 Fix crash when loading a file:// URL (fixes issue #2670) 2019-06-05 16:32:24 +02:00
Cristian Amarie 7e742f6e1f Add SSL_CONNECTION_VERSION_TLS1_3 to cef_ssl_version_t (fixes issue #2669) 2019-06-03 08:55:36 +00:00
Marshall Greenblatt fa5268fa2d Fix issues with request callbacks during browser shutdown (see issue #2622).
The behavior has changed as follows with NetworkService enabled:
- All pending and in-progress requests will now be aborted when the CEF context
  or associated browser is destroyed. The OnResourceLoadComplete callback will
  now also be called in this case for in-progress requests that have a handler.
- The CefResourceHandler::Cancel method will now always be called when resource
  handling is complete, irrespective of whether handling completed successfully.
- Request callbacks that arrive after the OnBeforeClose callback for the
  associated browser (which may happen for in-progress requests that are aborted
  on browser destruction) will now always have a non-nullptr CefBrowser
  parameter.
- Allow empty parameters to CefRequest and CefResponse methods where it makes
  sense (e.g. resetting default response state, or clearing a referrer value).
- Fixed a reference loop that was keeping CefResourceHandler objects from being
  destroyed if they were holding a callback reference (from ProcessRequest,
  ReadResponse, etc.) during CEF context or associated browser destruction.
- Fixed an issue where the main frame was not detached on browser destruction
  which could cause a crash due to RFH use-after-free (see issue #2498).

To test: All unit tests pass as expected.
2019-06-01 15:51:33 +03:00
Marshall Greenblatt fd80e5c653 Fix assertions when shutting down with pending requests (see issue #2622).
This change avoids the starting of new requests during shutdown.
2019-05-29 20:01:12 +03:00
Marshall Greenblatt 2814054863 Linux: Fix crash when closing a browser with pending requests (see issue #2622).
This change fixes an issue where the cancel_callback for a pending request
might already have been executed when the OnBrowserDestroyed notification is
received.
2019-05-29 09:43:29 -07:00
Marshall Greenblatt 241941a44a Move message routing from CefBrowser to CefFrame (see issue #2498).
This change moves the SendProcessMessage method from CefBrowser to CefFrame and
adds CefBrowser parameters to OnProcessMessageReceived and
OnDraggableRegionsChanged.

The internal implementation has changed as follows:
- Frame IDs are now a 64-bit combination of the 32-bit render_process_id and
  render_routing_id values that uniquely identify a RenderFrameHost (RFH).
- CefFrameHostImpl objects are now managed by CefBrowserInfo with life span tied
  to RFH expectations. Specifically, a CefFrameHostImpl object representing a
  sub-frame will be created when a RenderFrame is created in the renderer
  process and detached when the associated RenderFrame is deleted or the
  renderer process in which it runs has died.
- The CefFrameHostImpl object representing the main frame will always be valid
  but the underlying RFH (and associated frame ID) may change over time as a
  result of cross-origin navigations. Despite these changes calling LoadURL on
  the main frame object in the browser process will always navigate as expected.
- Speculative RFHs, which may be created as a result of a cross-origin
  navigation and discarded if that navigation is not committed, are now handled
  correctly (e.g. ignored in most cases until they're committed).
- It is less likely, but still possible, to receive a CefFrame object with an
  invalid frame ID (ID < 0). This can happen in cases where a RFH has not yet
  been created for a sub-frame. For example, when OnBeforeBrowse is called
  before initiating navigation in a previously nonexisting sub-frame.

To test: All tests pass with NetworkService enabled and disabled.
2019-05-29 17:44:56 +03:00
Marshall Greenblatt 35295d2e27 Fix evaluation of "Cache-Control: no-cache, no-store" header value (see issue #2283)
Choose the stricter "no-cache" behavior which implies the "no-store" behavior.
2019-05-21 17:51:43 +03:00
Marshall Greenblatt 6011d45e38 Enable NetworkService by default (see issue #2622).
The NetworkService can still be disabled for a limited time by specifying the
`--disable-features=NetworkService` command-line flag.
2019-05-20 19:42:44 +03:00
Marshall Greenblatt 9ddb013875 Add NetworkService support for response filtering (see issue #2622).
To test: ResourceRequestHandlerTest.Filter* tests pass with NetworkService
enabled.
2019-05-20 14:39:37 +03:00
Marshall Greenblatt e5c7fd1c55 Add NetworkService support for CefLoadCRLSetsFile (fixes issue #2497, see issue #2622). 2019-05-18 21:30:06 +03:00
Marshall Greenblatt 99eebd00c4 Add NetworkService support for more CefRequestContext methods (see issue #2622).
This adds support for the CloseAllConnections and ResolveHost methods.

To test: RequestContextTest.Close* and RequestContextTest.Resolve* tests pass
with NetworkService enabled.
2019-05-18 20:48:03 +03:00
Marshall Greenblatt bddf2a311b Fix NetworkService ServerTest.* failures and test name typo (see issue #2622).
Always return ERR_NONE and the response body if a CefURLRequest completes
successfully, including for non-2xx status codes. This matches the behavior of
the old network stack.

To test: ServerTest.* tests pass with NetworkService enabled.
2019-05-18 17:54:02 +03:00
Marshall Greenblatt 9a30f05f80 macOS: Fix compile errors 2019-05-18 15:23:17 +03:00
Marshall Greenblatt 2ea173a254 Cancel NetworkService requests when the browser is destroyed (see issue #2622).
Pending requests that are associated with a browser will be canceled when that
browser is destroyed. Pending requests that are not associated with a browser
(e.g. created using CefURLRequest::Create), and that use the global context, may
still be pending when CefShutdown is called. For this reason the
no_debugct_check attribute has been added for CefResourceRequestHandler and
CefCookieAccessFilter interfaces.

To test: Load a YouTube video or other long-loading content in cefclient and
close the application. No assertions trigger for leaked CefFrame objects.
2019-05-18 12:40:45 +03:00
Marshall Greenblatt ba0e1b5719 Add NetworkService support for CefURLRequest (see issue #2622).
Requests created using CefURLRequest::Create are not associated with a
browser/frame. When originating from the render process these requests cannot be
intercepted and consequently only http(s) and blob requests are supported. To
work around this limitation a new CefFrame::CreateURLRequest method has been
added that allows the request to be associated with that browser/frame for
interception purposes.

This change also fixes an issue with the NetworkService implementation where
redirected requests could result in two parallel requests being sent to the
target server.

To test: URLRequestTest.* tests pass with NetworkService enabled.
2019-05-17 21:42:25 +03:00
Chris Dziemborowicz f9b042c375 Fix version calculation for older commits on a release branch (fixes issue #2659) 2019-05-15 14:35:41 +00:00
Marshall Greenblatt c7701b8a61 Windows: Add arch-specific versions of d3dcompiler_47.dll (see issue #2656)
This fixes an issue where the 64-bit version of d3dcompiler_47.dll would be
included with 32-bit binary distributions.
2019-05-15 14:36:58 +03:00
Andrei Kurushin 03c1c21fd3 Fix crash when setting an invalid cookie (fixes issue #2657) 2019-05-08 18:12:21 +00:00
cef-ms 473c29a70d Add |extra_info| parameter for browser creation (fixes issue #1088)
The optional |extra_info| parameter provides an opportunity to specify extra
information specific to the created browser that will be passed to
CefRenderProcessHandler::OnBrowserCreated() in the render process.
2019-05-08 12:31:46 -04:00
Chris Dziemborowicz ad4ce5f441 Fix |options| argument usage in GetJSONWriterOptions (fixes issue #2647) 2019-05-08 15:10:19 +00:00
Marshall Greenblatt ef06407da6 Windows: Remove d3dcompiler_43.dll
The d3dcompiler_43.dll file was only required on Windows XP, which is no longer
supported.
2019-05-07 15:25:25 -04:00
Marshall Greenblatt bbabccf9aa Windows: Add d3dcompiler_47.dll version 10.0.17134.12
This change adds the d3dcompiler_47.dll version that was included with Windows
SDK 10.0.17134. The newer version of this file included with Windows SDK
10.0.17763 adds a dependency on the Universal C Runtime (api-ms-win-crt-*.dll)
which might not be installed on Windows 7 (requires KB2999226).
2019-05-07 15:25:25 -04:00
Ananyo Maiti 3827f817c7 Support override of client id for file scanning (fixes issue #2368). 2019-05-07 16:22:16 +00:00
Marshall Greenblatt 8b400331c7 Support disabling of cookie load/save via SetSupportedSchemes (see issue #2622).
With this change the CefCookieManager::SetSupportedSchemes method can be used
to disable all loading and saving of cookies for the associated request context.
This matches functionality that was previously available via GetBlockingManager.

This change also fixes a bug where Set-Cookie headers returned for a request
handled via CefSchemeHandlerFactory would be ignored if there was not also a
CefResourceRequestHandler returned for the request.

To test: All CookieTest.* tests pass.
2019-05-02 18:33:10 -04:00
Marshall Greenblatt cef882616b Fix NetworkService cache directory structure (see issue #2622).
To test: When running `cefclient --cache-path=c:\temp\cache` with NetworkService
enabled the the cache directory structure should be "C:\temp\cache\Cache"
instead of "C:\temp\cache\cache\Cache".
2019-05-02 14:51:02 -04:00
Marshall Greenblatt 4592cba19f Fix command-line override of the User-Agent product component (see issue #2622).
When the NetworkService is enabled the U-A string is configured via
SystemNetworkContextManager::CreateDefaultNetworkContextParams, which calls
chrome_content_browser_client.cc GetUserAgent(). This change modifies the Chrome
implementation to match CEF, so that the U-A product component can still be
overridden via the `--product-version` command-line flag.

To test: Verify that chrome://version, navigator.userAgent (JS executed from
DevTools console) and network requests (headers shown in DevTools Network tab)
show the expected User-Agent value in the following cases:
- Running `cefclient --enable-network-service --user-agent="<value>"`
- Running `cefclient --enable-network-service --product-version="<value>"`
2019-05-02 14:06:54 -04:00
Marshall Greenblatt b1018ad64b Fix SystemNetworkContextManager initialization timing (see issue #2622). 2019-05-02 13:33:44 -04:00
Marshall Greenblatt 5ce52bd775 Add NetworkService support for extensions and downloads (see issue #2622).
To test:
- All tests pass with NetworkService disabled. DownloadTest.*, ExtensionTest.*
  and PluginTest.* tests pass with NetworkService enabled.
- The PDF extension displays a file, and the download and print buttons work.
2019-05-01 17:10:52 -04:00
Marshall Greenblatt 0193a3fe54 Fix NetworkService expectations for NavigationTest.Redirect* tests (see issue #2622). 2019-04-30 17:54:17 -04:00
Marshall Greenblatt fb0133cd4b Fix NetworkService expectations for FrameTest.*Nav tests (see issue #2622). 2019-04-30 17:33:40 -04:00
Marshall Greenblatt 370cc028cb Add NetworkService support for chrome and chrome-devtools schemes (see issue #2622).
Known behavior changes:
- Unsupported chrome hosts no longer redirect to chrome://version.

To test: All tests pass with NetworkService disabled. WebUITest.* and V8Test.*
tests pass with NetworkService enabled.
2019-04-30 17:16:42 -04:00
Marshall Greenblatt 9fd6c8a1ee Mac: Fix build error and NetworkService startup assertion (see issue #2622).
Fixes FATAL:os_crypt_mac.mm(103)] Check failed: g_key_creation_util
2019-04-29 11:33:04 -04:00
Marshall Greenblatt 4e089766a5 Fix NetworkService startup assertion with multi-threaded message loop (see issue #2622).
When using multi-threaded message loop mode the PrefService needs to be created
on the UI thread.

To test: Run `cefclient --enable-network-service --multi-threaded-message-loop`.
The application should start successfully.
2019-04-26 17:17:26 -04:00
Marshall Greenblatt cc80175e89 Linux: Fix NetworkService startup assertion in FeatureList::InitializeInstance (see issue #2622). 2019-04-26 13:22:07 -07:00
Marshall Greenblatt 8a4f4bff9b Fix NetworkService load hang with default request handling (see issue #2622).
This change fixes a load hang when no custom handlers (CefResourceRequestHandler
or registered scheme handler) are found for a request.

To test: Run `cefsimple --enable-network-service` and all requests load. Test
expectations are unchanged.
2019-04-26 14:22:44 -04:00
Marshall Greenblatt 2ace33f8b7 Move cookie load/save callbacks to CefCookieAccessFilter (see issue #2622).
This change allows the NetworkService to handle cookie load/save in cases where
cookies will not be filtered (CefResourceRequestHandler::GetCookieAccessFilter
returns null) and the request will be handled by the default network loader.
This represents a minor performance improvement by reducing the volume of cross-
process messaging in the default (no filtering or custom handing) case. Cookie
load/save still needs to be routed through the browser process if a filter is
returned, or if a CefResourceHandler is used for the request.

To test: Test expectations are unchanged.
2019-04-26 13:02:58 -04:00
Marshall Greenblatt edd9efd1b3 Fix compile error due to missing `override` (fixes issue #2652) 2019-04-25 14:23:24 -04:00
Marshall Greenblatt 8f240861e3 Implement NetworkService request interception/handling (see issue #2622).
Implementation notes:
- Chromium change: CookieMonster::SetCookieableSchemes needs to be called
  immediately after the CookieMonster is created in NetworkContext::
  ApplyContextParamsToBuilder. Add a Profile::GetCookieableSchemes method and
  NetworkContextParams.cookieable_schemes member (set from
  ProfileNetworkContextService::CreateNetworkContextParams) to support that.
- Chromium change: Add a ContentBrowserClient::HandleExternalProtocol variant
  that exposes additional NetworkService request information.
- GetResourceResponseFilter is not yet implemented.

API changes:
- Resource-related callbacks have been moved from CefRequestHandler to a new
  CefResourceRequestHandler interface which is returned via the
  GetResourceRequestHandler method. If the CefRequestHandler declines to handle
  a resource it can optionally be handled by the CefRequestContextHandler, if
  any, associated with the loading context.
- The OnProtocolExecution callback has been moved from CefRequestHandler to
  CefResourceRequestHandler and will be called if a custom scheme request is
  unhandled.
- Cookie send/save permission callbacks have been moved from CefRequestHandler
  and CefResourceHandler to CefResourceRequestHandler.
- New methods added to CefResourceHandler that better match NetworkService
  execution sequence expectations. The old methods are now deprecated.
- New methods added to CefRequest and CefResponse.

Known behavior changes with the NetworkService implementation:
- Modifying the |new_url| parameter in OnResourceRedirect will no longer result
  in the method being called an additional time (likely a bug in the old
  implementation).
- Modifying the request URL in OnResourceResponse would previously cause a
  redirect. This behavior is now deprecated because the NetworkService does not
  support this functionality when using default network loaders. Temporary
  support has been added in combination with CefResourceHandler usage only.
- Other changes to the request object in OnResourceResponse will now cause the
  request to be restarted. This means that OnBeforeResourceLoad, etc, will be
  called an additional time with the new request information.
- CefResponse::GetMimeType will now be empty for non-200 responses.
- Requests using custom schemes can now be handled via CefResourceRequestHandler
  with the same callback behavior as builtin schemes.
- Redirects of custom scheme requests will now be followed as expected.
- Default handling of builtin schemes can now be disabled by setting
  |disable_default_handling| to true in GetResourceRequestHandler.
- Unhandled requests (custom scheme or builtin scheme with default handling
  disabled) will fail with an CefResponse::GetError value of
  ERR_UNKNOWN_URL_SCHEME.
- The CefSchemeHandlerFactory::Create callback will now include cookie headers.

To test:
- Run `cefclient --enable-network-service`. All resources should load
  successfully (this tests the transparent proxy capability).
- All tests pass with NetworkService disabled.
- The following tests pass with NetworkService enabled:
  - CookieTest.*
  - FrameTest.* (excluding .*Nav)
  - NavigationTest.* (excluding .Redirect*)
  - RequestHandlerTest.*
  - RequestContextTest.Basic*
  - RequestContextTest.Popup*
  - RequestTest.*
  - ResourceManagerTest.*
  - ResourceRequestHandlerTest.* (excluding .Filter*)
  - SchemeHandlerTest.*
  - StreamResourceHandlerTest.*
2019-04-23 22:53:28 -04:00
Jesper Papmehl-Dufay 019611c764 macOS: Add support for building clients with ARC enabled (fixes issue #2623).
Under ARC (Automatic Reference Counting), assigning to an Objective-C
pointer has different semantics than assigning to a void* pointer.
This makes it dangerous to treat the same memory address as an
Objective-C pointer in some cases and as a "regular C pointer" in
other cases.

This change removes the conditional type defines and instead uses
void* everywhere. Explicit type casting in combination with ARC
annotations makes it safe to get typed Objective-C pointers from the
void* pointers.

This change enables ARC by default in the CEF binary distribution CMake
configuration for the cefclient and cefsimple sample applications. It can be
disabled by adding `-DOPTION_USE_ARC=Off` to the CMake command line.

ARC is not supported when building Chromium due to the substantial
number of changes that would be required in the Chromium code base.
2019-04-23 17:17:56 +00:00
santosh mahto 491253fa03 Linux: Add support for ozone builds (fixes issue #2296).
Ozone builds can run with different platform backends (Wayland, X11, etc). Usage of the Views framework is required, and the cefclient sample application is not supported.

Example usage:

$ export GN_DEFINES="use_ozone=true"
$ cd /path/to/chromium/src/cef
$ ./cef_create_projects.sh
$ cd /path/to/chromium/src
$ ninja -C out/Release_GN_x64 cefsimple
$ ./out/Release_GN_x64/cefsimple --use-views --ozone-platform=wayland

Binary distributions can be created by passing the `--ozone` flag to make_distrib.py.
2019-04-23 17:00:14 +00:00
Marshall Greenblatt 07863c0d46 Use net/base/net_error_list.h to populate the cef_errorcode_t enum (fixes issue #2650) 2019-04-16 12:07:33 -04:00