Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: chrome/test/data/extensions/api_test/webrequest/framework.js

Issue 1413543005: Use FrameTreeNode ID as frameId in extension APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/:/ / Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return name === exp.event && 184 return name === exp.event &&
185 exp.details.tabId === -1 && 185 exp.details.tabId === -1 &&
186 exp.details.frameId === -1 && 186 exp.details.frameId === -1 &&
187 exp.details.method === details.method && 187 exp.details.method === details.method &&
188 exp.details.url === details.url && 188 exp.details.url === details.url &&
189 exp.details.type === details.type; 189 exp.details.type === details.type;
190 }); 190 });
191 } 191 }
192 192
193 function captureEvent(name, details, callback) { 193 function captureEvent(name, details, callback) {
194 // frameId should be -1 or positive, but is sometimes -2 (MSG_ROUTING_NONE).
195 // TODO(robwu): This will be resolved once crbug.com/432875 is resolved.
196 if (details.frameId === -2)
197 details.frameId = -1;
198
199 // Ignore system-level requests like safebrowsing updates and favicon fetches 194 // Ignore system-level requests like safebrowsing updates and favicon fetches
200 // since they are unpredictable. 195 // since they are unpredictable.
201 if (details.type == "other" || 196 if (details.type == "other" ||
202 isUnexpectedDetachedRequest(name, details) || 197 isUnexpectedDetachedRequest(name, details) ||
203 details.url.match(/\/favicon.ico$/) || 198 details.url.match(/\/favicon.ico$/) ||
204 details.url.match(/https:\/\/dl.google.com/)) 199 details.url.match(/https:\/\/dl.google.com/))
205 return; 200 return;
206 201
207 // Pull the extra per-event options out of the expected data. These let 202 // Pull the extra per-event options out of the expected data. These let
208 // us specify special return values per event. 203 // us specify special return values per event.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 helper('onHeadersReceived'); 402 helper('onHeadersReceived');
408 helper('onResponseStarted'); 403 helper('onResponseStarted');
409 helper('onBeforeRedirect'); 404 helper('onBeforeRedirect');
410 helper('onCompleted'); 405 helper('onCompleted');
411 helper('onErrorOccurred'); 406 helper('onErrorOccurred');
412 } 407 }
413 408
414 function resetDeclarativeRules() { 409 function resetDeclarativeRules() {
415 chrome.declarativeWebRequest.onRequest.removeRules(); 410 chrome.declarativeWebRequest.onRequest.removeRules();
416 } 411 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698