Commit Graph

1584 Commits

Author SHA1 Message Date
Marshall Greenblatt a0a7a35fe2 chrome: Change popup default behavior with native parent (see issue #3294)
When using a Views-hosted browser window the client receives Views-related
callbacks for popups and can thereby customize the Views-hosted popup behavior.
When using an external parent window no Views-related callbacks are delivered
and customization options are restricted to providing a new parent handle via
OnBeforePopup. Consequently, we should default to a normal browser window in
the external parent case instead of the very minimial Views-hosted default.

To test (A):
1. Run `cefclient --use-default-popup --enable-chrome-runtime --use-native`
2. Select Tests > Popup Window
3. Get a normal Chrome browser window

To test (B):
1. Run `cefclient --use-default-popup [--enable-chrome-runtime] [--use-views]`
2. Select Tests > Popup Window
3. Get a native or Views-hosted browser window with title bar only
2022-04-12 12:06:52 -04:00
Marshall Greenblatt 75ca552a4e cefclient: Add option to create default popups (see issue #3165, see issue #3294)
This change adds a `--use-default-popup` command-line option to cefclient. When
specified, popup windows will be created with default styling (e.g. without an
application-provided native parent window).

This change also adds some reasonable default window bounds in cases where they
are not specified by the client.
2022-04-12 11:49:27 -04:00
Marshall Greenblatt 3000bc8748 chrome: win/linux: Add support for browser with native parent (see issue #3294)
This change adds Chrome runtime support on Windows and Linux for creating a
browser parented to a native window supplied by the client application.
Expected API usage and window behavior is similar to what already exists with
the Alloy runtime. The parent window handle should be specified by using
CefWindowInfo::SetAsChild in combination with the CefBrowserHost::CreateBrowser
and CefLifeSpanHandler::OnBeforePopup callbacks.

The previously existing behavior of creating a fully-featured Chrome browser
window when empty CefWindowInfo is used with CreateBrowser remains unchanged
and Views is still the preferred API for creating top-level Chrome windows
with custom styling (e.g. title bar only, frameless, etc).

The cefclient Popup Window test with a native parent window continues to crash
on Linux with both the Alloy and Chrome runtimes (see issue #3165).

Also adds Chrome runtime support for CefDisplayHandler::OnCursorChange.

To test:
- Run `cefclient --enable-chrome-runtime [--use-views]` for the default (and
  previously existing) Views-based behavior.
- Run `cefclient --enable-chrome-runtime --use-native` for the new native
  parent window behavior.
- Run `cefclient --enable-chrome-runtime --use-native --no-activate` and the
  window will not be activated (take input focus) on launch (Windows only).
- Run `cefclient --enable-chrome-runtime [--use-views|--use-native]
  --mouse-cursor-change-disabled` and the mouse cursor will not change on
  mouseover of DOM elements.
2022-04-12 11:49:26 -04:00
Marshall Greenblatt 5f4bccd672 Fix dismissal of select popups on NotifyMoveOrResizeStarted (see issue #3294)
This impacts both Alloy and Chrome runtimes when using a native parent window.
2022-04-11 13:11:08 -04:00
Marshall Greenblatt 21cf732e7f chrome: Update expectations with same-site BFCache enabled (fixes issue #3301)
With same-site BFCache enabled every navigation can now potentially be served
via the BFCache. To support this internally a new top-level RenderFrame object
may be created for each new navigation. As a result, OnBrowserCreated may now
be called multiple times with the same browser ID in a given renderer process
(a behavior previously only seen with cross-site navigations and different
renderer processes).

BFCache navigations do not trigger the same Chromium notifications as a normal
load. To avoid breaking CEF API usage expectations we now synthetically
generate the load-related callbacks that would otherwise be missing
(OnLoadingStateChange with isLoading=true, OnLoadStart, OnLoadEnd). The
|httpStatusCode| argument to OnLoadEnd will be 0 in this case.

To test:
- Run `FrameHandlerTest.*:MessageRouterTest.*:NavigationTest.*`
- Run `NavigationTest.LoadSameOriginLoadURL` for OnBrowserCreated behavior.
- Run `NavigationTest.History` for load-related callback behavior.
2022-04-05 15:30:30 -04:00
Marshall Greenblatt b524edc209 Update to Chromium version 101.0.4951.0 (#982481)
Known issues:
- chrome: Some ceftests are failing due to bfcache same-site enabled by default
  (see issue #3301)
2022-03-30 19:54:09 -04:00
Marshall Greenblatt 77466e7b6d alloy: Use chrome's value for ApplicationClientIdForFileScanning (fixes issue #3030)
This change removes CefSettings.application_client_id_for_file_scanning in
favor of always using the same hard-coded value as chrome.
2022-03-24 12:16:11 -04:00
Marshall Greenblatt e43d2054d1 Increase priority of the EndTracing task (fixes issue #3288)
Use a priority that is guaranteed to execute in a reasonable amount of time.
2022-03-23 17:31:09 -04:00
Marshall Greenblatt 9d52d72ae5 chrome: Add support for persist_session_cookies (fixes issue #3291)
This change configures session restore behavior for the NEXT application
restart by setting the "session.restore_on_startup" preference based on the
[CefSettings|CefRequestContextSettings].persist_session_cookies value.
2022-03-22 20:49:20 -04:00
Marshall Greenblatt 6d7a680187 Add permission callback for user-initated downloads (fixes issue #3183)
This change adds a CefDownloadHandler::CanDownload callback for optionally
blocking user-initiated downloads (e.g. alt + link click or link click that
returns a `Content-Disposition: attachment` response from the server).

To test:
- Run `ceftests --gtest_filter=DownloadTest.*`.
- Run `cefclient --hide-controls`. User-initiated downloads will be blocked.
2022-03-22 17:46:44 -04:00
Marshall Greenblatt 2f5838eaaa chrome: Add ability to handle chrome menu/keyboard commands (fixes issue #3280)
This change adds a CefCommandHandler::OnChromeCommand callback for optionally
handling Chrome commands triggered via menus or keyboard shortcuts. Supported
command IDs are listed in a new cef_command_ids.h header file.

To test: Run `cefclient --enable-chrome-runtime --hide-controls`. Most commands
will blocked and removed from context menus.
2022-03-22 15:11:47 -04:00
Marshall Greenblatt 4615fffafb chrome: Add setting for controlling the status bubble (fixes isse #3279)
This change adds `CefBrowserSettings.chrome_status_bubble` for controlling
whether the Chrome status bubble will be used.

Testable in cefclient by passing the `--hide-chrome-status-bubble`
command-line flag.
2022-03-21 17:25:40 -04:00
Marshall Greenblatt c38d62b233 Linux: Migrate from breakpad to crashpad (see issue #3249)
Renderer process crashes are currently only reported with `--no-sandbox`.
2022-03-17 15:34:49 -04:00
Marshall Greenblatt 8fc6aced6c Fix DevTools crash due to unknown .md mime type (fixes issue #3278) 2022-03-15 13:06:58 -04:00
Marshall Greenblatt 3474e7abc1 chrome: Fix shutdown crashes with multi-threaded-message-loop (fixes issue #3277) 2022-03-09 15:12:24 -05:00
Marshall Greenblatt a513e01b01 Fix shutdown crash in RenderProcessHostImpl::Cleanup (fixes issue #3276)
Execute all pending UI thread tasks at the beginning of the shutdown sequence.
2022-03-09 13:59:07 -05:00
Marshall Greenblatt 113a96be0d alloy: Fix PDF download 'With your changes' (fixes issue #3169) 2022-03-04 13:56:30 -05:00
Marshall Greenblatt 705b6ec15c alloy: Fix print preview Save as PDF (fixes issue #2867) 2022-03-04 13:15:20 -05:00
Cristian Amarie 7945baf640 alloy: Fix crash when downloading a modified PDF form (see issue #3169)
Create a CefFileSystemDelegate based on the ShellFileSystemDelegate placeholder
implementation. An actual implementation will still be required to properly
support this download functionality.
2022-03-02 15:16:09 -05:00
Jelle Bleyaert 3c2e97d82e Adding ClearFilenames method to CefDragData (fixes issue #3266) 2022-03-02 19:44:16 +00:00
Marshall Greenblatt f97f0bbda6 Update to Chromium version 100.0.4896.0 (#972766) 2022-02-22 19:22:39 -05:00
Marshall Greenblatt 28c7f04001 Delete cef_web_plugin.h and plugin-related APIs (see issue #3047)
This functionality stopped being relevant after the removal of Flash support
in January 2021. The last remaining PPAPI plugin (PDF viewer) will switch to
a non-plugin implementation (PdfUnseasoned) in M100.
2022-02-18 16:23:11 -05:00
Marshall Greenblatt dc0a45d429 alloy: Fix printing of PDF viewer (see issue #3047)
Match the logic for printing::StartPrint() used by Chrome.
2022-02-18 11:37:27 -05:00
Marshall Greenblatt 171d525aa4 alloy: Implement Find() using find_in_page::FindTabHelper (fixes issue #3098, see issue #3047)
The find behavior should now match Chrome.
2022-02-17 13:59:25 -05:00
Marshall Greenblatt d43c3091b2 Revert "chrome: Simplify WebUIControllerFactory registration (see issue #3047)"
Still need to unregister the Content-level factory to stop Alloy loading
unsupported pages.

This reverts commit a21d0c41a4.
2022-02-16 18:28:08 -05:00
Marshall Greenblatt 32ebbd60f9 chrome: Simplify WebUIControllerFactory registration (see issue #3047)
Disable the initial Chrome factory registration in ChromeBrowserMainParts
instead of trying to unregister those factories at a later point.
2022-02-16 18:11:45 -05:00
Marshall Greenblatt efc0a67e00 alloy: Add support for chrome-untrusted scheme (see issue #3047)
Lack of this functionality was causing print preview to fail with
PdfUnseasoned enabled.
2022-02-16 17:48:28 -05:00
Marshall Greenblatt 71727464b8 Add support for the chrome-untrusted scheme (see issue #3047)
Lack of this functionality was causing print preview to fail with
PdfUnseasoned enabled.
2022-02-16 17:48:20 -05:00
Marshall Greenblatt 3d1bbaf54f Support reconnect of the mojo frame channel (fixes issue #3260)
The mojo channel used for frame communication may disconnect for a variety of
reasons including frame navigation, frame destruction, or insertion into the
BackForwardCache (when the browser-side frame representation is destroyed and
closes the connection). When disconnect occurs we now evaluate the situation
and reconnect if appropriate.

Connections are now initiated solely from the renderer process and the
RenderFrame is passed as an argument to FrameAttached() instead of being
retrieved independently. Messages are queued while the frame is disconnected
and sent only after FrameAttachedAck() is received from the browser process.
The renderer process will be crashed intentionally with a "connection retry
failure" message if the reconnect fails 3 times in a row.
2022-02-14 20:31:04 -05:00
Marshall Greenblatt 80caf947f3 Fix includes path for Linux ARM cross-compile (see issue #2926) 2022-02-09 16:54:54 -05:00
Marshall Greenblatt a74b66352e Make cef_config.h discoverable from patched Chromium targets (see issue #2926)
Add the generated includes/ directory to CEF's "config" so that source files
included in patched Chromium targets (for example, blink_glue.cc) can find
cef_config.h which will be included via `include/internal/cef_types_linux.h`
on Linux.
2022-02-08 14:03:49 -05:00
Marshall Greenblatt 4adc23a52a alloy: Fix extension function registration for print preview dialog (fixes issue #3167) 2022-02-02 15:24:14 -05:00
Marshall Greenblatt 9eb0954cde alloy: Move ExtensionsBrowserClient ownership to BrowserProcess (fixes issue #3247)
Fixes a shutdown crash due to `ExtensionsBrowserClient::Set(nullptr)` being
called too early. Some code that may occasionally be triggered via
`content::ContentMainShutdown()` is expecting the extensions objects to still
be valid.

This new ownership pattern matches the code in chrome/.
2022-02-02 12:40:31 -05:00
Marshall Greenblatt 303280dd71 alloy: Fix shutdown assert if OneShotTimer is deleted on the wrong thread 2022-01-26 21:10:29 -05:00
Marshall Greenblatt 1e1133ec66 Update to Chromium version 99.0.4844.0 (#961656) 2022-01-26 21:10:29 -05:00
Marshall Greenblatt c32f366dfa Migrate ignore_result to std::ignore (see issue #3234)
See https://crbug.com/1285085 for background.
2022-01-25 14:40:53 -05:00
Marshall Greenblatt ebde595370 Convert defined(OS_XXX) to BUILDFLAG(IS_XXX) in libcef
See https://crbug.com/1234043 for background.
2022-01-24 12:58:04 -05:00
Marshall Greenblatt 51e8bd9bd8 chrome: Fix crash when clicking Reading List sidebar link (fixes issue #3128) 2022-01-14 13:52:56 -05:00
Nick Mueller 029cc67915 Fix OSR resize issue when multiple monitors have different scale factors (fixes issue #3240) 2022-01-14 12:04:38 -05:00
Marshall Greenblatt 17d51ceed0 Revert "Fix OSR resize issue when multiple monitors have different scale factors (fixes issue #3240)"
This reverts commit 9e416a7921.

Reverted due to compile error.
2022-01-14 12:04:06 -05:00
Nick Mueller 9e416a7921 Fix OSR resize issue when multiple monitors have different scale factors (fixes issue #3240) 2022-01-14 16:50:23 +00:00
Marshall Greenblatt 2428b35f6c alloy: Disable bfcache (see issue #3237)
This will be reverted if the bfcache issue is fixed.
2022-01-10 17:32:22 -05:00
Marshall Greenblatt ff0e5c0348 Fix possible use after shutdown of BrowserContext (fixes issue #3193) 2022-01-10 17:21:07 -05:00
Marshall Greenblatt 839fdb211c Fix certificate errors with restarted/redirected requests (fixes issue #3200)
URLLoaderNetworkServiceObserver is used for routing certificate and
authentication callbacks from the NetworkService to the associated
StoragePartition instance. With request interception enabled this object was
previously only assigned for the initial request. This change adds assignment
for restarted/redirected requests as well.
2022-01-06 20:53:00 -05:00
Marshall Greenblatt dfc0131516 Update to Chromium version 98.0.4758.0 (#950365) 2021-12-18 15:57:34 -05:00
Marshall Greenblatt 9484d6528c Remove DISALLOW_ macro from libcef/ (see issue #3234)
Also perform related C++ cleanup:
- Use =default instead of {} for default implementations of
  constructors/destructors.
- Replace typedef with using.
2021-12-07 15:02:28 -05:00
Marshall Greenblatt 83ffc1f00d Add kPdfRenderer define for non-Windows platforms (see issue #3047)
This switch is currently only defined for Windows in
content/public/common/content_switches.h.
2021-12-02 12:37:02 -05:00
Marshall Greenblatt f4d5395c4b Skip GetNewBrowserInfo call for PDF renderer processes (see issue #3047)
With PdfUnseasoned the PDF file will be loaded in a dedicated renderer process.
We identify this process by adding the kPdfRenderer command-line flag (similar
to how kExtensionProcess is used to identify an extension renderer process). We
then avoid calling GetNewBrowserInfo for the PDF renderer process because we
know the request will otherwise time out.
2021-11-29 15:46:39 -05:00
Nicolas Dusart f6cf7f9ec7 Fix CefURLRequest crash with failing HEAD requests (fixes issue #3226) 2021-11-23 22:14:59 +00:00
Marshall Greenblatt c75ebbccec alloy: Add support for the new non-PPAPI PDF viewer (see issue #3047)
Enable by passing `--enable-features=PdfUnseasoned` on the command line.
2021-11-23 16:38:16 -05:00
Marshall Greenblatt 6eff48e9ff chrome: Add support for PdfViewerTest ceftests (see issue #3047)
We need to override ChromeMimeHandlerViewGuestDelegate to handle
OnGuestAttached/Detached callbacks in order to account for the guest renderer
process hosting the PDF extension.

Additional work will be required to account for the renderer process hosting the
PDF viewer when using `--enable-features=PdfUnseasoned` (see issue #2969).
2021-11-16 19:17:50 -05:00
Marshall Greenblatt f3cea7e7df chrome: Fix DCHECK when a temporary CefFrame is destroyed (see issue #2969)
The temporary CefFrame is created in NavigationOnUIThread during PDF loading.
2021-11-16 17:43:37 -05:00
Marshall Greenblatt 7f0c88b5da chrome: Show non-CefBrowserView browser windows on creation (see issue #2969)
Browser windows created via CefBrowserHost::CreateBrowser should be shown at
creation time. These windows receive default Chromium styling, unlike
CefBrowserView windows which may contain other client-specified Views and
where show state can be configured via CefWindowDelegate::GetInitialShowState
or by calling CefWindow::Show.
2021-11-16 17:25:04 -05:00
Marshall Greenblatt 66648c2343 Update to Chromium version 97.0.4692.0 (#938553)
- Remove CefRequestContextHandler::OnBeforePluginLoad and
  CefRequestContext::PurgePluginListCache (fixes issue #3047). These methods
  stopped being relevant after the removal of Flash support in January 2021.
  The last remaining PPAPI plugin (PDF viewer) will switch to a non-plugin
  implementation in the near future (see https://crbug.com/702993#c58) and
  functionality related to plugin filtering has already been removed in
  https://crrev.com/343ae351c9.
2021-11-15 14:25:16 -05:00
Marshall Greenblatt e83d8d6a13 Trial fix for CORS pre-flight requests missing headers (see issue #3110, see issue #3200) 2021-11-09 14:21:58 -05:00
Marshall Greenblatt 088816d496 Fix writing of files from DevTools (fixes issue #3211) 2021-11-08 15:05:28 -05:00
Marshall Greenblatt 3a2a22f30d osr: Fix GPU process crash with SendExternalBeginFrame (see issue #2800)
Fixes the following error:
Check failed: !pending_frame_callback_. Got overlapping IssueExternalBeginFrame

To test:
Run `cefclient --off-screen-rendering-enabled --external-begin-frame-enabled`
on Windows without crashing.
2021-10-28 15:14:45 -04:00
Marshall Greenblatt 6872dadd74 Update to Chromium version 96.0.4664.0 (#929512) 2021-10-21 15:43:15 -04:00
Marshall Greenblatt 4dd314dec3 alloy: Fix ComponentUpdateService shutdown crash with multi-threaded message loop (see issue #3149) 2021-10-20 17:08:23 -04:00
Marshall Greenblatt f3ed6619da Only disable request handling for HTTP/S schemes (see issue #3110)
The `--disable-request-handling-for-testing` command-line flag would previously
disable handling of all schemes, including custom schemes and internal schemes
such as devtools.
2021-10-05 11:03:28 +03:00
Marshall Greenblatt 62a9f00bd3 Return display_name from CefDragData::GetFileNames if available
When dropping from Microsoft 365 Outlook the path will be "temp.tmp"
while display_name contains the original file name.
2021-10-04 14:57:20 +03:00
Alex Maitland eabdf3a2ca alloy-win: Disable the WinUseBrowserSpellChecker feature (see issue #3055)
Workaround until support for the Windows 10+ spellcheck service is added for
the Alloy runtime.
2021-10-04 10:02:05 +00:00
Andy Tzeng 1f85a7752b Fix the timing of SetBackgroundColor (fixes issue #2482)
If the background color is set too early it won't be sent to renderer process.
Also force refresh of the background color for newly created popups.
2021-10-04 09:58:22 +00:00
Marshall Greenblatt a7bbd8a62b Remove ignore_certificate_errors setting (fixes issue #2899)
This removes CefSettings.ignore_certificate_errors and
CefBrowserSettings.ignore_certificate_errors. Due to NetworkService
requirements these values must now be configured globally via the
"ignore-certificate-errors" command-line flag.
2021-09-27 16:36:57 +03:00
Marshall Greenblatt f158c34a21 Remove CefBrowserSettings related to file URL access (fixes issue #2820)
This removes CefBrowserSettings.universal_access_from_file_urls and
CefBrowserSettings.file_access_from_file_urls. Due to NetworkService
requirements these values must now be configured globally via command-line
flags ("allow-universal-access-from-files" and "allow-file-access-from-files"
respectively).

Also remove the kAllowFileAccessFromFileUrls switch in CEF which duplicates
the existing kAllowFileAccessFromFiles switch in Chromium (see issue #1785).
2021-09-27 16:36:57 +03:00
Marshall Greenblatt 659c037c84 Windows: Escape URLs passed to SellExecute (fixes issue #3133) 2021-09-27 16:36:57 +03:00
Marshall Greenblatt 4d1c5ebdd2 Fix CefCommandLine character case requirements (fixes issue #1872)
Switch names will now be converted to lowercase ASCII on all platforms.
Switch values will retain the original case and UTF8 encoding.
2021-09-27 16:36:57 +03:00
Marshall Greenblatt 6516b569a9 Remove CefBrowserSettings.application_cache (fixes issue #1785)
AppCache is deprecated in favor of Service Workers and support will be
fully removed soon (~M95). See https://web.dev/appcache-removal/.

Also add missing "allow-file-access-from-files" command-line switch for
CefBrowserSettings.file_access_from_file_urls.
2021-09-27 16:22:27 +03:00
Marshall Greenblatt cbc5710801 Replace CefRequestCallback with CefCallback (fixes issue #1861)
CefRequestCallback::Continue(false) was the same as Cancel(), so we can just
use CefCallback instead.
2021-09-27 16:22:27 +03:00
Marshall Greenblatt 23be17f693 Use CefRect for CefWindowInfo bounds (fixes issue #1515) 2021-09-27 16:22:27 +03:00
Marshall Greenblatt 41b64e428c Rename SendFocusEvent to SetFocus (fixes issue #866)
Also removes CefBrowserHost::SendFocusEvent. Use the existing SetFocus method
instead.
2021-09-27 10:50:12 +03:00
Marshall Greenblatt dc1f934865 views: Support configuration of initial window show state
Known issues:
- Exiting full-screen mode currently crashes with the Chrome runtime
  (see issue #3182).
2021-09-23 14:41:47 +03:00
Mathieu Lafon 6dad2c45ee osr: Implement InvalidateLocalSurfaceIdOnEviction (fixes issue #2483)
This fixes an empty-rendering issue when the view is shown after being
evicted.
2021-09-22 11:09:38 +00:00
Alex Maitland 28599ae1a5 alloy: win: Fix loading of some mouse cursors (fixes issue #3174) 2021-09-22 09:17:27 +00:00
Marshall Greenblatt 5782fdca16 Update to Chromium version 95.0.4638.0 (#920003)
Known issues:
- Windows ARM64 builds are currently failing due to
  https://crbug.com/1242884#c31
2021-09-22 12:08:24 +03:00
Marshall Greenblatt 84117f2d1b Don't use NotificationStateLock for GetMainFrame (see issue #2421)
This causes a race related to |notification_state_lock_| assignment when
GetMainFrame is called from multiple threads. GetMainFrame doesn't
trigger any notifications so it shouldn't need that lock. Instead, only
use NotificationStateLock on the UI thread.
2021-09-16 18:25:44 +03:00
Marshall Greenblatt db807e804a alloy: Fix FrameHandlerTest failures with BackForwardCache enabled (see issue #2421)
To test:
Run `ceftests --gtest_filter=FrameHandlerTest.OrderSub*
              --enable-features=BackForwardCache`
2021-09-16 18:25:44 +03:00
Marshall Greenblatt 7a56371b84 Fix draggable region update with BackForwardCache enabled (see issue #2421)
When BackForwardCache is enabled and the user navigates the main frame
back/forward a new RFH may be created for an existing main frame GlobalId value
and CefFrameHostImpl (e.g. an object that was previously Detach()ed after main
frame navigation called SetMainFrame, but for which RenderFrameDeleted was not
subsequently called due to insertion in the BackForwardCache). In this case we
can re-attach the new RFH to the existing main frame CefFrameHostImpl in
RenderFrameHostStateChanged and resume processing of messages.

Swapping back/forward to an existing (already loaded) renderer does not trigger
new notifications for draggable regions (e.g. RenderFrameObserver::
DraggableRegionsChanged is not called by default). We therefore explicitly
request an update of draggable regions by sending the DidStopLoading message to
the renderer.

A new |reattached| parameter is added to CefFrameHandler::OnFrameAttached to
support identification of BackForwardCache usage by the client.

To test with unit tests:
Run `ceftests --gtest_filter=DraggableRegionsTest.DraggableRegionsCrossOrigin
              --enable-features=BackForwardCache`

To test manually:
1. Run `cefclient --enable-features=BackForwardCache --use-views
   --url=http://tests/draggable`, note that draggable regions work.
2. Load https://www.google.com via the address bar, note that draggable regions
   are removed.
3. Go back to http://tests/draggable, note that draggable regions work.
4. Go forward to https://www.google.com, note that draggable regions are
   removed.
2021-09-16 18:25:43 +03:00
Marshall Greenblatt b3f5d7dd59 alloy: Enable BackForwardCache support (see issue #2421)
BackForwardCache is currently being tested via field trials (see
https://crbug.com/1171298) and can be explicitly disabled using the
`--disable-back-forward-cache` or `--disable-features=BackForwardCache`
command-line flags. The default behavior now matches the Chrome runtime.
2021-09-16 18:25:43 +03:00
Marshall Greenblatt 4a44e16a09 views: Add support for absolute positioned overlay views.
To test:
Run `cefclient.exe --use-views --hide-frame --hide-controls`
Add `--enable-chrome-runtime` for the same behavior using the Chrome location
bar instead of a text field.
2021-09-16 18:25:43 +03:00
Shezan Baig 6f6072b857 Fix download via the PDF extension 2021-09-09 07:50:10 +00:00
Marshall Greenblatt cf4457bbb3 Linux: Pass log-file to zygote subprocesses
This fixes a DCHECK(!log_file.empty()) due to commit 2ecf6f1.
2021-08-24 17:43:02 -04:00
Marshall Greenblatt 25c1947f1d Update to Chromium version 94.0.4606.0 (#911515) 2021-08-24 17:43:02 -04:00
Marshall Greenblatt 955097ea77 Remove usage of FrameTreeNode IDs (see issue #2421)
With the introduction of prerendering in Chromium it is now possible for
RenderFrameHosts (RFH) to move between FrameTrees. As a consequence we can no
longer rely on FrameTreeNode IDs to uniquely identify a RFH over its lifespan.
We must now switch to using GlobalRenderFrameHostId (child_id, frame_routing_id)
instead for that purpose. Additionally, we simplify existing code by using the
GlobalRenderFrameHostId struct in all places that previously used a
(render_process_id, render_frame_id) pair, since these concepts are equivalent.

See https://crbug.com/1179502#c8 for additional background.
2021-08-19 19:41:44 -04:00
Marshall Greenblatt cfdec92624 Fix ExecuteJavaScript failure with null CefRenderProcessHandler (see issue #2421)
When CefApp::GetRenderProcessHandler returned null
CefRenderFrameObserver::DidCreateScriptContext was returning early (not
calling CefFrameImpl::OnContextCreated) and consequently queued actions
such as JavaScript were never executed.
2021-08-18 18:08:00 -04:00
Marshall Greenblatt 2ecf6f1070 Fix duplicate log-file entry on sub-process command-line 2021-08-11 13:28:52 -04:00
Marshall Greenblatt f435c3af9e Linux: Update user data path docs (see issue #3149) 2021-08-11 13:15:03 -04:00
Marshall Greenblatt ee090039c7 Mac: Update CFBundleIdentifier for the CEF framework 2021-08-11 12:38:43 -04:00
Marshall Greenblatt 17d2d13030 widevine: Fix ARM compile error due to unused variable (see issue #3149)
alloy_browser_main.cc:223:17: error: unused variable 'cus' [-Werror,-Wunused-variable]
    auto* const cus = g_browser_process->component_updater();
2021-08-10 12:05:48 -04:00
Marshall Greenblatt 240b869db5 widevine: Use component updater with the Alloy runtime (fixes issue #3149)
Widevine CDM binaries will be downloaded on supported platforms shortly after
application startup. Widevine support will then become available within a few
seconds after successful installation on Windows or after the next application
restart on other platforms. The CDM files will be downloaded to a "WidevineCdm"
directory inside the `CefSettings.user_data_path` directory.

Pass the `--disable-component-update` command-line flag to disable Widevine
download and installation. Pass the `--component-updater=fast-update` command-
line flag to force Widevine download immediately after application startup.

See the related issue for additional usage details.
2021-08-09 21:10:45 -04:00
Marshall Greenblatt eaf581e544 chrome: Fix AssertBlockingAllowed() with disk-based Profile creation (see issue #2969) 2021-08-04 15:23:49 -04:00
Marshall Greenblatt ad71ec9fdf views: Fix multiple issues with hide-frame (fixes issue #3168) 2021-08-04 14:31:08 -04:00
Marshall Greenblatt 92ec2dcbdd Fix ceftest failures with BackForwardCache enabled (see issue #2421)
When BackForwardCache is enabled the old RFH tree may be cached instead of being
immediately deleted as a result of main frame navigation. If a RFH is cached
then delivery of the CefFrameHandler::OnFrameDetached callback will be delayed
until the the RFH is ejected from the cache (possibly not occurring until the
browser is destroyed). This change in OnFrameDetached timing was causing
FrameHandlerTest.OrderSubCrossOrigin* to fail, and the inclusion of cached
frames in CefBrowserInfo::GetAllFrames was causing
FrameTest.NestedIframesDiffOrigin to fail.

BackForwardCache is currently being tested via field trials (see
https://crbug.com/1171298) and can be explicitly disabled using the
`--disable-back-forward-cache` or `--disable-features=BackForwardCache`
command-line flags.
2021-07-27 19:03:21 -04:00
Marshall Greenblatt 645b62257c chrome: Fix potential UAF of ChromeBrowserContext and Profile (see issue #2969) 2021-07-27 19:03:21 -04:00
Marshall Greenblatt b4ea0496e7 Update to Chromium version 93.0.4577.0 (#902210) 2021-07-27 19:03:09 -04:00
Vladislav 2be59f6edd Translate additional CEF modifiers to EF_* flags (see issue #2597) 2021-07-19 15:52:36 +00:00
Marshall Greenblatt 17fc2b3e3b Various fixes related to the C++11/14 update (see issue #3140)
- Convert scoped_ptr to std::unique_ptr from <memory>
- Convert arraysize to base::size from include/base/cef_cxx17_backports.h
- Convert NULL to nullptr
- Include include/base/cef_callback.h instead of include/base/cef_bind.h
- Implicit conversion of CefRefPtr<T> or scoped_refptr<T> to T* is gone;
  use .get() instead

See the issue for additional details.
2021-06-18 13:42:31 -04:00
Marshall Greenblatt 6d80ec69d7 Replace OVERRIDE with override (see issue #3140) 2021-06-17 16:16:53 -04:00
Matthew Isaacs 9c7367bd4e widevine: Add arm64 arch manifest value (see issue #2981) 2021-06-17 14:07:27 +00:00
Marshall Greenblatt de66fb9406 alloy: Fix link click navigation in PDF files (fixes issue #3143)
This change adds a minimal implementation of the |tabs.update| extension API and
modifies StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent to return a valid
|streamInfo.tabId| value as required by the navigateInCurrentTab implementation
in chrome/browser/resources/pdf/browser_api.js.
2021-06-16 16:05:31 -04:00
Alex Maitland 1d02cd2be0 Expose certificate error codes to OnLoadError 2021-06-16 15:59:46 +00:00
Marshall Greenblatt b7ef08ca84 widevine: Fix VP9 version string for v4.10.2209.0 (fixes issue #3138) 2021-06-14 14:47:17 -04:00
Marshall Greenblatt 571911730a Use Chromium code for cookie date validity check (fixes issue #2927) 2021-06-11 12:37:08 -04:00
Marshall Greenblatt 430895168d Add --disable-request-handling-for-testing option
Add a command-line option to bypass request handling in CEF to faciliate
debugging of network-related issues.
2021-06-11 12:09:18 -04:00
Marshall Greenblatt 3c0a4410ad Fix crash if a frame is detached before the attach message arrives (see issue #2421)
This reproduced on Mac with ResourceRequestHandlerTest.BasicStandardUnhandledModifyBeforeResourceLoad
2021-06-10 16:42:44 -04:00
Marshall Greenblatt 0aad12fe1b Linux: Fix Check failed: generated_timestamp < total_latency_stage.end_time (see issue #3102) 2021-06-10 16:42:44 -04:00
Marshall Greenblatt 00dca9601e Update to Chromium version 92.0.4515.0 (#885287) 2021-06-10 16:42:44 -04:00
Marshall Greenblatt f2f52c1e2c Fix compile error due to missing include (see issue #2421) 2021-05-31 19:18:33 -04:00
Marshall Greenblatt e411b513be Add CefFrameHandler callbacks for tracking CefFrame lifespan (see issue #2421)
See the new cef_frame_handler.h for complete usage documentation.

This change includes the following related enhancements:
- The newly added CefBrowser::IsValid method will return false (in the browser
  process) after CefLifeSpanHandler::OnBeforeClose is called.
- CefBrowser::GetMainFrame will return a valid object (in the browser process)
  until after CefLifeSpanHandler::OnBeforeClose is called.
- The main frame object will change during cross-origin navigation or
  re-navigation after renderer process termination. During that time,
  GetMainFrame will return the new/pending frame (in the browser process) and
  any messages that arrive for the new/pending frame will be correctly
  attributed in OnProcessMessageReceived.
- Commands to be executed in the renderer process that may fail during early
  frame initialization (ExecuteJavaScript, LoadRequest, etc.) will now be
  queued until after the JavaScript context for the frame has been created.
- Logging has been added for any commands that are dropped because they arrived
  after frame detachment.
2021-05-31 18:58:27 -04:00
Marshall Greenblatt 5ddd26e483 Restore support for CreateBrowserSync with NULL |request_context| (see issue #2969)
This was unintentionally lost during the Chrome runtime refactoring effort.
2021-05-20 15:11:39 -04:00
Marshall Greenblatt 21ac0be8d7 Update process message unit test expectations (see issue #3126)
See related comments in commit f3c513ba.
2021-05-20 14:56:23 -04:00
Marshall Greenblatt f3c513bafd Allow a CefProcessMessage to remain valid after receipt (see issue #3126)
A reference to a received CefProcessMessage object and/or associated argument
list can now be kept outside of the OnProcessMessageReceived callback. The
argument list is no longer explicitly owned by the CefProcessMessage object
and can be individually assigned to other CefValue types as needed (e.g. by
passing to SetList, etc). Depending on client usage this could reduce the
potential for unnecessary copies of the list contents.

Received messages can also be sent back using SendProcessMessage (after which
the CefProcessMessage would become invalid as discussed in issue #3123). This
is not new behavior but we have now added explicit unit test coverage for it.
This also no longer requires a copy of the argument list contents.

Note that a received argument list is initially read-only for logical
consistency. Assignment to another CefValue object could potentially remove
the read-only status because it is not an intrinsic property of the underlying
Chromium data type. This is fine because, at that point, ownership has been
transfered to the new CefValue object and the original logical context (as
part of the CefProcessMessage) no longer applies.
2021-05-20 14:46:19 -04:00
Marshall Greenblatt d9efaee9b9 Fix routing of frame messages after cross-origin navigation (fixes issue #2849)
When navigating cross-origin a speculative RenderFrameHost (RFH) and
CefFrameHostImpl is created in the browser process for the new frame object
created in a new renderer process. The FrameAttached message then arrives for
the speculative RFH, and as a consequence interfaces are bound between the new
CefFrameHostImpl and the speculative RFH. If the pending navigation commits
then the existing RFH will be replaced with the previously speculative RFH.
Since interfaces are already bound we must keep the new CefFrameHostImpl. This
means that frame objects (including for the main frame) will now always change
after cross-origin navigation, and the old frame object will be invalidated.
2021-05-18 21:59:48 -04:00
Marshall Greenblatt ebee84755e Convert legacy IPC messages to Mojo (fixes issue #3123)
This change introduces a few minor CEF API behavior changes:

- A CefProcessMessage object cannot be reused after being passed to
  SendProcessMessage.
- The |extra_info| argument to CefRenderProcessHandler::OnBrowserCreated may
  now be NULL.

Where appropriate, we now utilize the default UTF string encoding format and
shared memory to reduce copies and conversions for the cross-process
transfer of arbitrary-length strings. For example, CefFrame::GetSource/GetText
now involves zero UTF conversions and zero copies in the browser process for
the CefString delivered to CefStringVisitor::Visit().
2021-05-18 21:59:48 -04:00
Marshall Greenblatt fde96be168 Fix crash closing DevTools window (fixes issue #3111) 2021-05-05 12:48:07 -04:00
Marshall Greenblatt 2de07250dc Restore async CreateBrowser behavior (fixes issue #3116, fixes issue #3118)
Restore the async CreateBrowser behavior that existed prior to commit 691c9c2
because executing synchronously (for example, from inside OnContextInitialized)
causes issues on MacOS and possibly other platforms.
2021-04-29 17:33:32 -04:00
Marshall Greenblatt 3ab91a45c9 chrome: Support configuration of accept language (see issue #2969)
This change adds support for CEF settings configuration of accept_language_list.
If specified, this value will take precedence over the "intl.accept_languages"
preference which is controlled by chrome://settings/languages.
2021-04-28 13:12:09 -04:00
Marshall Greenblatt c03a6f4386 chrome: Support configuration of user agent and locale (see issue #2969)
This change adds support for CefSettings and command-line configuration of
user_agent, user_agent_product (formerly product_version) and locale.
2021-04-27 12:39:12 -04:00
Marshall Greenblatt ae4f68f695 Update to Chromium version 91.0.4472.0 (#870763) 2021-04-23 11:38:51 -04:00
Marshall Greenblatt b189c7b472 Fix extension loading test failure 2021-04-22 17:15:14 -04:00
Marshall Greenblatt f84762d84a Fix crash closing DevTools window (fixes issue #3111) 2021-04-22 12:41:35 -04:00
Marshall Greenblatt cf1074cf49 chrome: Support configuration of renderer prefs (see issue #2969) 2021-04-17 21:23:55 -04:00
Marshall Greenblatt 9756e15a23 chrome: Don't rely on CREATE_STATUS_CREATED for disk-based profiles (see issue #2969) 2021-04-15 13:36:10 -04:00
Marshall Greenblatt 34c63a665d Wait for CefBrowserContext initialization (see issue #2969)
With the Chrome runtime, Profile initialization may be asynchronous. Code that
waited on CefBrowserContext creation now needs to wait on CefBrowserContext
initialization instead.
2021-04-14 21:03:44 -04:00
Marshall Greenblatt fc7f9ff505 Fix crash when navigating to an unregistered scheme (fixes issue #3105)
The policy->CanAccessDataForOrigin CHECK in NavigationRequest::
GetOriginForURLLoaderFactory was failing because unregistered schemes
(which are already considered non-standard schemes) didn't trigger the
registered non-standard scheme allowance that we previously added in
ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin. This change
modifies GetOriginForURLLoaderFactory to always return an opaque/unique
origin for non-standard schemes resulting in unregistered and non-standard
schemes receiving the same treatment.

New test coverage has been added for this condition, and can be run with:
ceftests --gtest_filter=CorsTest.*CustomUnregistered*
2021-04-12 16:18:37 -04:00
Marshall Greenblatt a4603c6f1a chrome: Support usage of the Chrome toolbar from Views (see issue #2969) 2021-04-11 20:44:28 -04:00
Marshall Greenblatt 5318dfe252 chrome: Fix PreferenceTest failures (see issue #2969) 2021-04-09 22:00:33 -04:00
Marshall Greenblatt 76642ccafa Move cookieable scheme configuration to settings (see issue #2969)
The Chrome runtime requires that cookieable scheme information be available
at Profile initialization time because it also triggers NetworkContext creation
at the same time. To make this possible, and to avoid various race conditions
when setting state, the cookieable scheme configuration has been added as
|cookieable_schemes_list| and |cookieable_schemes_exclude_defaults| in
CefSettings and CefBrowserContextSettings. The CefCookieManager::
SetSupportedSchemes and CefBrowserProcessHandler::GetCookieableSchemes methods
are no longer required and have been removed.

This change also modifies chrome to delay OffTheRecordProfileImpl initialization
so that |ChromeBrowserContext::profile_| can be set before
ChromeContentBrowserClientCef::ConfigureNetworkContextParams calls
CefBrowserContext::FromBrowserContext to retrieve the ChromeBrowserContext
and associated cookieable scheme information. Otherwise, the
ChromeBrowserContext will not be matched and the NetworkContext will not be
configured correctly.

The CookieTest suite now passes with the Chrome runtime enabled.
2021-04-09 15:04:24 -04:00
Marshall Greenblatt c565d9b1e6 Fix server thread assertion on CEF shutdown (see issue #2969)
The server thread was not guaranteed to be released in the correct scope on
CEF shutdown. This resulted in occasional thread_restrictions assertions on
ceftests shutdown after running the URLRequestTest suite with the Chrome
runtime enabled.
2021-04-09 14:22:51 -04:00
Marshall Greenblatt 09a9d9b54c chrome: Support customization of context menus (see issue #2969) 2021-04-08 19:38:29 -04:00
Marshall Greenblatt 701f51b1cc Fix URL rewrite on browser creation (see issue #2969)
The WebUITest suite now passes with the Chrome runtime enabled.
2021-04-07 18:56:07 -04:00
Marshall Greenblatt 4188cc2f75 Avoid potential use-after-free of CefIOThreadState (see issue #2969)
The problem occured while executing multiple URLRequestTest with the Chrome
runtime.
2021-04-07 18:19:46 -04:00
Marshall Greenblatt 09fa22898d chrome: Support client-created request contexts (see issue #2969)
RequestContextTest and URLRequestTest suites now pass with the Chrome runtime
enabled.
2021-04-07 18:19:17 -04:00
Marshall Greenblatt 09c6586480 chrome: Fix NavigationTest and ResourceRequestHandlerTest failures (see issue #2969) 2021-04-05 13:50:21 -04:00
Marshall Greenblatt 25701cfa6f chrome: Add support for reparenting of popups with Views (see issue #2969) 2021-04-02 16:53:34 -04:00
Marshall Greenblatt 7876a2f321 Move GetPrintHandler to CefClient (see issue #2196)
This new location is preferred because we now know the associated CefBrowser
for all CefPrintHandler callbacks.
2021-03-30 12:26:57 -04:00
Marshall Greenblatt f7a4c777e8 Remove CefBrowserSettings.web_security (fixes issue #3058) 2021-03-25 13:07:17 -04:00
Marshall Greenblatt b375397efb Fix crash in MediaRouterEnabled due to missing pref registration (see issue #2900) 2021-03-24 15:15:53 -04:00
Corentin Dumont 6574e1d914 Windows: Fix out-of-sync timestamps in OSR mode (fixes issue #3102) 2021-03-23 20:13:03 +00:00
Marshall Greenblatt 91ecc85e93 Fix potential use-after-free of V8TrackArrayBuffer (fixes issue #3074) 2021-03-23 16:02:51 -04:00
Marshall Greenblatt 96404f1fd9 Revert "Fix potential use-after-free of V8TrackArrayBuffer (fixes issue #3074)"
This reverts commit 64a1612b70.
2021-03-22 19:44:42 -04:00
Marshall Greenblatt 64a1612b70 Fix potential use-after-free of V8TrackArrayBuffer (fixes issue #3074) 2021-03-22 13:53:18 -04:00
Yannick 47f15dd307 Remove maximum frame rate limit with OSR (fixes issue #3077) 2021-03-18 17:46:03 +00:00
Dmitry Azaraev 505bf24abb chrome: Add DevTools protocol support (see issue #2969)
Testable with the following:
$ ceftests --enable-chrome-runtime --gtest_filter=DevToolsMessageTest.*
2021-03-18 13:32:56 -04:00
Marshall Greenblatt a17c59ce1d Fix renderer crash when printing a PDF file (fixes issue #3100) 2021-03-18 13:00:35 -04:00
Marshall Greenblatt 74db00fc89 Update to Chromium version 90.0.4430.0 (#857950)
- Linux ARM builds require use_vaapi=false (see https://crbug.com/1185348)
- Windows official builds require use_thin_lto=false (see https://crbug.com/1177001)
2021-03-18 11:23:00 -04:00
Marshall Greenblatt 1587d6da03 Update ArrayBuffer to use new BackingStore API (fixes issue #3074) 2021-03-12 12:36:47 -05:00
Marshall Greenblatt 8424f166cc Use the same pak files for the Alloy and Chrome runtimes (see issue #2969)
Chrome currently uses chrome_100_percent.pak, chrome_200_percent.pak,
resources.pak and locales/<locale>.pak files. This change adds CEF
resources to those existing pak files and updates the Alloy runtime to
use them instead of the previous CEF-specific pak files (cef.pak,
cef_100_percent.pak, cef_200_percent.pak, cef_extensions.pak,
devtools_resources.pak) which are no longer generated.

The addition of Chrome resources results in an ~16% (~4.1MB) increase in total
combined pak file size vs. the previous CEF-specific pak files. While a size
increase is not ideal for the Alloy runtime, it seems preferable to the
alternative of distributing separate (and partially duplicated) pak files for
each runtime, which would have added ~9.8MB to the total binary distribution
size.
2021-02-28 16:51:37 -05:00
Marshall Greenblatt a6a8c0e845 chrome: Fix URL rewrite on new tab navigation (see issue #2969)
This fixes an `Unhandled chrome.send("getApps");` error when creating a new tab.

Creating a new tab initially loads chrome://newtab which should then be
rewritten to chrome://new-tab-page for normal profiles in
HandleNewTabURLRewrite. Failure to rewrite the URL results in the loading of
NewTabUI instead of the expected NewTabPageUI. NewTabUI loads different
resources for normal vs incognito/guest profiles (new_tab.js vs
incognito_tab.js), and new_tab.js calls chrome.send("getApps") via
page_list_view.js. This then fails in WebUIImpl::ProcessWebUIMessage because
the message is unhandled.
2021-02-27 14:34:49 -05:00
Marshall Greenblatt 1d39ff720e Mac: Add Views API support (see issue #1749)
The Chrome browser can now be hosted in a Views-based application on Mac
(see issue #2969).

To launch a fully-featured Chrome window using cefsimple:
$ open cefsimple.app --args --enable-chrome-runtime

To launch a minimally-styled Views-hosted window using cefsimple:
$ open cefsimple.app --args --use-views [--enable-chrome-runtime]

To launch a fully-styled Views-hosted window using cefclient:
$ open cefclient.app --args --use-views [--enable-chrome-runtime]

Known issues:
- Some Views unit tests are currently failing on Mac.
2021-02-27 12:31:45 -05:00
Marshall Greenblatt 8733cb89c7 chrome: Add Views API integration (see issue #2969)
The Chrome browser can now be hosted in a Views-based application on Windows
and Linux.

To launch a fully-featured Chrome window using cefsimple:
$ cefsimple --enable-chrome-runtime

To launch a minimally-styled Views-hosted window using cefsimple:
$ cefsimple --enable-chrome-runtime --use-views

To launch a fully-styled Views-hosted window using cefclient:
$ cefclient --enable-chrome-runtime --use-views

Views unit tests also now pass with the Chrome runtime enabled:
$ ceftests --gtest_filter=Views* --enable-chrome-runtime

Known issues:
- Popup browsers cannot be intercepted and reparented.
2021-02-21 15:25:10 -05:00
Marshall Greenblatt 8f5fdc1f9a chrome: Add CEF-specific WebUI handling (see issue #2969)
To avoid conflicting IDs between Alloy (which uses cef.pak) and Chrome
(which uses chrome_100_percent.pak) the cef/LICENSE.txt file is now included
in both cef/libcef/resources/cef_resources.grd and
chrome/app/theme/chrome_unscaled_resources.grd with different ID values.

The cef.pak file currently contains both CEF-specific resources and Chrome
resources that are already included in the default *.pak files distributed
with Chrome. In the future we should remove this duplication and just
distribute the same *.pak files as Chrome for the majority of resources.
2021-02-15 18:24:52 -05:00
Marshall Greenblatt ec7067c55e chrome: Fix callbacks for different Profile types (see issue #2969)
- Only install network intercepts for Profiles that have an associated
  CefBrowserContext. For incognito windows the CefBrowserContext is
  associated with the OffTheRecordProfileImpl's original Profile.
- cefsimple: Return the default CefClient instance for browser windows
  created via the Chrome UI, and allow Chrome to show error pages.
2021-02-15 16:50:04 -05:00
Cristian Amarie 59c11404e6 Fix loading of URL without scheme (fixes issue #3079) 2021-02-10 13:33:51 -05:00
Marshall Greenblatt 5ef0fb8ac8 Update to Chromium version 89.0.4389.0 (#843830)
- SSE3 is now required on x86 processors (see https://crbug.com/1123353).
2021-02-08 14:15:38 -05:00
Marshall Greenblatt d06fdcff85 Add workaround for crash on Views popup window creation (see issue #3040) 2021-01-21 13:43:50 -05:00
Marshall Greenblatt 2a64387259 Add workaround for crash on popup window creation (see issue #3040) 2020-12-07 13:53:28 -05:00
Marshall Greenblatt a584bd187b Update to Chromium version 88.0.4324.0 (#827102)
- Mac: Xcode 12.2 and the MacOS 11.0 SDK are now required for building.
- MacOS 10.10 (Yosemite) is no longer supported (see https://crbug.com/1126056).
- Flash is no longer supported (see https://www.chromium.org/flash-roadmap).
2020-12-04 15:43:33 -05:00
Cristian Amarie 977cc71fd9 Win/Linux: Add support for chrome://sandbox (fixes issue #3029) 2020-10-29 17:55:45 +00:00
Marshall Greenblatt 023d218104 Move OnCursorChange from CefRenderHandler to CefDisplayHandler
The cursor change can now be handled by the client with both windowed and
off-screen rendering.

Returning true from OnCursorChange will disable the default cursor change
behavior. This is functionally equivalent to the
CefBrowserHost::SetMouseCursorChangeDisabled method, so that method has been
removed.
2020-10-28 12:56:27 -04:00
Marshall Greenblatt 015e3621a3 Update to Chromium version 87.0.4280.0 (#812852)
- Windows: VS2015 Update 2 is now the minimum version requirement for linking
  cef_sandbox from official build binary distributions.
2020-10-15 14:21:06 -04:00
Marshall Greenblatt 4fbd247231 Add chrome runtime support for more callbacks and ceftests (see issue #2969)
This change adds support for:
- Protocol and request handling.
- Loading and navigation events.
- Display and focus events.
- Mouse/keyboard events.
- Popup browsers.
- Callbacks in the renderer process.
- Misc. functionality required for ceftests.

This change also adds a new CefBrowserProcessHandler::GetCookieableSchemes
callback for configuring global state that will be applied to all
CefCookieManagers by default. This global callback is currently required by the
chrome runtime because the primary ProfileImpl is created via
ChromeBrowserMainParts::PreMainMessageLoopRun (CreatePrimaryProfile) before
OnContextCreated can be called.

ProfileImpl will use the "C:\Users\[user]\AppData\Local\CEF\User Data\Default"
directory by default (on Windows). Cookies may persist in this directory when
running ceftests and may need to be manually deleted if those tests fail.

Remaining work includes:
- Support for client-created request contexts.
- Embedding the browser in a Views hierarchy (cefclient support).
- TryCloseBrowser and DoClose support.
- Most of the CefSettings configuration.
- DevTools protocol and window control (ShowDevTools, ExecuteDevToolsMethod).
- CEF-specific WebUI pages (about, license, webui-hosts).
- Context menu customization (CefContextMenuHandler).
- Auto resize (SetAutoResizeEnabled).
- Zoom settings (SetZoomLevel).
- File dialog runner (RunFileDialog).
- File and JS dialog handlers (CefDialogHandler, CefJSDialogHandler).
- Extension loading (LoadExtension, etc).
- Plugin loading (OnBeforePluginLoad).
- Widevine loading (CefRegisterWidevineCdm).
- PDF and print preview does not display.
- Crash reporting is untested.
- Mac: Web content loads but does not display.

The following ceftests are now passing when run with the
"--enable-chrome-runtime" command-line flag:

CorsTest.*
DisplayTest.*:-DisplayTest.AutoResize
DOMTest.*
DraggableRegionsTest.*
ImageTest.*
MessageRouterTest.*
NavigationTest.*
ParserTest.*
RequestContextTest.*Global*
RequestTest.*
ResourceManagerTest.*
ResourceRequestHandlerTest.*
ResponseTest.*
SchemeHandlerTest.*
ServerTest.*
StreamResourceHandlerTest.*
StreamTest.*
StringTest.*
TaskTest.*
TestServerTest.*
ThreadTest.*
URLRequestTest.*Global*
V8Test.*:-V8Test.OnUncaughtExceptionDevTools
ValuesTest.*
WaitableEventTest.*
XmlReaderTest.*
ZipReaderTest.*
2020-09-29 18:31:43 -04:00
Marshall Greenblatt e94a261bf5 Rename CefBrowserHostImpl to AlloyBrowserHostImpl (see issue #2969)
After commit 38d8acfa18 this object is only used with the alloy runtime.
2020-09-22 17:36:06 -04:00
Marshall Greenblatt 9022d40e6a Add missing print preview resources and prefs (fixes issue #2989) 2020-09-22 17:36:06 -04:00
Marshall Greenblatt 38d8acfa18 Create a ChromeBrowserHostImpl for every Chrome tab (see issue #2969)
The Browser object represents the top-level Chrome browser window. One or more
tabs (WebContents) are then owned by the Browser object via TabStripModel. A
new Browser object can be created programmatically using "new Browser" or
Browser::Create, or as a result of user action such as dragging a tab out of an
existing window. New or existing tabs can also be added to an already existing
Browser object.

The Browser object acts as the WebContentsDelegate for all attached tabs. CEF
integration requires WebContentsDelegate callbacks and notification of tab
attach/detach. To support this integration we add a cef::BrowserDelegate
(ChromeBrowserDelegate) member that is created in the Browser constructor and
receives delegation for the Browser callbacks. ChromeBrowserDelegate creates a
new ChromeBrowserHostImpl when a tab is added to a Browser for the first time,
and that ChromeBrowserHostImpl continues to exist until the tab's WebContents
is destroyed. The associated WebContents object does not change, but the
Browser object will change when the tab is dragged between windows.

CEF callback logic is shared between the chrome and alloy runtimes where
possible. This shared logic has been extracted from CefBrowserHostImpl to
create new CefBrowserHostBase and CefBrowserContentsDelegate classes. The
CefBrowserHostImpl class is now only used with the alloy runtime and will be
renamed to AlloyBrowserHostImpl in a future commit.
2020-09-21 17:06:56 -04:00
Marshall Greenblatt f2c0c3f8fb Add support for prefers-color-scheme media queries (fixes issue #2824) 2020-09-15 12:34:22 -04:00
Marshall Greenblatt 5f9bd3ecbd Fix crash when sending programmatic event to a Views-hosted browser window.
The |web_contents_| member was nullptr in CefBrowserPlatformDelegateNativeAura
when calling methods like SendKeyEvent from CefBrowserPlatformDelegateViews.
2020-09-15 11:19:04 -04:00
Marshall Greenblatt 8796d3cd95 Persist media device IDs across navigation and restart (fixes issue #2064)
Media device IDs will now be persisted across navigation and reload by default.
The device IDs will also be persisted across restart if --cache-path=<path> and
--persist-user-preferences settings are specified.
2020-09-14 16:28:23 -04:00
Marshall Greenblatt cc56720bd2 Support CORS preflight requests with OutOfBlinkCors (fixes issue #3006)
A CORS preflight request is an "OPTIONS" request sent to a server prior to a
cross-origin XMLHttpRequest or Fetch request. The server's response determines
which HTTP request methods are allowed and supported, and whether credentials
such as Cookies and HTTP Authentication should be sent with requests.

A CORS preflight request will only be sent if certain conditions are met. For
example, it will be sent for requests that have potentially unsafe HTTP
methods [1] or request headers [2]. See the NeedsPreflight function in
services/network/cors/cors_url_loader.cc for full details.

CORS preflight functionality is implemented in the network service and will not
be triggered if the client handles the request instead of allowing it to proceed
over the network. Since the preflight request itself also runs in the network
service it cannot be intercepted by the client.

[1] https://fetch.spec.whatwg.org/#cors-safelisted-method
[2] https://fetch.spec.whatwg.org/#cors-safelisted-request-header
2020-09-11 19:21:53 -04:00
Marshall Greenblatt 88faf1023a Fix incorrect Origin and Cookie headers for POST redirects (fixes issue #2806)
This change also adds unit test coverage for cross-origin POST redirects.
2020-09-09 18:30:12 -04:00
Marshall Greenblatt 42f517ec69 Fix DCHECK failure in the URLLoader constructor.
The request.trusted_params.isolation_info.site_for_cookies value must
match request.site_for_cookies.

This change also adds unit test coverage for cross-origin GET redirects.
2020-09-09 18:29:21 -04:00
Marshall Greenblatt 4791109a28 Don't save or load cookies for non-cookieable scheme requests.
This fixes an IsCanonical() DCHECK failure triggered by calling
CanonicalCookie::Create for a non-cookieable URL.

This change also adds unit test coverage for cross-origin cookie
behavior with sub-resource requests (iframe, XHR, Fetch).
2020-09-09 18:29:15 -04:00
Marshall Greenblatt 59a779c38a Disable Badging API which is not supported (fixes issue #3005) 2020-09-03 17:52:09 -04:00
Marshall Greenblatt b579b37db4 views: Support specification of screen bounds for CefWindow creation (fixes issue #2980) 2020-09-03 17:51:57 -04:00
Marshall Greenblatt e6047bd54b Restore the CefRenderHandler::OnScrollOffsetChanged callback (fixes issue #2810) 2020-09-03 17:51:09 -04:00
Marshall Greenblatt 24c2f2fa38 Update to Chromium version 86.0.4240.0 (#800218)
- CefURLRequest::Create is no longer supported in the renderer process
  (see https://crbug.com/891872). Use CefFrame::CreateURLRequest instead.
- Mac platform definitions have been changed from `MACOSX` to `MAC`
  (see https://crbug.com/1105907) and related CMake macro names have
  been updated. The old `OS_MACOSX` define is still set in code and CMake
  for backwards compatibility.
- Linux ARM build is currently broken (see https://crbug.com/1123214).
2020-09-03 17:44:25 -04:00
Marshall Greenblatt 6b1e5335bc Add support and enable out-of-Blink CORS (fixes issue #2716)
It can still be disabled for a short time by passing
`--disable-features=OutOfBlinkCors` on the command-line.
2020-08-26 16:25:25 -04:00
Masako Toda 87c8a72831 Fix initial transparency delay for OSR + gpu-disabled (see issue #2938) 2020-08-13 14:50:40 -04:00
Cristian Amarie 11f37bc6eb Add limit on request redirects (fixes issue #3001) 2020-08-13 18:45:26 +00:00
Marshall Greenblatt b822ea43b9 Fix DCHECK when showing print preview dialog (see issue #2952) 2020-07-23 15:46:57 -04:00
Marshall Greenblatt ac99621829 Fix link navigation from PDF files (fixes issue #2952)
Navigations initiated from a guest view will now be routed to the
OpenURLFromTab callback.
2020-07-23 14:48:25 -04:00
Masako Toda a3919cb0ec Fix excessive CPU usage with external and multi-threaded message loops (fixes issue #2809, fixes issue #2970). 2020-07-21 16:26:41 +00:00
Mike Wiedenbauer 034bd641de Return decompressed values from CefResourceBundle (fixes issue #2976) 2020-07-21 15:55:54 +00:00
Masako Toda ca1c00f95d Fix timing of InstallTransparency for OSR + gpu-disabled (see issue #2938) 2020-07-20 20:01:13 +00:00
Andrei Kurushin 574d4dcedc Fix crash when closing an OSR browser (fixes issue #2919)
Release the Compositor before the WebContents is destroyed to match
the behavior in non-OSR code.
2020-07-20 14:33:00 -04:00
Cristian Amarie 82d6bcbbea Properly disable the notification and push APIs (fixes issue #2951) 2020-07-20 18:16:48 +00:00
Marshall Greenblatt e87fedd27c Fix shutdown crash in InitNetworkContext with multi-threaded message loop (fixes issue #2985) 2020-07-20 13:49:16 -04:00
Marshall Greenblatt e8573173dd Expose MediaSink device ip/port and model name (see issue #2900) 2020-07-16 19:11:19 -04:00
Marshall Greenblatt 13e3c8b42a Fix official build errors caused by chrome runtime changes (see issue #2969) 2020-07-16 19:11:18 -04:00
Marshall Greenblatt 280c9127c1 Remove render thread created callbacks (see issue #2498)
With site-per-process enabled a spare renderer process will be created
for use with a future browser or navigation. Consequently the
|extra_info| parameter populated in OnRenderProcessThreadCreated will no
longer be delivered to OnRenderThreadCreated in the expected renderer
process. To avoid confusion these callbacks have been removed completely.

After this change CefRenderProcessHandler::OnWebKitInitialized should
be used for startup tasks in the render process, and OnBrowserCreated
should be used in the render process to recieve |extra_info| passed from
CefBrowserHost::CreateBrowser or CefLifeSpanHandler::OnBeforePopup.
2020-07-16 19:11:18 -04:00
Marshall Greenblatt 6573df6cc3 Update to Chromium version 85.0.4183.0 (#782793)
- Windows: 10.0.19041 SDK is now required.
- macOS: 10.15.1 SDK (at least Xcode 11.2) is now required.
- Remove CefMediaSource::IsValid and CefMediaSink::IsValid which would
  always return true.
2020-07-16 19:11:12 -04:00
Marshall Greenblatt 03c9156c80 Fix build and initial Chrome runtime issues on macOS (see issue #2969)
This change moves shared resource initialization to a common location and
disables crash reporting initialization in chrome/ code via patch files.

When using the Chrome runtime on macOS the Chrome application window will
display, but web content is currently blank and the application does not
exit cleanly. This will need to be debugged further in the future.
2020-07-06 15:20:53 -04:00
Marshall Greenblatt 02cdf05848 Move Alloy-specific logic to CefBrowserPlatformDelegateAlloy (see issue #2969)
Also remove OSR-related methods where the attributes can instead be passed
to the OSR platform delegate constructor directly.
2020-07-04 16:13:30 -04:00
Marshall Greenblatt e9bf3cdb98 Add initial Chrome runtime support for browser APIs (see issue #2969)
This change adds basic Chrome runtime implementations for CefBrowserContext
and CefBrowserPlatformDelegate. A Chrome browser window with default frame
and styling can now be created using CefBrowserHost::CreateBrowser and some
CefClient callbacks will be triggered via the WebContentsObserver
implementation in CefBrowserHostImpl.

Any additional browser windows created via the Chrome UI will be unmanaged
by CEF. The application message loop will block until all browser windows
have been closed by the user.
2020-07-04 16:13:30 -04:00
Marshall Greenblatt 6cb9f0c695 Move browser runtime-specific logic to CefBrowserPlatformDelegate (see issue #2969)
This change moves the runtime-specific implementations of CefBrowserHostImpl
methods to CefBrowserPlatformDelegate. Some WebContentsDelegate methods
implemented by CefBrowserHostImpl set state or trigger client callbacks.
Those implementations will likely stay with CefBrowserHostImpl and will
need to be called from the Browser equivalents when using the Chrome runtime.
2020-07-03 18:09:52 -04:00
Marshall Greenblatt 6152d68b6a Make chrome://chrome-urls an alias for chrome://webui-hosts (fixes issue #2977) 2020-07-02 15:44:48 -04:00
Marshall Greenblatt 88b88251e7 Fix decoding of resources (fixes issue #2966)
Use LoadDataResourceString instead of GetDataResource. It will perform
decoding if necessary.
2020-07-02 14:45:23 -04:00
Marshall Greenblatt 48fc0bd220 Make CefBrowserContext an abstract base class (see issue #2969)
Existing CefBrowserContext functionality is now split between
CefBrowserContext and AlloyBrowserContext. Runtime implementations of
CefBrowserContext will provide access to the content::BrowserContext and
Profile types via different inheritance paths. For example, the Alloy
runtime uses ChromeProfileAlloy and the Chrome runtime uses ProfileImpl.

This change also renames CefResourceContext to CefIOThreadState to more
accurately represent its purpose as it no longer needs to extend
content::ResourceContext.
2020-07-01 15:35:07 -04:00
lwttai.lu 619f18fea0 Windows: File dialog add filter with all supported extensions as default (see issue #860) 2020-06-30 18:45:50 +00:00
Cristian Amarie 7b518511df Fix crash when reading malformed Flash manifest file (fixes issue #2948) 2020-06-30 18:44:14 +00:00