Skip to content

Custom (non-http) scheme navigation never completes -- root cause confirmed, matches upstream #445 #15

Description

@Thrameos

Summary

Confirmed locally with a definitive root-cause verification, reproduces on this fork's current CEF version (146.0.10+g8219561+chromium-146.0.7680.179): matches upstream chromiumembedded/java-cef#445, reported from WSL2 Ubuntu -- the exact environment this fork's entire test suite runs in.

native/util_posix.cpp's GetTempFileName() concatenates the temp directory path and filename with no separator:

std::string GetTempFileName(const std::string& identifer, bool useParentId) {
  std::stringstream tmpName;
  CefString tmpPath;
  if (!CefGetPath(PK_DIR_TEMP, tmpPath))
    tmpPath = "/tmp/";
  tmpName << tmpPath.ToString().c_str();
  tmpName << "jcef-p" << (useParentId ? util::GetParentPid() : util::GetPid());
  tmpName << (identifer.empty() ? "" : "_") << identifer.c_str() << ".tmp";
  return tmpName.str();
}

If CefGetPath(PK_DIR_TEMP, tmpPath) succeeds and returns a path without a trailing slash -- which is exactly what Chromium's base::GetTempDir() does on Linux -- the result is a malformed path (e.g. /tmpjcef-p1234.tmp instead of /tmp/jcef-p1234.tmp). Custom (non-standard, non-http) scheme registrations are communicated to renderer subprocesses via a file at this path; when it's malformed, subprocesses never find the registration, and any navigation to a real custom scheme just hangs (no page ever loads, no error either).

Repro -- with definitive causation check, not just correlation

Added java/tests/junittests/UpstreamIssue445Test.java (currently @Disabled with a link to this issue, so it doesn't fail the normal suite -- remove @Disabled to re-run it):

  1. Register a real CefSchemeHandlerFactory for a genuinely custom scheme (jceftestscheme, already registered via CefSchemeRegistrar elsewhere in this suite's harness) serving real HTML content.
  2. Navigate a browser to a URL under that scheme.
  3. Without $TMPDIR set (this fork's default CI/dev environment): the page never loads. Confirmed via TestFrame's watchdog cleanly timing out after 15s (not a real hang).
  4. With TMPDIR=/tmp/ set (trailing slash -- the exact workaround the upstream report itself documents): the identical test passes in ~2 seconds.

This isn't just "the bug still exists" -- toggling the one environment variable the upstream report names as the cause flips the test from failing to passing, confirming the root cause precisely.

Fix sketch (not implemented here)

In native/util_posix.cpp's GetTempFileName(), ensure a separator is always present between tmpPath and the filename -- e.g. check whether tmpPath ends in / and append one if not, rather than assuming CefGetPath(PK_DIR_TEMP, ...) always returns a trailing slash.

Found via

This fork's coverage-expansion effort (tracked in #5), while triaging upstream's issue tracker for bugs that could become regression tests in this fork's suite per the user's explicit direction to "start harvesting the upstream git issues for problematic tests."

Activity

  1. added a commit that references this issue on Aug 29, 2026
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions