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

Side by Side Diff: chrome/common/extensions/docs/templates/intros/declarativeWebRequest.html

Issue 14358004: Almost all actions in Declarative Web Request require all_urls host permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: All URLs -> all hosts; also rebased Created 7 years, 7 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
1 <h2 id="notes">Notes</h2> 1 <h2 id="notes">Notes</h2>
2 2
3 <p> 3 <p>
4 Use the <code>chrome.declarativeWebRequest</code> module to intercept, block, or 4 Use the <code>chrome.declarativeWebRequest</code> module to intercept, block, or
5 modify requests in-flight. It is significantly faster than the <a 5 modify requests in-flight. It is significantly faster than the <a
6 href="webRequest.html"><code>chrome.webRequest</code> API</a> because you can 6 href="webRequest.html"><code>chrome.webRequest</code> API</a> because you can
7 register rules that are evaluated in the browser rather than the 7 register rules that are evaluated in the browser rather than the
8 JavaScript engine which reduces roundtrip latencies and allows very high 8 JavaScript engine which reduces roundtrip latencies and allows very high
9 efficiency. 9 efficiency.
10 </p> 10 </p>
11 11
12 <h2 id="manifest">Manifest</h2> 12 <h2 id="manifest">Manifest</h2>
13 13
14 <p> 14 <p>
15 You must declare the "declarativeWebRequest" permission in the 15 You must declare the "declarativeWebRequest" permission in the
16 <a href="manifest.html">extension manifest</a> to use this API, 16 <a href="manifest.html">extension manifest</a> to use this API,
17 along with <a href="declare_permissions.html">host permissions</a> for any 17 along with <a href="declare_permissions.html">host permissions</a>.
18 hosts whose network requests you want to access.
19 </p> 18 </p>
20 19
21 <pre>{ 20 <pre>{
22 "name": "My extension", 21 "name": "My extension",
23 ... 22 ...
24 <b> "permissions": [ 23 <b> "permissions": [
25 "declarativeWebRequest", 24 "declarativeWebRequest",
26 "*://*.google.com" 25 "*://*.google.com"
27 ]</b>, 26 ]</b>,
28 ... 27 ...
29 }</pre> 28 }</pre>
30 29
31 <p> 30 <p>
32 Note that certain types of non-sensitive requests do not require host 31 Note that certain types of non-sensitive actions do not require host
33 permissions: 32 permissions:
34 <ul> 33 <ul>
35 <li><code>CancelRequest</code> 34 <li><code>CancelRequest</code>
36 <li><code>IgnoreRules</code> 35 <li><code>IgnoreRules</code>
37 <li><code>RedirectToEmptyDocument</code> 36 <li><code>RedirectToEmptyDocument</code>
38 <li><code>RedirectToTransparentImage</code> 37 <li><code>RedirectToTransparentImage</code>
39 <li><code>RedirectByRegEx</code> when the redirect destination has
40 the same domain as the original request
41 <li><code>RedirectRequest</code> when the redirect destination has
42 the same domain as the original request
43 </ul> 38 </ul>
39 </p>
40 <p>
41 The <code>SendMessageToExtension</code> action requires host permissions
42 for any hosts whose network requests you want to trigger a message.
43 </p>
44 <p>
45 All other actions require host permissions to all URLs.
46 </p>
47 <p>
48 As an example, if <code>"*://*.google.com"</code> is the only host permission an
49 extension has, than such an extension may set up a rule to
50 <ul>
51 <li> cancel a request to "http://www.google.com" or "http://anything.else.com"
52 <li> send a message when navigating to "http://www.google.com" but not to
53 "http://something.else.com"
54 </ul>
55 The extension cannot set up a rule to redirect "http://www.google.com" to
56 "http://mail.google.com".
57 </p>
44 58
45 <h2 id="rules">Rules</h2> 59 <h2 id="rules">Rules</h2>
46 60
47 <p> 61 <p>
48 The Declarative Web Request API follows the concepts of the <a 62 The Declarative Web Request API follows the concepts of the <a
49 href="events.html#declarative">Declarative API</a>. You can register rules to 63 href="events.html#declarative">Declarative API</a>. You can register rules to
50 the <code>chrome.declarativeWebRequest.onRequest</code> event object. 64 the <code>chrome.declarativeWebRequest.onRequest</code> event object.
51 </p> 65 </p>
52 66
53 <p> 67 <p>
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 chrome.declarativeWebRequest.onRequest.addRules([rule1, rule2]); 251 chrome.declarativeWebRequest.onRequest.addRules([rule1, rule2]);
238 </pre> 252 </pre>
239 253
240 <p> 254 <p>
241 It is important to recognize that the <code>IgnoreRules</code> action is not 255 It is important to recognize that the <code>IgnoreRules</code> action is not
242 persisted across <a href="#evaluation">request stages</a>. All conditions of 256 persisted across <a href="#evaluation">request stages</a>. All conditions of
243 all rules are evaluated at each stage of a web request. If an 257 all rules are evaluated at each stage of a web request. If an
244 <code>IgnoreRules</code> action is executed, it applies only to other actions 258 <code>IgnoreRules</code> action is executed, it applies only to other actions
245 that are executed for the same web request in the same stage. 259 that are executed for the same web request in the same stage.
246 </p> 260 </p>
OLDNEW
« no previous file with comments | « chrome/browser/extensions/permissions_updater_unittest.cc ('k') | chrome/common/extensions/extension_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698