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

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

Issue 348253002: Add CORS headers to URLRequestRedirectJob. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use a more efficient string concatenation method Created 6 years, 5 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 chrome.test.assertTrue('frameId' in details && 196 chrome.test.assertTrue('frameId' in details &&
197 typeof details.frameId === 'number'); 197 typeof details.frameId === 'number');
198 chrome.test.assertTrue('tabId' in details && 198 chrome.test.assertTrue('tabId' in details &&
199 typeof details.tabId === 'number'); 199 typeof details.tabId === 'number');
200 var key = details.tabId + "-" + details.frameId; 200 var key = details.tabId + "-" + details.frameId;
201 if (details.type == "main_frame" || details.type == "sub_frame") { 201 if (details.type == "main_frame" || details.type == "sub_frame") {
202 tabAndFrameUrls[key] = details.url; 202 tabAndFrameUrls[key] = details.url;
203 } 203 }
204 details.frameUrl = tabAndFrameUrls[key] || "unknown frame URL"; 204 details.frameUrl = tabAndFrameUrls[key] || "unknown frame URL";
205 } 205 }
206 if (name == "onBeforeRedirect") {
207 // This value is just an implementation detail of the network layer.
208 // This status code means that the redirect originates from the network
209 // layer, e.g. caused by a Chrome extension.
210 // The status line is not guaranteed to be stable.
211 if (details.statusLine == "HTTP/1.1 307 Delegate") {
212 details.statusLine = "";
213 }
214 }
206 215
207 // This assigns unique IDs to frames. The new IDs are only deterministic, if 216 // This assigns unique IDs to frames. The new IDs are only deterministic, if
208 // the frames documents are loaded in order. Don't write browser tests with 217 // the frames documents are loaded in order. Don't write browser tests with
209 // more than one frame ID and rely on their numbers. 218 // more than one frame ID and rely on their numbers.
210 if (!(details.frameId in frameIdMap)) { 219 if (!(details.frameId in frameIdMap)) {
211 // Subtract one to discount for {"-1": -1} mapping that always exists. 220 // Subtract one to discount for {"-1": -1} mapping that always exists.
212 // This gives the first frame the ID 0. 221 // This gives the first frame the ID 0.
213 frameIdMap[details.frameId] = Object.keys(frameIdMap).length - 1; 222 frameIdMap[details.frameId] = Object.keys(frameIdMap).length - 1;
214 } 223 }
215 details.frameId = frameIdMap[details.frameId]; 224 details.frameId = frameIdMap[details.frameId];
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 helper('onHeadersReceived'); 388 helper('onHeadersReceived');
380 helper('onResponseStarted'); 389 helper('onResponseStarted');
381 helper('onBeforeRedirect'); 390 helper('onBeforeRedirect');
382 helper('onCompleted'); 391 helper('onCompleted');
383 helper('onErrorOccurred'); 392 helper('onErrorOccurred');
384 } 393 }
385 394
386 function resetDeclarativeRules() { 395 function resetDeclarativeRules() {
387 chrome.declarativeWebRequest.onRequest.removeRules(); 396 chrome.declarativeWebRequest.onRequest.removeRules();
388 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698