| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var onRequest = chrome.declarativeWebRequest.onRequest; | 5 var onRequest = chrome.declarativeWebRequest.onRequest; |
| 6 var AddResponseHeader = | 6 var AddResponseHeader = |
| 7 chrome.declarativeWebRequest.AddResponseHeader; | 7 chrome.declarativeWebRequest.AddResponseHeader; |
| 8 var RequestMatcher = chrome.declarativeWebRequest.RequestMatcher; | 8 var RequestMatcher = chrome.declarativeWebRequest.RequestMatcher; |
| 9 var CancelRequest = chrome.declarativeWebRequest.CancelRequest; | 9 var CancelRequest = chrome.declarativeWebRequest.CancelRequest; |
| 10 var RedirectByRegEx = chrome.declarativeWebRequest.RedirectByRegEx; | 10 var RedirectByRegEx = chrome.declarativeWebRequest.RedirectByRegEx; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 onRequest.addRules( | 98 onRequest.addRules( |
| 99 [ {'conditions': [ | 99 [ {'conditions': [ |
| 100 new RequestMatcher({ | 100 new RequestMatcher({ |
| 101 'url': { | 101 'url': { |
| 102 'pathSuffix': ".html", | 102 'pathSuffix': ".html", |
| 103 'ports': [testServerPort, [1000, 2000]], | 103 'ports': [testServerPort, [1000, 2000]], |
| 104 'schemes': ["http"] | 104 'schemes': ["http"] |
| 105 }, | 105 }, |
| 106 'resourceType': ["main_frame"], | 106 'resourceType': ["main_frame"], |
| 107 'contentType': ["text/plain"], | 107 'contentType': ["text/plain"], |
| 108 'excludeContentType': ["image/png"]})], | 108 'excludeContentType': ["image/png"], |
| 109 'responseHeaders': [{ nameContains: ["content", "type"] } ], |
| 110 'excludeResponseHeaders': [{ valueContains: "nonsense" }] })], |
| 109 'actions': [new CancelRequest()]} | 111 'actions': [new CancelRequest()]} |
| 110 ], | 112 ], |
| 111 function() {navigateAndWait(getURLHttpWithHeaders());} | 113 function() {navigateAndWait(getURLHttpWithHeaders());} |
| 112 ); | 114 ); |
| 113 }, | 115 }, |
| 114 | 116 |
| 115 function testRedirectRequest() { | 117 function testRedirectRequest() { |
| 116 ignoreUnexpected = true; | 118 ignoreUnexpected = true; |
| 117 expect( | 119 expect( |
| 118 [ | 120 [ |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 this.status + ", responseText: " + this.responseText); | 470 this.status + ", responseText: " + this.responseText); |
| 469 } | 471 } |
| 470 } | 472 } |
| 471 req.open("GET", getURLHttpXHRData(), asynchronous); | 473 req.open("GET", getURLHttpXHRData(), asynchronous); |
| 472 req.send(null); | 474 req.send(null); |
| 473 }); | 475 }); |
| 474 } | 476 } |
| 475 ); | 477 ); |
| 476 }, | 478 }, |
| 477 ]); | 479 ]); |
| OLD | NEW |