Skip to content

DevTools cannot load SourceMap files (net::ERR_NAME_NOT_RESOLVED) #7

Closed
@bric3

Description

@bric3

I opened a ticket on JCEF about sourcemap not available in DevTools, see
https://bitbucket.org/chromiumembedded/java-cef/issues/403/devtools-cannot-load-sourcemap-files-net


I have Java code that expose a progressive web app via JCEF. However the third-party web-app javascript is minified. They do provide source maps however. This works fine in a usual browser.

However when running inside a JCEF frame, the devtools cannot load these source maps.

DevTools failed to load SourceMap: Could not load content for https://my-app/2.c9d7d260.chunk.js.map: Connection error: net::ERR_NAME_NOT_RESOLVED
DevTools failed to load SourceMap: Could not load content for https://my-app/main.a7bce6af.chunk.js.map: Connection error: net::ERR_NAME_NOT_RESOLVED
DevTools failed to load SourceMap: Could not load content for https://my-app/main.0d980f3a.chunk.css.map: Connection error: net::ERR_NAME_NOT_RESOLVED

I am registering a custom scheme handler

CefApp.getInstance().registerSchemeHandlerFactory(
    "https", appDomain,
    SchemeHandlerFactory { uri: URI ->
        BufferedInputStream(WebView::class.java.getResourceAsStream("/assets" + uri.path))
    }
).also { successful -> assert(successful) }

I even tried to hook a request handler

object : CefRequestHandlerAdapter() {
    override fun getResourceRequestHandler(
        browser: CefBrowser?,
        frame: CefFrame?,
        request: CefRequest?,
        isNavigation: Boolean,
        isDownload: Boolean,
        requestInitiator: String?,
        disableDefaultHandling: BoolRef?
    ): CefResourceRequestHandler? {
        println(request)
        return super.getResourceRequestHandler(
            browser,
            frame,
            request,
            isNavigation,
            isDownload,
            requestInitiator,
            disableDefaultHandling
        )
    }
}.also { requestHandler ->
    cefBrowser.client.addRequestHandler(requestHandler)
    lifetime.onTermination {
        cefBrowser.client.removeRequestHandler()
    }
}

Debugging at these location didn’t help much, as I don’t see any request to https://my-app/2.c9d7d260.chunk.js.map for example.

I am not sure if this is a bug or a missing feature, or simply a misuse.


I even tried to add this request handler on the devtool browser cefBrowser.devTools

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions