Bug 44351 - NPAPI plugins do not get instantiated when not in visible pages
Summary: NPAPI plugins do not get instantiated when not in visible pages
Alias: None
Product: WebKit
Classification: Unclassified
Component: Plug-ins (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
Depends on:
Blocks: 56575
  Show dependency treegraph
Reported: 2010-08-20 13:26 PDT by Phil
Modified: 2022-06-22 22:25 PDT (History)
3 users (show)

See Also:

Plugin and sample HTML pages. (28.15 KB, application/octet-stream)
2010-08-20 13:27 PDT, Phil
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Phil 2010-08-20 13:26:31 PDT
I have a scriptable NPAPI plugin that I would like to reside in the 'global.html' page of a Safari extension.  My global.html contains a tag such as:

<object type="application/basic-plugin" id="foo"></object>

Periodically, the global HTML page will need to call something like:

var plugin = document.getElementById('foo');
var rv = plugin.bar();
// perform some computation with rv

If I put this in a regular HTML page, this works fine.  If I place it in a standard iframe, it also works fine.  If I place this code in an iframe such as:

<iframe src="inner.html" style="display:none;">

or in the global.html page of a Safari extension(which is also hidden), the scriptable plugin is never instantiated and all calls to methods in it fail with the following exception:

TypeError: Result of expression 'document.getElementById('foo').bar' [undefined] is not a function

I have attached to this bug a non-scriptable NPAPI plugin that simply logs to stderr when NPP_New() is invoked.  After compiling the plugin, you will need to install it by placing build/Debug/BasicPlugin.bundle/ in ~/Library/Internet Plug-Ins/.  Then, launch Console.app (to observe stderr logs) and navigate to the included outer.html.  Note that nothing is printed to stderr.  Then, navigate to inner.html and observe the log to stderr about NPP_New() being invoked.

The code is based on sample code provided by Mozilla: http://mxr.mozilla.org/mozilla-central/source/modules/plugin/sdk/samples/basic/mac/

The code *does* work on another Webkit-based browser (Chrome) so this may not be a Webkit-specific problem, but there does not appear to be a public Safari bug tracker.
Comment 1 Phil 2010-08-20 13:27:15 PDT
Created attachment 64982 [details]
Plugin and sample HTML pages.
Comment 2 Ahmad Saleem 2022-06-22 12:52:22 PDT
NPAPI support is removed from Safari 14 onward and it is not supported in Webkit Builds like WebkitGTK as well. I think this can be marked as "RESOLVED WONTFIX". Thanks!
Comment 3 Ryosuke Niwa 2022-06-22 22:25:45 PDT
Yup, won't fix.