Misplaced Pages

NPAPI: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 13:12, 30 July 2015 editLonaowna (talk | contribs)Extended confirmed users5,622 edits Undid revision 673779497 by 94.212.251.133 (talk)← Previous edit Revision as of 23:31, 17 August 2015 edit undoCodename Lisa (talk | contribs)55,077 edits The long needed overhaul, some of which involved applying MOS:COMPUTING recommendations | Deleted "Security" section, which did not concern security much, was tagged for WP:OR for two years, and had attracted talk page objection since 2008.Tags: nowiki added Visual editNext edit →
Line 1: Line 1:
{{Refimprove|date=September 2009}} {{Refimprove|date=September 2009}}
{{Merge from|LiveConnect|XPConnect|date=February 2014}} {{Original research|date = April 2012}}{{Merge from|LiveConnect|XPConnect|date=February 2014}}
'''Netscape Plugin Application Programming Interface''' ('''NPAPI''') is a ] ] architecture used by many ]s. '''Netscape Plugin Application Programming Interface''' ('''NPAPI''') is a ] ] for ]s. It was first developed for ] browsers, starting in 1995 with ] 2.0, but was subsequently adopted by other browsers.


In NPAPI architecture, a plugin declares ] (e.g. "audio/mp3") it can handle. When the browser encounters a content type it cannot handle natively, it loads the appropriate plugin, sets aside space within the browser context for the plugin to render and then streams data to it. The plugin is responsible for rendering the data. The plugin runs in-place within the page, as opposed to older browsers that had to launch an external application to handle unknown content types.
It was first developed for ] browsers, starting in 1995 with ] 2.0, but was subsequently adopted and implemented by many other browsers, although some browsers later dropped support.


NPAPI requires each plugin to implement and expose approximately 15 functions for initializing, creating, destroying and positioning plugin content. NPAPI also supports scripting, printing, full-screen plugins, windowless plugins and content streaming.
A plugin declares that it handles certain ] (e.g. "audio/mp3"). When the browser encounters that content type it loads the associated plugin, sets aside space within the browser context for the plugin to render and then streams data to it. The plugin is then responsible for rendering the data. The plugin runs in-place within the page, as opposed to older browsers that had to launch an external application to handle unknown content types.

The ] (API) requires each plugin to implement and expose approximately 15 functions for initializing, creating, destroying and positioning plugin content. The NPAPI also supports scripting, printing, full screen plugins, windowless plugins and content streaming.


== History == == History ==
{{Unreferenced section|date = August 2015}}The creation of NPAPI was motivated by ]. ], CEO of Adobe, and Allan Padgett, one of the primary authors of ], were hopeful that Adobe's fledgling ] (PDF) file format could play a role beyond the desktop. Soon after Netscape released the first version of Navigator, Padgett and fellow developer Eswar Priyadarshan tried to find a way to make PDF an integral part of the Web experience. The result was a live demo shown to Warnock and Netscape CEO ]. Prior to that demo, the only native file formats on the Web were ] pages and embedded images. Links to other file types caused the user to be prompted to download the file, after which the user could open the appropriate application. In that demo, however, when a user clicked on a link to a PDF file, the file was rendered within the browser window, seamlessly blending HTML and PDF consumption. Clark excitedly asked who at Netscape had provided support for the integration, only to discover that the integration was done without Netscape involvement, but by ] the Netscape browser.
{{Refimprove section|date=September 2010}}
The origin of the Netscape plugin functionality started at ]. ], CEO of Adobe, and ], one of the primary authors of ], were hopeful that Adobe's fledgling ] file format could play a role beyond the desktop. Soon after Netscape released the first version of Navigator, Padgett and fellow developer Eswar Priyadarshan tried to find a way to make PDF an integral part of the Web experience. The result was a live demo shown to Warnock and Netscape CEO ]. Prior to that demo, the only native file formats on the Web were ] pages and embedded images. Links to other file types caused the user to be prompted to download the file, after which the user could open the appropriate application. In that demo, however, when a user clicked on a link to a PDF file, the file was rendered within the browser window, seamlessly blending HTML and PDF consumption. Clark excitedly asked who at Netscape had provided support for the integration, only to discover that the integration was done without Netscape involvement, but by ] the Netscape browser.


The companies set out the next week to bring what was known as "Allan's Hack" to market. While Netscape was ready to incorporate PDF directly into the browser, and certainly Adobe would have gained from that, Padgett proposed his plugin architecture. Adobe developers Gordon Dow and Nabeel Al-Shamma had recently added a plugin architecture to the Acrobat Reader to leverage the development efforts of developers outside of the Reader team. Padgett had been a part of that effort, and he expected that if given a chance, other companies (and hopefully teams within Adobe) would choose to extend the Web as well. Clark and team in the end were convinced and set off designing the API that would support the new model. The companies set out the next week to bring what was known as "Allan's Hack" to market. While Netscape was ready to incorporate PDF directly into the browser, and certainly Adobe would have gained from that, Padgett proposed his plugin architecture. Adobe developers Gordon Dow and Nabeel Al-Shamma had recently added a plugin architecture to the Acrobat Reader to leverage the development efforts of developers outside of the Reader team. Padgett had been a part of that effort, and he expected that if given a chance, other companies (and hopefully teams within Adobe) would choose to extend the Web as well. Clark and team in the end were convinced and set off designing the API that would support the new model.


In the following years many popular internet browsers adopted the API, making it the universal standard for web browser plugin development. In the following years, other web browsers (see {{Section link||Browser support}}) adopted NPAPI.

Google announced in 2013 that their browser will not support NPAPI plugins anymore, and will block plugins which use this technology. This includes Oracle's Java and Microsoft's ] plugins, although these will be whitelisted during 5 months."<ref>". ''TechCrunch''. 23 September 2013.</ref> This is due to security and stability issues with the API, among other things.


== Scripting support == == Scripting support ==
Scripting is a feature allowing ] code in a web page to interact with the plugin. Various versions of Netscape and then ] supported this feature using different technologies, including LiveConnect, XPConnect, and NPRuntime.
Scripting
is a feature allowing ] code in a web page to interact with the plugin. Various versions of Netscape and then Mozilla supported this feature using different technologies, including LiveConnect, XPConnect, and npruntime.


=== LiveConnect === === LiveConnect ===
{{Main|LiveConnect}} {{Main|LiveConnect}}
With Netscape 4, the NPAPI was extended to allow plugins to be scripted. This ability was known as ]. A plugin could implement and return an instance to a ] class. The public methods exposed by this class was the scriptable interface for the plugin. The class could be called from JavaScript and from Java applets running within the page with the browser marshalling the calls between the various contexts. With Netscape 4, NPAPI was extended to allow plugins to be scripted. This extension is called LiveConnect. A plugin could implement a ] ] and expose an ]. The class could be called from JavaScript and from ]<nowiki/>s running within the page.


The disadvantage of LiveConnect was that it was heavily tied to the version of Java within the Netscape browser. This prevented the browser from using other Java runtimes, and added bloat to the browser download size since it required Java to script plugins. The disadvantage of LiveConnect is that it is heavily tied to the version of Java embedded within the Netscape browser. This prevented the browser from using other Java runtimes, and added bloat to the browser download size since it required Java to script plugins. Additionally, LiveConnect is tricky to program: The developer has to define a Java class for the plugin, run it through a specialized Java ] ] and implement the native ]. Handling ], ] and other Java ] from ] is non-obvious. In addition, LiveConnect uses an earlier and now obsolete ] (API) for invoking native C++ calls from Java, called JRI. The JRI technology has long since been supplanted by ].

Additionally, LiveConnect was tricky to program. The developer had to define a Java class for the plugin, run it through a specialised Java header compiler and implement the native methods. Handling strings, exceptions and other Java objects from ] was non-obvious. To compound matters LiveConnect used an earlier and now obsolete API for invoking native C++ calls from Java called JRI. The JRI technology has long since been supplanted by ].


=== XPConnect === === XPConnect ===
Line 35: Line 27:
LiveConnect was problematic for Mozilla. The dependency on an obsolete and proprietary Java runtime and the JRI API meant that LiveConnect never really worked. LiveConnect was problematic for Mozilla. The dependency on an obsolete and proprietary Java runtime and the JRI API meant that LiveConnect never really worked.


Mozilla was already using ] to define the interfaces to many objects implemented in C++. Each interface was defined by an ] file, and run through an IDL compiler that produced header files and a language neutral type library that was a binary representation of the interface. This binary described the interface, the methods, the parameters, the data structures and enumerations. Mozilla was already using ] to define the ] to many objects implemented in C++. Each interface was defined by an ] file, and run through an IDL compiler that produced header files and a language-neutral type library that was a binary representation of the interface. This binary described the interface, the methods, the parameters, the data structures and ].


] uses the type library information to marshal calls between different thread contexts and between JavaScript and natively compiled C++. XPConnect is used extensively throughout Mozilla. Starting with Netscape 6.1 and Mozilla 0.9.2, NPAPI was extended so that a plugin could return a scriptable interface to itself and XPConnect would marshal calls to it from JavaScript and the C++ implementation. XPConnect uses the type library information to marshal calls between different thread contexts and between JavaScript and natively compiled C++. XPConnect is used extensively throughout Mozilla. Starting with Netscape 6.1 and Mozilla 0.9.2, NPAPI was extended, so that a plugin could return a scriptable interface to itself and XPConnect would marshal calls to it from JavaScript and the C++ implementation.


XPConnect has no Java dependency, however the technology is based on XPCOM, which is similar to ]. Thus the plugin developer must be familiar with reference counting, interfaces, IDL and more to implement scripting. The dependency on XPCOM led to certain dynamic linking issues (e.g. the ]) which had to be solved before the plugin would work correctly with different browsers. XPCOM has since been changed to supply a statically linked version to address such issues. This approach also requires an .xpt file to be installed next to the DLL; otherwise the plugin will appear to work, but scripting won't, causing confusion. XPConnect has no Java dependency. However, the technology is based on XPCOM. Thus the plugin developer must be familiar with ], interfaces and IDL to implement scripting. The dependency on XPCOM led to certain dynamic linking issues (e.g. the ]) which had to be solved before the plugin would work correctly with different browsers. XPCOM has since been changed to supply a statically linked version to address such issues. This approach also requires an .xpt file to be installed next to the ] (DLL); otherwise the plugin appears to work, but the scripting does not, causing confusion.


===NPRuntime=== ===NPRuntime===
At the end of 2004, all major browser companies using NPAPI agreed on NPRuntime<ref></ref> as an extension to the original NPAPI to supply scripting, via an API that is similar in style to the old C-style NPAPI and is independent of other browser technologies like Java or XPCOM. It is supported by Mozilla (1.7.5+) / Firefox, Safari, Opera and Chrome. At the end of 2004, all major browser companies using NPAPI agreed on NPRuntime<ref></ref> as an extension to the original NPAPI to supply scripting, via an API that is similar in style to the old C-style NPAPI and is independent of other browser technologies like Java or XPCOM. It is supported by ] (1.7.5+), ], ], ] and ].


== Browser support == == Browser support ==
The following ] support NPAPI plugins: The following ] support NPAPI plugins:
* ] * ]
* ] (Starting with version 30, NPAPI plug-ins require user's explicit consent.<ref></ref>)
* ]
* ] (])
* ] * ]
* ]
* ] ] browser
* ] project applications, including
** ]
** ]: Firefox has reduced support for NPAPI from version 30 on.<ref></ref>
** ]
** ]
* ] and ] * ] and ]
* ] (])
* ]: NPAPI support is deprecated from Opera 20 onward. NPAPI support for Linux was removed with Opera 24.
* ] on ]
* ] * ]
* ]
* ]
* ]


