OLD | NEW |
1 <!-- BEGIN AUTHORED CONTENT --> | |
2 <h2 id="notes">Notes</h2> | 1 <h2 id="notes">Notes</h2> |
3 <p> | 2 <p> |
4 Use the <code>chrome.declarativeWebRequest</code> module to intercept, block, or | 3 Use the <code>chrome.declarativeWebRequest</code> module to intercept, block, or |
5 modify requests in-flight. It is significantly faster than the <a | 4 modify requests in-flight. It is significantly faster than the <a |
6 href="webRequest.html"><code>chrome.webRequest</code> API</a> because you can | 5 href="webRequest.html"><code>chrome.webRequest</code> API</a> because you can |
7 register rules that are evaluated in the browser rather than the | 6 register rules that are evaluated in the browser rather than the |
8 JavaScript engine which reduces roundtrip latencies and allows for very high | 7 JavaScript engine which reduces roundtrip latencies and allows for very high |
9 efficiency. | 8 efficiency. |
10 </p> | 9 </p> |
11 <h2 id="manifest">Manifest</h2> | 10 <h2 id="manifest">Manifest</h2> |
12 <p> | 11 <p> |
13 You must declare the "declarative" and the "declarativeWebRequest" permission in | 12 You must declare the "declarative" and the "declarativeWebRequest" permission in |
14 the <a href="manifest.html">extension manifest</a> to use this API, | 13 the <a href="manifest.html">extension manifest</a> to use this API, |
15 along with <a href="manifest.html#permissions">host permissions</a> for any | 14 along with <a href="manifest.html#permissions">host permissions</a> for any |
16 hosts whose network requests you want to access. | 15 hosts whose network requests you want to access. |
17 </p> | 16 </p> |
18 <pre>{ | 17 <pre>{ |
19 "name": "My extension", | 18 "name": "My extension", |
20 ... | 19 ... |
21 <b> "permissions": [ | 20 <b> "permissions": [ |
22 "declarative", | |
23 "declarativeWebRequest", | 21 "declarativeWebRequest", |
24 "*://*.google.com" | 22 "*://*.google.com" |
25 ]</b>, | 23 ]</b>, |
26 ... | 24 ... |
27 }</pre> | 25 }</pre> |
28 <h2 id="rules">Rules</h2> | 26 <h2 id="rules">Rules</h2> |
29 <p> | 27 <p> |
30 The Declarative Web Request API follows the concepts of the <a | 28 The Declarative Web Request API follows the concepts of the <a |
31 href="events.html#declarative">Declarative API</a>. You can register rules to | 29 href="events.html#declarative">Declarative API</a>. You can register rules to |
32 the <code>chrome.declarativeWebRequest.onRequest</code> event object. | 30 the <code>chrome.declarativeWebRequest.onRequest</code> event object. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 structures. This re-creation is computationally expensive but facilitates a | 94 structures. This re-creation is computationally expensive but facilitates a |
97 very fast URL matching algorithm for hundreds of thousands of URLs. | 95 very fast URL matching algorithm for hundreds of thousands of URLs. |
98 </p> | 96 </p> |
99 <h2 id="TODO">Todo</h2> | 97 <h2 id="TODO">Todo</h2> |
100 <ul> | 98 <ul> |
101 <li>Explain precedences, once we can ignore rules based on their priority | 99 <li>Explain precedences, once we can ignore rules based on their priority |
102 (e.g. how can I cancel all requests except for a specific whitelist?) | 100 (e.g. how can I cancel all requests except for a specific whitelist?) |
103 <li>Explain when conditions can be evaluated, when actions can be executed, | 101 <li>Explain when conditions can be evaluated, when actions can be executed, |
104 and when rules can be executed (e.g. you cannot cancel a request when you | 102 and when rules can be executed (e.g. you cannot cancel a request when you |
105 have received the response already) | 103 have received the response already) |
106 </ul> | 104 </ul> |
107 <!-- END AUTHORED CONTENT --> | |
OLD | NEW |