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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js

Issue 2554293002: devtools: Make it possible to retrieve all cookies (Closed)
Patch Set: Update front-end Created 4 years 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 function mycallback(target, error, cookies) { 377 function mycallback(target, error, cookies) {
378 if (error) { 378 if (error) {
379 console.error(error); 379 console.error(error);
380 return; 380 return;
381 } 381 }
382 for (var i = 0; i < cookies.length; ++i) 382 for (var i = 0; i < cookies.length; ++i)
383 allCookies.push(SDK.Cookies._parseProtocolCookie(target, cookies[i])); 383 allCookies.push(SDK.Cookies._parseProtocolCookie(target, cookies[i]));
384 } 384 }
385 385
386 var barrier = new CallbackBarrier(); 386 var barrier = new CallbackBarrier();
387 for (var target of SDK.targetManager.targets(SDK.Target.Capability.Network)) 387 for (var target of SDK.targetManager.targets(SDK.Target.Capability.Network)) {
388 target.networkAgent().getCookies(barrier.createCallback(mycallback.bind(null , target))); 388 var global = false;
389 target.networkAgent().getCookies(global, barrier.createCallback(mycallback.b ind(null, target)));
390 }
389 barrier.callWhenDone(callback.bind(null, allCookies)); 391 barrier.callWhenDone(callback.bind(null, allCookies));
390 }; 392 };
391 393
392 /** 394 /**
393 * @param {!SDK.Target} target 395 * @param {!SDK.Target} target
394 * @param {!Protocol.Network.Cookie} protocolCookie 396 * @param {!Protocol.Network.Cookie} protocolCookie
395 * @return {!SDK.Cookie} 397 * @return {!SDK.Cookie}
396 */ 398 */
397 SDK.Cookies._parseProtocolCookie = function(target, protocolCookie) { 399 SDK.Cookies._parseProtocolCookie = function(target, protocolCookie) {
398 var cookie = new SDK.Cookie(target, protocolCookie.name, protocolCookie.value, null); 400 var cookie = new SDK.Cookie(target, protocolCookie.name, protocolCookie.value, null);
(...skipping 29 matching lines...) Expand all
428 /** 430 /**
429 * @param {string} cookieDomain 431 * @param {string} cookieDomain
430 * @param {string} resourceDomain 432 * @param {string} resourceDomain
431 * @return {boolean} 433 * @return {boolean}
432 */ 434 */
433 SDK.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceD omain) { 435 SDK.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceD omain) {
434 if (cookieDomain.charAt(0) !== '.') 436 if (cookieDomain.charAt(0) !== '.')
435 return resourceDomain === cookieDomain; 437 return resourceDomain === cookieDomain;
436 return !!resourceDomain.match(new RegExp('^([^\\.]+\\.)*' + cookieDomain.subst ring(1).escapeForRegExp() + '$', 'i')); 438 return !!resourceDomain.match(new RegExp('^([^\\.]+\\.)*' + cookieDomain.subst ring(1).escapeForRegExp() + '$', 'i'));
437 }; 439 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698