The following browsers once supported NPAPI plugins, but have dropped support since: The following browsers once supported NPAPI plugins, but have dropped support since:
* ] / ]. In September 2013, Google announced that it would phase out NPAPI support in Chrome during 2014 because "NPAPI's 90s-era architecture has become a leading cause of hangs, crashes, security incidents, and code complexity".<ref>"". ''The Next Web''. 23 September 2013.</ref> NPAPI support was removed from the Linux version of Chrome in May 2014 (version 35).<ref>"". ''Chromium Blog''. 27 May 2014.</ref> NPAPI support is disabled by default since April 2015 (version 42) for Windows and OS X, but can be turned on in the settings. Google plans to drop Chrome NPAPI support from all platforms in September 2015 (Chrome 45).<ref>"". ''Chromium Blog''. 24 November 2014.</ref> * ] and ]:<ref>". ''TechCrunch''. 23 September 2013.</ref> In September 2013, Google announced that it would phase out NPAPI support in Chrome during 2014 because "NPAPI's 90s-era architecture has become a leading cause of hangs, crashes, security incidents, and code complexity".<ref>"". ''The Next Web''. 23 September 2013.</ref> NPAPI support was removed from the ] version of Chrome 35 and later, in May 2014.<ref>"". ''Chromium Blog''. 27 May 2014.</ref> Since April 2015, on Chrome for ] and ] versions 42 and later, NPAPI support is disabled by default but can be turned on in the settings. Google plans to drop Chrome NPAPI support from all platforms in Chrome 45 or later, in September 2015.<ref>"". ''Chromium Blog''. 24 November 2014.</ref>
* ] from version 3 up to 5.5SP2. Internet Explorer for a time supported NPAPI plugins, allowing plugins that functioned in Netscape Navigator to also function in Internet Explorer. Support came via a small ] control implemented within a "<tt>plugin.ocx</tt>" file that acted as a "shim" between ActiveX and the NPAPI plugin. IE would load the control and use it to host plugins specified within the page. However, Microsoft saw this as a security issue and dropped support in version 5.5 SP2 and later in for IE 5.01.<ref name="kb303401"> * ]: NPAPI was supported in Internet Explorer versions 3 through 5.5 SP2, allowing plugins that functioned in Netscape Navigator to function in Internet Explorer. Support came via a small ] control (named "<tt>plugin.ocx</tt>") file that acted as a ] between ActiveX and the NPAPI plugin. However, Microsoft dropped support in version 5.5 SP2 and later for security reasons.<ref name="kb303401">{{Cite web|url = https://support.microsoft.com/en-us/kb/303401|title = Netscape-Style Plug-ins Do Not Work After Upgrading Internet Explorer|date = 27 July 2007|accessdate = |website = Support|publisher = ]|last = |first = |edition = 3.3}}
</ref><ref name="giannandrea">{{Cite web|url = http://www.meer.net/jg/broken-plugins.html|title = Microsoft breaks Web Plugins in Windows XP|date = 4 September 2001|accessdate = |website = meer.net|publisher = |last = Giannandrea|first = J.|archiveurl = https://web.archive.org/web/20071016233843/http://www.meer.net/jg/broken-plugins.html|archivedate = 16 October 2007}}
</ref><ref name="giannandrea">
</ref><ref name="kb306790">{{Cite web|url = https://support.microsoft.com/en-us/kb/306790|title = Description of Internet Explorer Support for Netscape-Style Plug-ins|date = 31 January 2007|accessdate = |website = Support|publisher = ]|last = |first = |edition = 3.4}}
Giannandrea, J. (September 4, 2001) {{Wayback
</ref><ref>{{Cite web|url = https://technet.microsoft.com/library/security/ms03-015|title = Microsoft Security Bulletin MS03-015 - Critical|date = 23 April 2003|accessdate = |website = Security TechCenter|publisher = ]|last = |first = |others = }}</ref>
|date=20071016233843
* ]: NPAPI support is deprecated from Opera 20 onward. NPAPI support for Linux was removed with Opera 24.
|url=http://www.meer.net/jg/broken-plugins.html |title=Microsoft breaks Web Plugins in Windows XP }}
</ref><ref name="kb306790">
</ref>


== Security == == Similar technologies ==
{{original research|section|date=July 2012}}
On Microsoft Windows, a popular misconception concerning the NPAPI technology is that a plugin is somehow inherently safer than an ActiveX control.{{Citation needed|date=July 2012}} Both run native machine instructions with the same privileges as the host process. If the host processes have broad privileges, a malicious plugin can do as much damage as a malicious ActiveX control.{{Citation needed|date=October 2011}} It is important to note that NPAPI plugins can be made much safer by simply running in a limited user account. It is generally possible to install and run plugins with a limited user, while installing ActiveX controls requires administrative privileges (prior to IE8) even when the ActiveX runs in a limited account. When running with limited privileges, a plugin cannot do as much damage.


=== ActiveX ===
One important difference between NPAPI and ActiveX is that NPAPI is solely for Internet plugins, while ActiveX is used for a wide variety of purposes, including application composition in Windows applications. A typical Windows user has a vast array of ActiveX controls installed, a number of which are probably marked "safe for scripting", but are not actually secure. Any of these can be used as means to subvert the user's computer prior to the introduction of the ActiveX Opt-in feature in Internet Explorer 7.<ref></ref>
{{Main|ActiveX}}Internet Explorer and ] use ActiveX controls, ActiveX documents and ActiveX scripting to offer in-page extensibility on par with NPAPI. Although notoriously associated with Internet Explorer, ActiveX is integration technology that allows any computer program to integrate parts of other computer programs that support such integration.<ref>{{Cite web|url = https://support.microsoft.com/en-us/kb/154544|title = Description of ActiveX Technologies|date = 19 January 2007|accessdate = |website = Support|publisher = ]|last = |first = }}</ref> Internet Explorer, however, is discontinued and its replacement, ], does not support ActiveX.


===PPAPI===
Another difference is that NPAPI implementations (prior to ], see below) did not offer to automatically download or install missing plugins. A missing plugin caused the browser to display a jigsaw piece representing the plugin. If the user clicked on that they were directed to Netscape's plugin finder service where they could manually download and install the plugin for themselves. While this is inconvenient to the user, it is also an important security measure since it prevented the content using the browser as a vector for ].

In Internet Explorer, the HTML content specifies the location where the ActiveX control resides. If the control is not already installed, IE offers to download and install the control from the specified source. For legitimate controls, this offers a more streamlined installation mechanism with minimal user interaction. However malicious content could convince the user with clever ] to ignore warnings (or their better judgement) and install something that might harm their privacy or the machine. A number of ], ] and ] sites use this mechanism to deploy executable content to machines. Microsoft has had to increase the default security settings for ActiveX and maintain blacklists of malicious controls in an attempt to mitigate this risk.

] attempts to occupy a middle ground. If a plugin is missing, it notifies the user that the plugin is missing and initiates a secure connection to a plugin finder service hosted on mozilla.org. The user can permit Firefox to download and install the plugin. This model prevents content specifying where a plugin should be downloaded from – the plugin finder service does. This enables Firefox to present a fairly seamless installation mechanism but limit the service to trusted and compatible plugins from reliable sources. This model implicitly trusts the plugin finder service to return "good" plugins, increasing the security required on the host site.

==PPAPI==
{{main|Google Native Client#Pepper}} {{main|Google Native Client#Pepper}}
On August 12, 2009, a page on Google Code introduced a new project, Pepper, with the associated ,<ref></ref> "a set of modifications to NPAPI to make plugins more portable and more secure".<ref></ref> This extension is designed specifically to ease the implementation of out-of-] plugin execution. Further, the goals of the project are to provide a framework for making plugins fully cross-platform. Topics considered include: On 12 August 2009, a page on Google Code<ref>{{Cite web|url = https://code.google.com/p/ppapi/|title = ppapi|date = |accessdate = |website = ]|publisher = ]|last = |first = |archiveurl = |archivedate = }}</ref> introduced a new project, Pepper, with the associated Pepper Plugin API (PPAPI);<ref></ref> PPAPI is a derivatiation of NPAPI aimed to make plugins more portable and more secure.<ref></ref> This extension is designed specifically to ease the implementation of out-of-] plugin execution. The goals of the project are to provide a framework for making plugins fully cross-platform. Topics considered include:
* Uniform semantics for NPAPI across browsers. * Uniform semantics for NPAPI across browsers.
* Execution in a separate process from the renderer/browser. * Execution in a separate process from the renderer/browser.
Line 92: Line 72:
* Initial attempt at providing 3D graphics access. * Initial attempt at providing 3D graphics access.
* Plugin registry. * Plugin registry.
], ]<ref></ref> and ] (since version 24<ref></ref>) support PPAPI.

=== Browser support ===
The following web browsers support PPAPI plugins:
* ]
** ] Google's open source browser was the development web browser that first utilized the new browser plug-in model.<ref></ref>
* ] (since version 24<ref></ref>)


On {{date | 2011-05-26}}, Mozilla announced that it was "not interested in or working on Pepper at this time."<ref></ref> On {{date | 2011-05-26}}, Mozilla announced that it was "not interested in or working on Pepper at this time."<ref></ref>


In February 2012, Adobe Systems announced that future GNU/Linux versions of Flash Player would only be provided via PPAPI, although the previous release, Flash Player 11.2, with NPAPI support, would receive security updates for five years.<ref></ref> In February 2012, Adobe Systems announced that future Linux versions of ] would only be provided via PPAPI, although the previous release, Flash Player 11.2, with NPAPI support, would receive security updates for five years.<ref></ref>


== See also == == See also ==

Revision as of 23:31, 17 August 2015

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "NPAPI" – news · newspapers · books · scholar · JSTOR (September 2009) (Learn how and when to remove this message)
This article possibly contains original research. Please improve it by verifying the claims made and adding inline citations. Statements consisting only of original research should be removed. (April 2012) (Learn how and when to remove this message)
It has been suggested that LiveConnect and XPConnect be merged into this article. (Discuss) Proposed since February 2014.

Netscape Plugin Application Programming Interface (NPAPI) is a cross-platform plugin for web browsers. It was first developed for Netscape browsers, starting in 1995 with Netscape Navigator 2.0, but was subsequently adopted by other browsers.

In NPAPI architecture, a plugin declares content types (e.g. "audio/mp3") it can handle. When the browser encounters a content type it cannot handle natively, it loads the appropriate plugin, sets aside space within the browser context for the plugin to render and then streams data to it. The plugin is responsible for rendering the data. The plugin runs in-place within the page, as opposed to older browsers that had to launch an external application to handle unknown content types.

NPAPI requires each plugin to implement and expose approximately 15 functions for initializing, creating, destroying and positioning plugin content. NPAPI also supports scripting, printing, full-screen plugins, windowless plugins and content streaming.

History

This section does not cite any sources. Please help improve this section by adding citations to reliable sources. Unsourced material may be challenged and removed. (August 2015) (Learn how and when to remove this message)

The creation of NPAPI was motivated by Adobe Systems. John Warnock, CEO of Adobe, and Allan Padgett, one of the primary authors of Acrobat Reader, were hopeful that Adobe's fledgling Portable Document Format (PDF) file format could play a role beyond the desktop. Soon after Netscape released the first version of Navigator, Padgett and fellow developer Eswar Priyadarshan tried to find a way to make PDF an integral part of the Web experience. The result was a live demo shown to Warnock and Netscape CEO Jim Clark. Prior to that demo, the only native file formats on the Web were HTML pages and embedded images. Links to other file types caused the user to be prompted to download the file, after which the user could open the appropriate application. In that demo, however, when a user clicked on a link to a PDF file, the file was rendered within the browser window, seamlessly blending HTML and PDF consumption. Clark excitedly asked who at Netscape had provided support for the integration, only to discover that the integration was done without Netscape involvement, but by reverse engineering the Netscape browser.

The companies set out the next week to bring what was known as "Allan's Hack" to market. While Netscape was ready to incorporate PDF directly into the browser, and certainly Adobe would have gained from that, Padgett proposed his plugin architecture. Adobe developers Gordon Dow and Nabeel Al-Shamma had recently added a plugin architecture to the Acrobat Reader to leverage the development efforts of developers outside of the Reader team. Padgett had been a part of that effort, and he expected that if given a chance, other companies (and hopefully teams within Adobe) would choose to extend the Web as well. Clark and team in the end were convinced and set off designing the API that would support the new model.

In the following years, other web browsers (see § Browser support) adopted NPAPI.

Scripting support

Scripting is a feature allowing JavaScript code in a web page to interact with the plugin. Various versions of Netscape and then Mozilla supported this feature using different technologies, including LiveConnect, XPConnect, and NPRuntime.

LiveConnect

Main article: LiveConnect

With Netscape 4, NPAPI was extended to allow plugins to be scripted. This extension is called LiveConnect. A plugin could implement a Java class and expose an instance of it. The class could be called from JavaScript and from Java applets running within the page.

The disadvantage of LiveConnect is that it is heavily tied to the version of Java embedded within the Netscape browser. This prevented the browser from using other Java runtimes, and added bloat to the browser download size since it required Java to script plugins. Additionally, LiveConnect is tricky to program: The developer has to define a Java class for the plugin, run it through a specialized Java header compiler and implement the native methods. Handling strings, exceptions and other Java objects from C++ is non-obvious. In addition, LiveConnect uses an earlier and now obsolete application programming interface (API) for invoking native C++ calls from Java, called JRI. The JRI technology has long since been supplanted by JNI.

XPConnect

Main article: XPConnect

LiveConnect was problematic for Mozilla. The dependency on an obsolete and proprietary Java runtime and the JRI API meant that LiveConnect never really worked.

Mozilla was already using XPCOM to define the interfaces to many objects implemented in C++. Each interface was defined by an IDL file, and run through an IDL compiler that produced header files and a language-neutral type library that was a binary representation of the interface. This binary described the interface, the methods, the parameters, the data structures and enumerations.

XPConnect uses the type library information to marshal calls between different thread contexts and between JavaScript and natively compiled C++. XPConnect is used extensively throughout Mozilla. Starting with Netscape 6.1 and Mozilla 0.9.2, NPAPI was extended, so that a plugin could return a scriptable interface to itself and XPConnect would marshal calls to it from JavaScript and the C++ implementation.

XPConnect has no Java dependency. However, the technology is based on XPCOM. Thus the plugin developer must be familiar with reference counting, interfaces and IDL to implement scripting. The dependency on XPCOM led to certain dynamic linking issues (e.g. the fragile base class problem) which had to be solved before the plugin would work correctly with different browsers. XPCOM has since been changed to supply a statically linked version to address such issues. This approach also requires an .xpt file to be installed next to the dynamic-link library (DLL); otherwise the plugin appears to work, but the scripting does not, causing confusion.

NPRuntime

At the end of 2004, all major browser companies using NPAPI agreed on NPRuntime as an extension to the original NPAPI to supply scripting, via an API that is similar in style to the old C-style NPAPI and is independent of other browser technologies like Java or XPCOM. It is supported by Mozilla (1.7.5+), Firefox, Safari, Opera and Chrome.

Browser support

The following web browsers support NPAPI plugins:

The following browsers once supported NPAPI plugins, but have dropped support since:

  • Google Chrome and Chromium: In September 2013, Google announced that it would phase out NPAPI support in Chrome during 2014 because "NPAPI's 90s-era architecture has become a leading cause of hangs, crashes, security incidents, and code complexity". NPAPI support was removed from the Linux version of Chrome 35 and later, in May 2014. Since April 2015, on Chrome for Windows and OS X versions 42 and later, NPAPI support is disabled by default but can be turned on in the settings. Google plans to drop Chrome NPAPI support from all platforms in Chrome 45 or later, in September 2015.
  • Internet Explorer: NPAPI was supported in Internet Explorer versions 3 through 5.5 SP2, allowing plugins that functioned in Netscape Navigator to function in Internet Explorer. Support came via a small ActiveX control (named "plugin.ocx") file that acted as a shim between ActiveX and the NPAPI plugin. However, Microsoft dropped support in version 5.5 SP2 and later for security reasons.
  • Opera: NPAPI support is deprecated from Opera 20 onward. NPAPI support for Linux was removed with Opera 24.

Similar technologies

ActiveX

Main article: ActiveX

Internet Explorer and browsers based on Internet Explorer use ActiveX controls, ActiveX documents and ActiveX scripting to offer in-page extensibility on par with NPAPI. Although notoriously associated with Internet Explorer, ActiveX is integration technology that allows any computer program to integrate parts of other computer programs that support such integration. Internet Explorer, however, is discontinued and its replacement, Microsoft Edge, does not support ActiveX.

PPAPI

Main article: Google Native Client § Pepper

On 12 August 2009, a page on Google Code introduced a new project, Pepper, with the associated Pepper Plugin API (PPAPI); PPAPI is a derivatiation of NPAPI aimed to make plugins more portable and more secure. This extension is designed specifically to ease the implementation of out-of-process plugin execution. The goals of the project are to provide a framework for making plugins fully cross-platform. Topics considered include:

  • Uniform semantics for NPAPI across browsers.
  • Execution in a separate process from the renderer/browser.
  • Standardize rendering using the browser's compositing process.
  • Defining standardized events and 2D rasterization functions.
  • Initial attempt at providing 3D graphics access.
  • Plugin registry.

Google Chrome, Chromium and Opera (since version 24) support PPAPI.

On 26 May 2011, Mozilla announced that it was "not interested in or working on Pepper at this time."

In February 2012, Adobe Systems announced that future Linux versions of Adobe Flash Player would only be provided via PPAPI, although the previous release, Flash Player 11.2, with NPAPI support, would receive security updates for five years.

See also

References

  1. NPRuntime
  2. Firefox — Notes (30.0) — Mozilla
  3. Google will start blocking most Netscape Plug-In API plug-ins in January 2014, will whitelist Silverlight, Unity & others". TechCrunch. 23 September 2013.
  4. "Google looks to drop Netscape Plugin API support in Chrome, starting with blocking most plugins in January 2014". The Next Web. 23 September 2013.
  5. "Update on NPAPI deprecation". Chromium Blog. 27 May 2014.
  6. "The final countdown for NPAPI". Chromium Blog. 24 November 2014.
  7. "Netscape-Style Plug-ins Do Not Work After Upgrading Internet Explorer". Support (3.3 ed.). Microsoft. 27 July 2007.
  8. Giannandrea, J. (4 September 2001). "Microsoft breaks Web Plugins in Windows XP". meer.net. Archived from the original on 16 October 2007.
  9. "Description of Internet Explorer Support for Netscape-Style Plug-ins". Support (3.4 ed.). Microsoft. 31 January 2007.
  10. "Microsoft Security Bulletin MS03-015 - Critical". Security TechCenter. Microsoft. 23 April 2003.
  11. "Description of ActiveX Technologies". Support. Microsoft. 19 January 2007.
  12. "ppapi". Google Code. Google.
  13. Pepper Plugin API (PPAPI)
  14. Pepper.wiki
  15. Google heats up native code for Chrome OS
  16. Opera Developer 24: Pepper Flash is coming to Opera
  17. NPAPI:Pepper - MozillaWiki
  18. Adobe and Google Partnering for Flash Player on Linux

External links

Web interfaces
Server-side
Protocols
Server APIs
Apache modules
Topics
Client-side
Browser APIs
Web APIs
WHATWG
W3C
Khronos
Others
Topics
Related topics
Mozilla
Projects
Mozilla
Labs
Mozilla
Research
Mozilla
Foundation
Firefox
Origins
Frameworks
Components
Typefaces
Discontinued
Forks
Discontinued projects are in italics. Some projects abandoned by Mozilla that are still maintained by third parties are in underline.
Organization
Foundation
Official affiliates
People
Community
Other topics
Netscape
Browser versions
E-mail clients
Other components
Server software
Web services
People
See also
Categories: