Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/common/extensions/docs/server2/templates/articles/npapi.html

Issue 10832042: Extensions Docs Server: Doc conversion script (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: everything but svn stuff Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <h1>NPAPI Plugins</h1>
2
3 <p>
4 Leveraging HTML and JavaScript
5 makes developing new extensions really easy,
6 but what if you have existing legacy or proprietary code
7 that you want to reuse in your extension?
8 You can bundle an NPAPI plugin with your extension,
9 allowing you to call into native binary code from JavaScript.
10 </p>
11
12 <h2>Warning</h2>
13
14 <p align="center"><b>NPAPI is a really big hammer that should only be used when no other approach will work.</b>
15
16 <p>Code running in an NPAPI plugin has the full permissions of the current user and is not sandboxed or shielded from malicious input by Google Chrome in any wa y. You should be especially cautious when processing input from untrusted source s, such as when working with <a href="content_scripts.html#security-consideratio ns">content scripts</a> or XMLHttpRequest.
17
18 <p>Because of the additional security risks NPAPI poses to users, extensions tha t use it will require manual review before being accepted in the
19 <a href="https://chrome.google.com/webstore">Chrome Web Store</a>.</p>
20
21 <h2>Details</h2>
22
23 <p>
24 How to develop an NPAPI plugin is outside the scope of this document.
25 See <a href="https://developer.mozilla.org/en/Plugins">Mozilla's
26 NPAPI plugin reference</a> for information on how to do that.
27 </p>
28
29 <p>
30 Once you have an NPAPI plugin,
31 follow these steps to get your extension using it.
32 </p>
33
34 <ol>
35 <li>
36 Add a section to your extension's <code>manifest.json</code>
37 that describes where to find the plugin,
38 along with other properties about it:
39
40 <pre>{
41 "name": "My extension",
42 ...
43 <b>"plugins": [
44 { "path": "content_plugin.dll", "public": true },
45 { "path": "extension_plugin.dll" }
46 ]</b>,
47 ...
48 }</pre>
49
50 <p>
51 The "path" property specifies the path to your plugin,
52 relative to the manifest file.
53 The "public" property specifies whether
54 your plugin can be accessed by regular web pages;
55 the default is false,
56 meaning only your extension can load the plugin.
57 </p>
58 </li>
59
60 <li>
61 Create an HTML file that loads your plugin by mime-type.
62 Assuming your mime-type is "application/x-my-extension":
63
64 <pre>
65 &lt;embed type="application/x-my-extension" id="pluginId"></embed>
66 &lt;script>
67 var plugin = document.getElementById("pluginId");
68 var result = plugin.myPluginMethod(); // call a method in your plugin
69 console.log("my plugin returned: " + result);
70 &lt;/script></pre>
71
72 <p>
73 This can be inside a background page
74 or any other HTML page used by your extension.
75 If your plugin is "public",
76 you can even use a content script to programmatically
77 insert your plugin into a web page.
78 </p>
79 </li>
80 </ol>
81
82 <h2 id="security-considerations">Security considerations</h2>
83
84 <p>
85 Including an NPAPI plugin in your extension is dangerous because plugins
86 have unrestricted access to the local machine. If your plugin contains
87 a vulnerability, an attacker might be able to exploit that vulnerability
88 to install malicious software on the user's machine. Instead, avoid
89 including an NPAPI plugin whenever possible.
90 </p>
91
92 <p>
93 Marking your NPAPI plugin "public" increase the attack surface of your
94 extension because the plugin is exposed directly to web content, making
95 it easier for a malicious web site to manipulate your plugin. Instead,
96 avoid making your NPAPI plugin public whenever possible.
97 </p>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698