Page 1 of 1

Detecting unsupported plugins

PostPosted: Mon Jul 20, 2015 1:46 pm
by megaloni
I am trying to find the proper place to add a hook in CEF (or Chromium if need be) to let me know when a page requests an NPAPI plugin (like a Java applet). I'd like to be able to alert the user about the plugin and the problem in a friendly way. I had thought

ContentRendererClient::bool ContentRendererClient::OverrideCreatePlugin(
RenderFrame* render_frame,
blink::WebLocalFrame* frame,
const blink::WebPluginParams& params,
blink::WebPlugin** plugin);

was the proper place but that doesn't seem to be working for me. Any thoughts?

Re: Detecting unsupported plugins

PostPosted: Mon Jul 20, 2015 2:28 pm
by magreenblatt
OverrideCreatePlugin is the right place. Look at the Chrome implementation, specifically the logic around plugin placeholders: https://code.google.com/p/chromium/code ... t.cc&l=630

Re: Detecting unsupported plugins

PostPosted: Mon Jul 20, 2015 4:44 pm
by megaloni
Thanks - that did it - just wasn't high enough up in the function for my call to get executed!

Re: Detecting unsupported plugins

PostPosted: Mon Feb 01, 2016 4:18 pm
by edgardog
On 2526 (latest at the moment ea9b6c8) the code in OverrideCreatePlugin (libcef/renderer/content_renderer_client.cc) does not seem to work.
I send a message with the orig_mime_type to detect the Java plugin (and take further actions since its not supported anymore) but I stopped getting the message since 2526.
On 2454 this used to work great.

I'm looking at this https://code.google.com/p/chromium/issu ... &start=100
Could that be related?

With the latest changes to 2526, is there a new way of detecting unsupported plugins?

Thanks

Re: Detecting unsupported plugins

PostPosted: Wed Feb 03, 2016 3:38 pm
by edgardog
I've also tried to put my code on CreatePlugin (not the override but the actual creation) and also never seems to be called anymore.
This works on 2454.

Did anyone figure out a way of detecting when a page tries to load an NPAPI plugin?

Re: Detecting unsupported plugins

PostPosted: Wed Feb 03, 2016 3:50 pm
by PolesApart
Wasn't NPAPI plugins support wiped off entirely of chromium some releases ago?

Re: Detecting unsupported plugins

PostPosted: Wed Feb 03, 2016 3:55 pm
by edgardog
PolesApart wrote:Wasn't NPAPI plugins support wiped off entirely of chromium some releases ago?


Yes, there is no support for loading an NPAPI plugin. But up to the previous branch, it was possible to OverrideCreatePlugin, detect that it was an NPAPI plugin (useful for detect Java Plugin Content) and deal with the no supported plugin in an elegant way. Basically present the user some info saying the page is trying to use an unsupported Java plugin and that it is no longer supported. Also give the choice to use an older version of the browser that supports the plugin.
I lost that auto-detection with 2526.

Re: Detecting unsupported plugins

PostPosted: Wed Feb 03, 2016 5:16 pm
by magreenblatt
Code related to NPAPI plugins has been deleted in Chromium/Blink so probably the load is failing much sooner with newer branches than it did previously. You can dig into the Chromium/Blink code to see if you can find some other trigger. Or you can implement some other approach to identify when a page is attempting to load Java. For example:

- Filtering the HTML code using CefRequestHandler::GetResourceResponseFilter to find plugin object nodes.
- Running JavaScript in the page to detect plugin object nodes.

Re: Detecting unsupported plugins

PostPosted: Thu Feb 04, 2016 10:27 am
by edgardog
magreenblatt wrote:Code related to NPAPI plugins has been deleted in Chromium/Blink so probably the load is failing much sooner with newer branches than it did previously. You can dig into the Chromium/Blink code to see if you can find some other trigger. Or you can implement some other approach to identify when a page is attempting to load Java. For example:

- Filtering the HTML code using CefRequestHandler::GetResourceResponseFilter to find plugin object nodes.
- Running JavaScript in the page to detect plugin object nodes.


Thanks for the tips. I'll mess around with GetResourceResponseFilter and see what I can do with it.