Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Chromium Site Isolation #2967

Closed
1 task done
amaitland opened this issue Nov 8, 2019 · 15 comments
Closed
1 task done

Enable Chromium Site Isolation #2967

amaitland opened this issue Nov 8, 2019 · 15 comments
Assignees
Milestone

Comments

@amaitland
Copy link
Member

amaitland commented Nov 8, 2019

CEF recently added support for https://bitbucket.org/chromiumembedded/cef/issues/2498/add-support-for-site-per-process

We should now look at properly supporting the process model as it's now the CEF default.

Related issue #2553

@amaitland
Copy link
Member Author

WPF version will require disable-site-isolation-trials command line arg until upstream issue #2789 has been resolved

@amaitland
Copy link
Member Author

amaitland added a commit that referenced this issue Dec 3, 2019
…ss-per-site-instance arg

Steps towards supporting Chromium Site Isolation

Issue #2967
@amaitland
Copy link
Member Author

Site isolation trials disabled for all WPF/WinForms/OffScreen in commit 93336a0 Now using the default process model (chromium site isolation project)

@amaitland
Copy link
Member Author

WPF version will require disable-site-isolation-trials command line arg until upstream issue #2789 has been resolved

This has been resolved (builds haven't been updated yet)

https://bitbucket.org/chromiumembedded/cef/issues/2814/process-messages-cant-be-sent-to-all

Cannot remove disable-site-isolation-trials until this is solved.

@amaitland
Copy link
Member Author

@amaitland
Copy link
Member Author

Issue has been resolved see https://bitbucket.org/chromiumembedded/cef/issues/2849/siteisolation-process-message-from-browser#comment-60550396

There are potential changes to how frames are handled that need to be evaluated.

@amaitland amaitland added this to the 91.1.x milestone May 19, 2021
@amaitland
Copy link
Member Author

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.

Cross origin navigations now invalidate the main frame.

amaitland added a commit that referenced this issue Jun 4, 2021
CEF has changed it's behaviour slightly to correctly support Chromium Site Isolation
Frame objects (including for the main frame) will now always change after
cross-origin navigation, and the old frame object will be invalidated.
See commit for additional details https://bitbucket.org/chromiumembedded/cef/commits/d9efaee9b9aa

Resolves #2967
@amaitland
Copy link
Member Author

With site isolation enabled many of the tests (pretty much anything that uses the IPC) will fail, so reverting for now and reopening.

@amaitland amaitland reopened this Jun 5, 2021
@amaitland amaitland modified the milestones: 91.1.x, 92.0.x Jun 16, 2021
@amaitland amaitland removed this from the 92.0.x milestone Aug 9, 2021
@amaitland amaitland added this to the 94.0.x milestone Sep 5, 2021
@amaitland
Copy link
Member Author

Adding this to the 94 milestone as a reminder to revisit, debugging should be done before Chrome decides to remove disable-site-isolation-trials and we're forced to upgrade.

@amaitland amaitland modified the milestones: 94.3.x, 95.7.x Sep 28, 2021
@StefanoBalzarottiEnnova

When do you plan to fix this issue? There is a workaround to use CEFSharp with site isolation? This feature is critical for my application,

@NinjaCross
Copy link

This is highly critical fro my company too.
Is there a release date for this ?

@amaitland
Copy link
Member Author

There is nothing stopping you from using site isolation now, it's simply disabled by default. You can remove the disable-site-isolation-trials command line arg and test your application.

This isn't really something that I can fix directly, it'll be reporting any problems upstream and waiting for a fix.

@amaitland amaitland changed the title Support Chromium Site Isolation Enable Chromium Site Isolation Oct 13, 2021
amaitland added a commit that referenced this issue Oct 14, 2021
…gin first

When Chromium Site Isolation is enabled we must first navigate to
a web page of the same origin to use LoadRequest
When Site Isolation is disabled we can navigate to any web page
https://magpcss.org/ceforum/viewtopic.php?f=10&t=18672&p=50266#p50249

Issue #2967
amaitland added a commit that referenced this issue Oct 14, 2021
Previously was disabled by default

Can still be disabled via disable-site-isolation-trials command line argument

Issue #2967
odo-leni added a commit to odo-leni/CefSharp that referenced this issue Oct 15, 2021
commit aac5439
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Thu Oct 14 19:37:15 2021 +1000

    Test - Fix compile error

commit 439970d
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Thu Oct 14 19:28:44 2021 +1000

    Test - Fix NetCore test case

commit 1a85419
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Thu Oct 14 13:00:08 2021 +1000

    Test - Output QUnit results if tests failed

commit db9e041
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Thu Oct 14 12:58:42 2021 +1000

    build.ps1 - Remove TernaryReturn as no longer used

commit f904b88
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Thu Oct 14 12:43:35 2021 +1000

    build.ps1 - Improve vswhere programfiles check

commit 221185b
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Thu Oct 14 10:16:27 2021 +1000

    WinForms/WPF/OffScreen - Enable Chromium Site Isolation by default

    Previously was disabled by default

    Can still be disabled via disable-site-isolation-trials command line argument

    Issue cefsharp#2967

commit fd78c0c
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Thu Oct 14 10:11:33 2021 +1000

    Test - CanLoadRequestWithPostData now navigates to domain of same origin first

    When Chromium Site Isolation is enabled we must first navigate to
    a web page of the same origin to use LoadRequest
    When Site Isolation is disabled we can navigate to any web page
    https://magpcss.org/ceforum/viewtopic.php?f=10&t=18672&p=50266#p50249

    Issue cefsharp#2967

commit c72e21c
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Wed Oct 13 20:50:45 2021 +1000

    build.ps1 - Nuget Package only a subset of architectures

    - Can now build/package only a subset of architectures
    - Remove file elements from nuspec if arch wasn't specified
    - Reorder and simplify script

    .\build.ps1 -BuildArches "x64"

    Issue cefsharp#3706

commit 7c2226c
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Wed Oct 13 13:32:38 2021 +1000

    Nuget - Update dependency groups

    Resolves nuget pack warning

commit 8aa0ee5
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Wed Oct 13 13:18:56 2021 +1000

    build.ps1 - Cleanup

    - Fail fast if nuget.exe not found
    - Check for VSWhere at build start
      (should always be installed as it's included in VS2019 and above)
    - Remove netcore31 from $Target valid set, we'll just rely on the
      $TargetFramework
    - Push-Location to working directory for easier debugging

commit 13c725c
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Wed Oct 13 12:08:59 2021 +1000

    build.ps1 - Reorder scripts so functions are declared first

commit 7c57c10
Author: Mitch Capper <mitch.capper@gmail.com>
Date:   Mon Oct 11 02:12:26 2021 -0700

    Add netcore to toolchain (it uses same VS version)

commit da0f33b
Author: Mitch Capper <mitch.capper@gmail.com>
Date:   Mon Oct 11 01:51:53 2021 -0700

    Added vs2022 support and v143 targetting.  VS2022 can also build V142 but requires some additions to the project files to indicate targeting it instead.  This should not change behavior for anyone as you must specific specify the 2022 target for it to work.

commit 2af10bf
Author: Mitch Capper <mitch.capper@gmail.com>
Date:   Sun Oct 10 06:42:02 2021 -0700

    build.ps1 and build.netcore.ps1 merge and architecture target added

commit 66bb6c0
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Wed Oct 13 11:50:00 2021 +1000

    Nuget - Remove netcoreapp3.0 hacks

    For those unable to upgrade to .Net Core 3.1 then the old packages should still be usable by specifying AssetTargetFallback as detailed in https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#assettargetfallback

    Resolves cefsharp#3444

commit 42e7b90
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Wed Oct 13 09:14:22 2021 +1000

    appveyor.yml - Update CefSharp.Test.dll path

    Runtime identifier was changed to win7-x64 so the path changed

commit bd88019
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Wed Oct 13 08:59:03 2021 +1000

    Test - Add RuntimeIdentifiers and fix build.ps1

    - Seems the Nuget restore doesn't work correctly without having RuntimeIdentifiers set
      Must also set RuntimeIdentifier manually so the files are copied correctly.
    - Move the msbuild restore after the vcvarsall.bat call so the script runs successfully

commit ee431d7
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Wed Oct 13 06:45:58 2021 +1000

    Test - Add RuntimeIdentifiers so libcef.dll etc copied to output folder

    - Adding <RuntimeIdentifiers/> didn't work as expected so set RuntimeIdentifier based on PlatformTarget
    - Updated appveyor.yml as output path for CefSharp.Test.dll changed

commit 5356e1b
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Wed Oct 13 05:15:34 2021 +1000

    Test - Update Nuget PackageReferences

    - Forgot to change to the chromiumembeddedframework.runtime package
    - Simplify references

    Follow up to cefsharp@67a08c4

    Issue cefsharp#3706

commit 67a08c4
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Sun Oct 10 15:44:47 2021 +1000

    BrowserSubProcess/Examples/Tests - Migrate to newer SDK Style projects

    - Migrate to new SDK style projects
    - Migrate to chromiumembeddedframework.runtime packages
    - Remove old packages.config files
    - Update post build event for BrowserSubprocess to set TSAware/LargeAddressAware
    - Change project build order

    Issue cefsharp#3706

commit 6953d82
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Mon Oct 11 10:26:35 2021 +1000

    Net Core - Nupkg Include xml files

    Issue cefsharp#3843

commit bfa8ccf
Author: Andrew Smith <andrews@infragistics.com>
Date:   Sun Oct 10 20:16:07 2021 -0400

    WPF - IME Only use GCS_CURSORPOS if an adjacent character is new input (cefsharp#3846)

    * Change Wpf IME handling to only use the cursor pos when an adjacent character is new input

    * Meant to change both character before and after

    * Ensure the cursor pos is > 0 when checking the character before

commit 544abc6
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Mon Oct 11 10:13:55 2021 +1000

    Revert "WinForms/WPF/OffScreen - Add WaitForBrowserInitialLoadAsync"

    Tests started failing so will revisit later.

    This reverts commit 08e5140.

commit 8bbe6a4
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Sun Oct 10 15:01:15 2021 +1000

    WPF - Fix Address Load being called multiple times after browser created

commit 0812ea9
Author: Konstantin Preißer <kpreisser@users.noreply.github.com>
Date:   Sun Oct 10 11:56:50 2021 +0200

    Don't check for presence of "d3dcompiler_47.dll" when running as ARM64, because that file isn't present in the CEF Redist for this architecture. (cefsharp#3841)

    Issue cefsharp#2944

commit 08e5140
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Sun Oct 10 14:41:04 2021 +1000

    WinForms/WPF/OffScreen - Add WaitForBrowserInitialLoadAsync

    Change all the tests to use WaitForBrowserInitialLoadAsync instead of LoadUrlAsync
    as LoadUrlAsync will require a Url as part of cefsharp#3842

commit 15cf58c
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Fri Oct 8 13:05:27 2021 +1000

    Core - Add IRequestContext.GetCookieManagerAsync extension method

    - Will return the cookie manager when the backing store has loaded
      otherwise returns null

commit b82fa05
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Fri Oct 8 12:40:54 2021 +1000

    WinForms/WPF/OffScreen - Update Load(string url) behaviour

    - All three implementations updated to include an IsDisposed check which
      will simply return immediately
    - OffScreen updated to match the WinForms behaviour
    - WPF is more complex because of the initialAddress and Address properties
      initialAddress will be set if the browser hasn't been created, if the browserCreated
      has been created and OnAfterBrowserCreated hasn't been called then we'll set the Address
      dependency property.

    NOTE: For WinForms/OffScreen there's a small window
    here between CreateBrowser and OnAfterBrowserCreated
    where the Address prop will be updated, though LoadUrl
    won't be called.

commit c226d34
Author: Alex Maitland <amaitland@users.noreply.github.com>
Date:   Fri Oct 8 10:21:31 2021 +1000

    WinForms/WPF/OffScreen - Add LoadUrl method (Same as Load(string)).

    A more meaningful name for the method, matches the LoadUrlAsync method
    that was added recently.
@amaitland
Copy link
Member Author

Commit 221185b enabled site isolation by default for master

The CanLoadRequestWithPostData test has been updated in commit fd78c0c to native to a domain of the same origin before attempting to call LoadRequest.

LoadRequest calls will fail otherwise as discussed at https://magpcss.org/ceforum/viewtopic.php?f=10&t=18672&p=50266#p50249

Tests are passing with the exception of IntegrationTestFacts.LoadLegacyJavaScriptBindingQunitTestsSuccessfulCompletion. Same test passes when I run it through Visual Studio Test Explorer. A new issue should be created and debugged at some point to determine the cause and evaluate if it's fixable or if upstream changes are required.

At this point I'll leave Site Isolation enabled by default for version 95 which can be disabled if required.

@amaitland
Copy link
Member Author

Chromium Site Isolation is now enabled by default in 95.7.140-pre which is now available for testing.

You can still manually disable via the disable-site-isolation-trials command line arg. e.g.

var settings = new CefSettings()
{
	//By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
	CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache")
};

settings.CefCommandLineArgs.Add("disable-site-isolation-trials");

Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);

Tests are passing with the exception of IntegrationTestFacts.LoadLegacyJavaScriptBindingQunitTestsSuccessfulCompletion. Same test passes when I run it through Visual Studio Test Explorer. A new issue should be created and debugged at some point to determine the cause and evaluate if it's fixable or if upstream changes are required.

Issue #3867 has been created to track investigating the failures. Any problems using Legacy JavaScript Binding then you'll need to disable Chromium Site Isolation


If you are using CefSharp in a commercial product and not already a sponsor then please consider supporting my efforts. Developing/maintaining/supporting the project takes a considerable amount of time.

@amaitland
Copy link
Member Author

amaitland commented Nov 15, 2021

Known behaviour changes in CEF are as follows: - A spare renderer process may be created on initial browser creation or cross- origin navigation. This spare process may be used with a future cross-origin navigation or discarded on application shutdown.

As per chromiumembedded/cef#2498 (comment).

With Site Isolation enabled it's expected there is a spare render process is created and will exist until Cef.Shutdown has been called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants