| OLD | NEW |
| 1 <!-- BEGIN AUTHORED CONTENT --> | 1 <!-- BEGIN AUTHORED CONTENT --> |
| 2 | 2 |
| 3 <h2 id="notes">Notes</h2> | 3 <h2 id="notes">Notes</h2> |
| 4 | 4 |
| 5 <p> | 5 <p> |
| 6 Use the <code>chrome.declarativeWebRequest</code> module to intercept, block, or | 6 Use the <code>chrome.declarativeWebRequest</code> module to intercept, block, or |
| 7 modify requests in-flight. It is significantly faster than the <a | 7 modify requests in-flight. It is significantly faster than the <a |
| 8 href="webRequest.html"><code>chrome.webRequest</code> API</a> because you can | 8 href="webRequest.html"><code>chrome.webRequest</code> API</a> because you can |
| 9 register rules that are evaluated in the browser rather than the | 9 register rules that are evaluated in the browser rather than the |
| 10 JavaScript engine which reduces roundtrip latencies and allows for very high | 10 JavaScript engine which reduces roundtrip latencies and allows for very high |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 The Declarative Web Request API supports a single type of match criteria, the | 42 The Declarative Web Request API supports a single type of match criteria, the |
| 43 <code>RequestMatcher</code>. The <code>RequestMatcher</code> matches network | 43 <code>RequestMatcher</code>. The <code>RequestMatcher</code> matches network |
| 44 requests if and only if all listed criteria are met. The following | 44 requests if and only if all listed criteria are met. The following |
| 45 <code>RequestMatcher</code> would match a network request when the user enters | 45 <code>RequestMatcher</code> would match a network request when the user enters |
| 46 "http://www.example.com" in the URL bar: | 46 "http://www.example.com" in the URL bar: |
| 47 </p> | 47 </p> |
| 48 | 48 |
| 49 <pre> | 49 <pre> |
| 50 var matcher = new chrome.declarativeWebRequest.RequestMatcher({ | 50 var matcher = new chrome.declarativeWebRequest.RequestMatcher({ |
| 51 url: { hostSuffix: 'example.com', schemes: ['http'] }, | 51 url: { hostSuffix: 'example.com', schemes: ['http'] }, |
| 52 resourceType: 'main_frame' | 52 resourceType: ['main_frame'] |
| 53 }); | 53 }); |
| 54 </pre> | 54 </pre> |
| 55 | 55 |
| 56 <p> | 56 <p> |
| 57 Requests to "https://www.example.com" would be rejected by the | 57 Requests to "https://www.example.com" would be rejected by the |
| 58 <code>RequestMatcher</code> due to the scheme. Also all requests for an embedded | 58 <code>RequestMatcher</code> due to the scheme. Also all requests for an embedded |
| 59 iframe would be rejected due to the <code>resourceType</code>. | 59 iframe would be rejected due to the <code>resourceType</code>. |
| 60 </p> | 60 </p> |
| 61 | 61 |
| 62 <p class="note"> | 62 <p class="note"> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 <h2 id="TODO">Todo</h2> | 114 <h2 id="TODO">Todo</h2> |
| 115 <ul> | 115 <ul> |
| 116 <li>Explain precedences, once we can ignore rules based on their priority | 116 <li>Explain precedences, once we can ignore rules based on their priority |
| 117 (e.g. how can I cancel all requests except for a specific whitelist?) | 117 (e.g. how can I cancel all requests except for a specific whitelist?) |
| 118 <li>Explain when conditions can be evaluated, when actions can be executed, | 118 <li>Explain when conditions can be evaluated, when actions can be executed, |
| 119 and when rules can be executed (e.g. you cannot cancel a request when you | 119 and when rules can be executed (e.g. you cannot cancel a request when you |
| 120 have received the response already) | 120 have received the response already) |
| 121 </ul> | 121 </ul> |
| 122 | 122 |
| 123 <!-- END AUTHORED CONTENT --> | 123 <!-- END AUTHORED CONTENT --> |
| OLD | NEW |