Chromium Code Reviews| 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 getURL = chrome.extension.getURL; | 5 var getURL = chrome.extension.getURL; |
| 6 var deepEq = chrome.test.checkDeepEq; | 6 var deepEq = chrome.test.checkDeepEq; |
| 7 var expectedEventData; | 7 var expectedEventData; |
| 8 var capturedEventData; | 8 var capturedEventData; |
| 9 var capturedUnexpectedData; | 9 var capturedUnexpectedData; |
| 10 var expectedEventOrder; | 10 var expectedEventOrder; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 didMatchTabAndFrameId && | 197 didMatchTabAndFrameId && |
| 198 exp.details.method === details.method && | 198 exp.details.method === details.method && |
| 199 exp.details.url === details.url && | 199 exp.details.url === details.url && |
| 200 exp.details.type === details.type; | 200 exp.details.type === details.type; |
| 201 }); | 201 }); |
| 202 } | 202 } |
| 203 | 203 |
| 204 function captureEvent(name, details, callback) { | 204 function captureEvent(name, details, callback) { |
| 205 // Ignore system-level requests like safebrowsing updates and favicon fetches | 205 // Ignore system-level requests like safebrowsing updates and favicon fetches |
| 206 // since they are unpredictable. | 206 // since they are unpredictable. |
| 207 if (details.type == "other" || | 207 if (details.type == "other" && !details.url.includes('dont-ignore-me') || |
|
Marijn Kruisselbrink
2016/08/15 22:02:15
nit: I think this would be clearer with an extra p
robwu
2016/08/17 08:44:32
Done.
| |
| 208 isUnexpectedDetachedRequest(name, details) || | 208 isUnexpectedDetachedRequest(name, details) || |
| 209 details.url.match(/\/favicon.ico$/) || | 209 details.url.match(/\/favicon.ico$/) || |
| 210 details.url.match(/https:\/\/dl.google.com/)) | 210 details.url.match(/https:\/\/dl.google.com/)) |
| 211 return; | 211 return; |
| 212 | 212 |
| 213 // Pull the extra per-event options out of the expected data. These let | 213 // Pull the extra per-event options out of the expected data. These let |
| 214 // us specify special return values per event. | 214 // us specify special return values per event. |
| 215 var currentIndex = capturedEventData.length; | 215 var currentIndex = capturedEventData.length; |
| 216 var extraOptions; | 216 var extraOptions; |
| 217 var retval; | 217 var retval; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 helper('onHeadersReceived'); | 413 helper('onHeadersReceived'); |
| 414 helper('onResponseStarted'); | 414 helper('onResponseStarted'); |
| 415 helper('onBeforeRedirect'); | 415 helper('onBeforeRedirect'); |
| 416 helper('onCompleted'); | 416 helper('onCompleted'); |
| 417 helper('onErrorOccurred'); | 417 helper('onErrorOccurred'); |
| 418 } | 418 } |
| 419 | 419 |
| 420 function resetDeclarativeRules() { | 420 function resetDeclarativeRules() { |
| 421 chrome.declarativeWebRequest.onRequest.removeRules(); | 421 chrome.declarativeWebRequest.onRequest.removeRules(); |
| 422 } | 422 } |
| OLD | NEW |