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

Side by Side Diff: chrome/common/extensions/docs/static/webRequest.html

Issue 10836127: Fix outdated documentation on blocking start and handling of synchronous requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated to ToT 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
« no previous file with comments | « chrome/common/extensions/docs/samples.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <div id="pageData-name" class="pageData">Web Requests</div> 1 <div id="pageData-name" class="pageData">Web Requests</div>
2 2
3 <!-- BEGIN AUTHORED CONTENT --> 3 <!-- BEGIN AUTHORED CONTENT -->
4 <p id="classSummary"> 4 <p id="classSummary">
5 Use the <code>chrome.webRequest</code> module to intercept, block, 5 Use the <code>chrome.webRequest</code> module to intercept, block,
6 or modify requests in-flight and to observe and analyze traffic. 6 or modify requests in-flight and to observe and analyze traffic.
7 </p> 7 </p>
8 8
9 <h2 id="manifest">Manifest</h2> 9 <h2 id="manifest">Manifest</h2>
10 <p>You must declare the "webRequest" permission in the <a 10 <p>You must declare the "webRequest" permission in the <a
11 href="manifest.html">extension manifest</a> to use the web request 11 href="manifest.html">extension manifest</a> to use the web request
12 API, along with <a href="manifest.html#permissions">host permissions</a> 12 API, along with <a href="manifest.html#permissions">host permissions</a>
13 for any hosts whose network requests you want to access. If you want to 13 for any hosts whose network requests you want to access. If you want to
14 use the web request API in a blocking fashion, you need to request 14 use the web request API in a blocking fashion, you need to request
15 the "webRequestBlocking" permission in addition. 15 the "webRequestBlocking" permission in addition.
16 For example:</p> 16 For example:</p>
17 <pre>{ 17 <pre>{
18 "name": "My extension", 18 "name": "My extension",
19 ... 19 ...
20 <b>"permissions": [ 20 <b>"permissions": [
21 "webRequest", 21 "webRequest",
22 "*://*.google.com" 22 "*://*.google.com"
23 ]</b>, 23 ]</b>,
24 ... 24 ...
25 }</pre> 25 }</pre>
26 26
27 <p class="note">
28 <b>Node:</b> If you request the "webRequestBlocking" permission, web requests
29 are delayed until the background page of your extension has been loaded. This
30 allows you to register event listeners before any web requests are processed.
31 In order to avoid deadlocks, you must not start synchronous XmlHttpRequests or
32 include scripts from the internet via <code>&lt;script src="..."&gt;</code> tags
33 in your background page.
34 </p>
35
36 <h2 id="life_cycle">Life cycle of requests</h2> 27 <h2 id="life_cycle">Life cycle of requests</h2>
37 28
38 <p> 29 <p>
39 The web request API defines a set of events that follow the life cycle of a web 30 The web request API defines a set of events that follow the life cycle of a web
40 request. You can use these events to observe and analyze traffic. Certain 31 request. You can use these events to observe and analyze traffic. Certain
41 synchronous events will allow you to intercept, block, or modify a request. 32 synchronous events will allow you to intercept, block, or modify a request.
42 </p> 33 </p>
43 34
44 <p> 35 <p>
45 The event life cycle for successful requests is illustrated here, followed by 36 The event life cycle for successful requests is illustrated here, followed by
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 <code>https://</code>, 128 <code>https://</code>,
138 <code>ftp://</code>, 129 <code>ftp://</code>,
139 <code>file://</code>, or 130 <code>file://</code>, or
140 <code>chrome-extension://</code>. 131 <code>chrome-extension://</code>.
141 In addition, even certain requests with URLs using one of the above schemes 132 In addition, even certain requests with URLs using one of the above schemes
142 are hidden, e.g., 133 are hidden, e.g.,
143 <code>chrome-extension://other_extension_id</code> where 134 <code>chrome-extension://other_extension_id</code> where
144 <code>other_extension_id</code> is not the ID of the extension to handle 135 <code>other_extension_id</code> is not the ID of the extension to handle
145 the request, 136 the request,
146 <code>https://www.google.com/chrome</code>, 137 <code>https://www.google.com/chrome</code>,
147 and others (this list is not complete). 138 and others (this list is not complete). Also synchronous XMLHttpRequests from
139 your extension are hidden from blocking event handlers in order to prevent
140 deadlocks.
148 </p> 141 </p>
149 142
150 <h2 id="concepts">Concepts</h2> 143 <h2 id="concepts">Concepts</h2>
151 144
152 <p>As the following sections explain, events in the web request API use request 145 <p>As the following sections explain, events in the web request API use request
153 IDs, and you can optionally specify filters and extra information when you 146 IDs, and you can optionally specify filters and extra information when you
154 register event listeners.</p> 147 register event listeners.</p>
155 148
156 <h3 id="Request IDs">Request IDs</h3> 149 <h3 id="Request IDs">Request IDs</h3>
157 150
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 294 }
302 return {requestHeaders: details.requestHeaders}; 295 return {requestHeaders: details.requestHeaders};
303 }, 296 },
304 {urls: ["&lt;all_urls&gt;"]}, 297 {urls: ["&lt;all_urls&gt;"]},
305 ["blocking", "requestHeaders"]); 298 ["blocking", "requestHeaders"]);
306 </pre> 299 </pre>
307 300
308 <p> For more example code, see the <a href="samples.html#webrequest">web request 301 <p> For more example code, see the <a href="samples.html#webrequest">web request
309 samples</a>.</p> 302 samples</a>.</p>
310 <!-- END AUTHORED CONTENT --> 303 <!-- END AUTHORED CONTENT -->
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/samples.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698