PDF page load is failing with error : Unknown Extension API - mimeHandlerPrivate.getStreamInfo

217 views
Skip to first unread message

Karthik H M

unread,
Mar 18, 2025, 1:57:41 PM3/18/25
to Chromium-dev
Hi,

We are upgrading the chromium browser from 118.0.5993.117 to 126.0.6478.126 for our embedded system. For PDF extension, we are migrating the PDF feature from chrome/browser to content/shell where the interfaces are exposed to the applications.

We moved the PDF feature from chrome/browser to content/shell successfully in 118.0.5993.117.

But in 126.0.6478.126, we are not able to do it because of new features like pdfViewerPrivate and OOPIF. So, we tried to fall back to old implementation as in 118.0.5993.117 where mimeHandlerPrivate feature is used to load the PDF page. So, we have disabled pdfViewerPrivate and OOPIF features. Also, enabled ENABLE_PPAPI flag. 

But we are getting the following error:
[ERROR:extension_function_dispatcher.cc(641)] Unknown Extension API - mimeHandlerPrivate.getStreamInfo

Also, during the debugging we found that BindMimeHandlerService is not called, even after registering this function correctly. This is also the main reason for PDF page load failure.

How to debug why BindMimeHandlerService function is not being called? Any leads in this regard, will be very useful.

Thanks in advance.

Lei Zhang

unread,
Mar 18, 2025, 2:19:01 PM3/18/25
to hmka...@gmail.com, Chromium-dev
Currently on the Chromium main branch, BindMimeHandlerService() is in
chrome/browser/extensions/chrome_extensions_browser_interface_binders.cc,
so an application built on content_shell would probably not have
access to that. Without knowing how you modified your local source
tree, it is hard to answer your question. I would suggest studying how
the code question works in a Chromium build, and see what your custom
build is doing differently.
> --
> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev
> ---
> You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
> To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/69c21cbe-6b12-4536-9de5-cd47f0dd518fn%40chromium.org.

Karthik H M

unread,
Mar 19, 2025, 11:25:02 AM3/19/25
to Chromium-dev, Lei Zhang, Chromium-dev, hmka...@gmail.com
Thanks for the response.

What we are following is that all the implementations in chromium related to PDF are being copied from chrome/browser to content/shell. 
For your point raised, we have copied the implementation of ChromeContentBrowserClient::RegisterBrowserInterfaceBindersForFrame to ShellContentBrowserClient::RegisterBrowserInterfaceBindersForFrame. So registration of BindMimeHandlerService is done in this function. Also, BindMimeHandlerService() is copied from chrome/browser/chrome_browser_interface_binders.cc to content/shell/browser/shell_content_browser_client.cc
Here, we are able to see the registration of BindMimeHandlerService() in content/shell/browser/shell_content_browser_client.cc through the prints. But, we are not seeing BindMimeHandlerService() being called. This BindMimeHandlerService() is responsible for creation of MimeHandlerService (MimeHandlerPrivate) object.

Because BindMimeHandlerService() is not called, MimeHandlerPrivate object is not created. So, when createBrowserApi() is called in chrome/browser/resources/pdf/browser_api.ts, 
it invokes chrome.mimeHandlerPrivate.getStreamInfo() and then it fails (because mimeHandlerPrivate object is invalid at this point).
Hence, we are getting the error :
[ERROR:extension_function_dispatcher.cc(641)] Unknown Extension API - mimeHandlerPrivate.getStreamInfo

This approach we followed in 18.0.5993.117 as well and it worked.

So, we are checking how we can debug to see why BindMimeHandlerService() is not getting called, even after its successful registration and addition in the map.


Lei Zhang

unread,
Mar 21, 2025, 8:33:33 PM3/21/25
to Karthik H M, Chromium-dev
Thanks for briefly explaining what your local modifications are, but
you need to study how Chromium behaves to understand what it is doing
that your code is not doing. Please consider running Chromium with
chrome://flags/#pdf-oopif disabled and debug the code. Then examine
when BindMimeHandlerService() gets called and trace up the call stack
to see what triggers it. Reiterating that BindMimeHandlerService() is
not being called in your custom build will not solve the problem.

Karthik H M

unread,
Apr 30, 2025, 9:49:52 AM4/30/25
to Chromium-dev, Lei Zhang, Chromium-dev
Thanks for the suggestion.
We debugged this issue using the working case (we built open-source chromium code version 126.0.6478.126 and ran the tests). In this working case, when we commented out the registration of BindMimeHandlerService function call (in PopulateChromeFrameBinders() in chrome_browser_interface_binders.cc), we got the following error message when the PDF page was loaded.

ERROR:render_process_host_impl.cc(5513)] Terminating render process for bad Mojo message: Receivedd for interface extensions.mime_handler.MimeHandlerService for the frame/document scope
ERROR:bad_message.cc(29)] Terminating renderer for bad IPC message, reason 123

But in our not working case, with and without registration of BindMimeHandlerService(), we are not getting the above mentioned error message.  

From this behaviour explained above, will you be able to guide us what can be the issue and what area we need to concentrate for debugging? 
From our understanding, we think that the issue seems to be the around the mojo IPC mechanism.

Kindly guide us.

Lei Zhang

unread,
Apr 30, 2025, 5:58:07 PM4/30/25
to Karthik H M, Chromium-dev
You have figured out how to break this part of Chromium. Breaking
things is easy, but what you really need to do is figure out how it
works and your steps so far offer no insights into that.
Reply all
Reply to author
Forward
0 new messages