| OLD | NEW |
| 1 <h2 id="manifest">Manifest</h2> | 1 <h2 id="manifest">Manifest</h2> |
| 2 | 2 |
| 3 <p> | 3 <p> |
| 4 You must declare the "declarativeWebRequest" permission in the | 4 You must declare the "declarativeWebRequest" permission in the |
| 5 <a href="manifest.html">extension manifest</a> to use this API, | 5 <a href="manifest.html">extension manifest</a> to use this API, |
| 6 along with <a href="declare_permissions.html">host permissions</a>. | 6 along with <a href="declare_permissions.html">host permissions</a>. |
| 7 </p> | 7 </p> |
| 8 | 8 |
| 9 <pre data-filename="manifest.json"> | 9 <pre data-filename="manifest.json"> |
| 10 { | 10 { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 <th>onHeadersReceived | 173 <th>onHeadersReceived |
| 174 <th>onAuthRequired | 174 <th>onAuthRequired |
| 175 </tr> | 175 </tr> |
| 176 <tr><td>AddRequestCookie<td><td>✓<td><td> | 176 <tr><td>AddRequestCookie<td><td>✓<td><td> |
| 177 <tr><td>AddResponseCookie<td><td><td>✓<td> | 177 <tr><td>AddResponseCookie<td><td><td>✓<td> |
| 178 <tr><td>AddResponseHeader<td><td><td>✓<td> | 178 <tr><td>AddResponseHeader<td><td><td>✓<td> |
| 179 <tr><td>CancelRequest<td>✓<td>✓<td>✓<td>✓ | 179 <tr><td>CancelRequest<td>✓<td>✓<td>✓<td>✓ |
| 180 <tr><td>EditRequestCookie<td><td>✓<td><td> | 180 <tr><td>EditRequestCookie<td><td>✓<td><td> |
| 181 <tr><td>EditResponseCookie<td><td><td>✓<td> | 181 <tr><td>EditResponseCookie<td><td><td>✓<td> |
| 182 <tr><td>IgnoreRules<td>✓<td>✓<td>✓<td>✓ | 182 <tr><td>IgnoreRules<td>✓<td>✓<td>✓<td>✓ |
| 183 <tr><td>RedirectByRegEx<td>✓<td><td><td> | 183 <tr><td>RedirectByRegEx<td>✓<td><td>✓<td> |
| 184 <tr><td>RedirectRequest<td>✓<td><td><td> | 184 <tr><td>RedirectRequest<td>✓<td><td>✓<td> |
| 185 <tr><td>RedirectToEmptyDocument<td>✓<td><td><td> | 185 <tr><td>RedirectToEmptyDocument<td>✓<td><td>✓<td> |
| 186 <tr><td>RedirectToTransparentImage<td>✓<td><td><td> | 186 <tr><td>RedirectToTransparentImage<td>✓<td><td>✓<td> |
| 187 <tr><td>RemoveRequestCookie<td><td>✓<td><td> | 187 <tr><td>RemoveRequestCookie<td><td>✓<td><td> |
| 188 <tr><td>RemoveRequestHeader<td><td>✓<td><td> | 188 <tr><td>RemoveRequestHeader<td><td>✓<td><td> |
| 189 <tr><td>RemoveResponseCookie<td><td><td>✓<td> | 189 <tr><td>RemoveResponseCookie<td><td><td>✓<td> |
| 190 <tr><td>RemoveResponseHeader<td><td><td>✓<td> | 190 <tr><td>RemoveResponseHeader<td><td><td>✓<td> |
| 191 <tr><td>SendMessageToExtension<td>✓<td>✓<td>✓<td>✓ | 191 <tr><td>SendMessageToExtension<td>✓<td>✓<td>✓<td>✓ |
| 192 <tr><td>SetRequestHeader<td><td>✓<td><td> | 192 <tr><td>SetRequestHeader<td><td>✓<td><td> |
| 193 </table> | 193 </table> |
| 194 </p> | 194 </p> |
| 195 | 195 |
| 196 <p> | 196 <p> |
| 197 <strong>Note:</strong> Applicable stages can be further constrained by using the | 197 <strong>Note:</strong> Applicable stages can be further constrained by using the |
| 198 "stages" attribute. | 198 "stages" attribute. |
| 199 </p> | 199 </p> |
| 200 <p> | 200 <p> |
| 201 <strong>Note:</strong> Redirects initiated by a redirect action use the original |
| 202 request method for the redirect, with one exception: If the redirect is |
| 203 initiated at the onHeadersReceived stage, then the redirect will be issued using |
| 204 the GET method. |
| 205 </p> |
| 206 <p> |
| 201 <strong>Example:</strong> It is possible to combine a | 207 <strong>Example:</strong> It is possible to combine a |
| 202 <code>new chrome.declarativeWebRequest.RequestMatcher({contentType: ["image/jpeg
"]})</code> | 208 <code>new chrome.declarativeWebRequest.RequestMatcher({contentType: ["image/jpeg
"]})</code> |
| 203 condition with a <code>new chrome.declarativeWebRequest.CancelRequest()</code> | 209 condition with a <code>new chrome.declarativeWebRequest.CancelRequest()</code> |
| 204 action because both of them can be evaluated in the onHeadersReceived stage. | 210 action because both of them can be evaluated in the onHeadersReceived stage. |
| 205 It is, however, impossible to combine the request matcher with a | 211 It is, however, impossible to combine the request matcher with a |
| 206 <code>new chrome.declarativeWebRequest.RedirectToTransparentImage()</code> | 212 <code>new chrome.declarativeWebRequest.SetRequestHeader()</code> |
| 207 because redirects cannot be executed any more by the time the content | 213 because request headers cannot be set any more by the time the content type has
been terminated. |
| 208 type has been determined. | |
| 209 </p> | 214 </p> |
| 210 | 215 |
| 211 <h2 id="precedences">Using priorities to override rules</h2> | 216 <h2 id="precedences">Using priorities to override rules</h2> |
| 212 | 217 |
| 213 <p> | 218 <p> |
| 214 Rules can be associated with priorities as described in the | 219 Rules can be associated with priorities as described in the |
| 215 <a href="events.html#declarative">Events API</a>. This mechanism can be used | 220 <a href="events.html#declarative">Events API</a>. This mechanism can be used |
| 216 to express exceptions. The following example will block all requests to | 221 to express exceptions. The following example will block all requests to |
| 217 images named "evil.jpg" except on the server "myserver.com". | 222 images named "evil.jpg" except on the server "myserver.com". |
| 218 </p> | 223 </p> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 242 chrome.declarativeWebRequest.onRequest.addRules([rule1, rule2]); | 247 chrome.declarativeWebRequest.onRequest.addRules([rule1, rule2]); |
| 243 </pre> | 248 </pre> |
| 244 | 249 |
| 245 <p> | 250 <p> |
| 246 It is important to recognize that the <code>IgnoreRules</code> action is not | 251 It is important to recognize that the <code>IgnoreRules</code> action is not |
| 247 persisted across <a href="#evaluation">request stages</a>. All conditions of | 252 persisted across <a href="#evaluation">request stages</a>. All conditions of |
| 248 all rules are evaluated at each stage of a web request. If an | 253 all rules are evaluated at each stage of a web request. If an |
| 249 <code>IgnoreRules</code> action is executed, it applies only to other actions | 254 <code>IgnoreRules</code> action is executed, it applies only to other actions |
| 250 that are executed for the same web request in the same stage. | 255 that are executed for the same web request in the same stage. |
| 251 </p> | 256 </p> |
| OLD | NEW |