Skip to content

v146.0.70 JavaScript CefSharp object not availlable when loading via GET -> POST -> POST (iframe) #5228

Description

@campersau

Is there an existing issue for this?

  • I have searched both open/closed issues, no issue already exists.

CefSharp Version

146.0.70

Operating System

Windows 11

Architecture

x64

.Net Version

.NET 10

Implementation

OffScreen

Reproduction Steps

The reproduction is quite involved that's why I created a separate repro https://github.com/campersau/CefSharp146BindObject

Expected behavior

CefSharp object should be available in iframe.

Actual behavior

CefSharp object is not available in iframe.

Regression?

Yes, worked in version 145.0.260 and before.

Known Workarounds

Not yet.

Does this problem also occur in the CEF Sample Application

Not Tested

Other information

The following error gets logged:

[61096:32296:0330/115323.606:ERROR:C:\projects\cefsharp\CefSharp.BrowserSubprocess.Core\CefAppUnmanagedWrapper.cpp:404] Failed to identify BrowserWrapper in OnContextCreated BrowserId:1

Activity

  1. changed the title [-]v146.0.70 CefSharp object not availlable when loading via GET -> POST -> POST (iframe)[/-] [+]v146.0.70 JavaScript CefSharp object not availlable when loading via GET -> POST -> POST (iframe)[/+] on Mar 30, 2026
  2. amaitland commented on Mar 31, 2026

    @amaitland
    Member

    Possibly because of #5218

  3. amaitland commented on Mar 31, 2026

    @amaitland
    Member

    The reproduction is quite involved that's why I created a separate repro https://github.com/campersau/CefSharp146BindObject

    Get a 404 when trying to open

  4. campersau commented on Mar 31, 2026

    @campersau
    ContributorAuthor

    Possibly because of #5218

    Yes, it looks like it. Now the browserWrapper is required, before it wasn't even used to setup the bindings.

    auto browserWrapper = FindBrowserWrapper(browser->GetIdentifier());
    if (browserWrapper != nullptr && browserWrapper->JavascriptBindingApiEnabled && IsJavascriptBindingApiAllowed(browserWrapper, frame))

    https://github.com/cefsharp/CefSharp/pull/5218/changes#diff-357680293df8761a33d94272a6a9faaa1528bb062412c8d3893de9ba94e030a5R168-R170

    https://github.com/cefsharp/CefSharp/pull/5218/changes#diff-357680293df8761a33d94272a6a9faaa1528bb062412c8d3893de9ba94e030a5L154

  5. campersau commented on Mar 31, 2026

    @campersau
    ContributorAuthor

    I debugged this a bit with https://ci.appveyor.com/project/campersau/cefsharp/build/artifacts to see when browserwrappers are added / removed. And this is the log:

    INDEX PAGE
    [87396:13172:0331/110222.002:ERROR:C:\projects\cefsharp\CefSharp.BrowserSubprocess.Core\CefAppUnmanagedWrapper.cpp:68] Added BrowserWrapper in OnBrowserCreated BrowserId: 1 Added: True
    [87396:13172:0331/110222.247:ERROR:C:\projects\cefsharp\CefSharp.BrowserSubprocess.Core\CefAppUnmanagedWrapper.cpp:68] Added BrowserWrapper in OnBrowserCreated BrowserId: 1 Added: False
    FORM POST SUBMIT
    [87396:13172:0331/110222.301:ERROR:C:\projects\cefsharp\CefSharp.BrowserSubprocess.Core\CefAppUnmanagedWrapper.cpp:140] Removed BrowserWrapper in OnBrowserDestroyed BrowserId: 1
    FORM POST SUBMIT IFRAME
    [87396:13172:0331/110222.594:ERROR:C:\projects\cefsharp\CefSharp.BrowserSubprocess.Core\CefAppUnmanagedWrapper.cpp:420] Failed to identify BrowserWrapper in OnContextCreated BrowserId: 1
    

    The browser is tried to be added twice and then removed once.
    When submitting via POST the browser gets destroyed (no other browser gets created though), and then it isn't found anymore.

  6. amaitland commented on Mar 31, 2026

    @amaitland
    Member

    When submitting via POST the browser gets destroyed (no other browser gets created though), and then it isn't found anymore.

    Sounds like a bug in CEF. Any chance you could test with the --disable-request-handling-for-testing command line arg to see if CEF's request interceptor is part of the problem.

  7. campersau commented on Mar 31, 2026

    @campersau
    ContributorAuthor

    Same output with

    cefsettings.CefCommandLineArgs.Add("disable-request-handling-for-testing");
  8. amaitland commented on Mar 31, 2026

    @amaitland
    Member

    Thanks for testing.

  9. added this to the 146.0.x milestone on Apr 10, 2026
  10. campersau commented on May 5, 2026

    @campersau
    ContributorAuthor

    FYI: I tested it with 147 (campersau@9f8c038) again and the issue is still there.
    I guess it was there previously but we haven't noticed it until #5218

  11. amaitland commented on May 6, 2026

    @amaitland
    Member

    I think it's relatively recent as there are reports of issues with the WCF channel being disposed starting in 145

    #5232
    #5233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions