OLD | NEW |
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 Loading... |
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 var global = false; | 388 target.networkAgent().getCookies(barrier.createCallback(mycallback.bind(null
, target))); |
389 target.networkAgent().getCookies(global, barrier.createCallback(mycallback.b
ind(null, target))); | |
390 } | |
391 barrier.callWhenDone(callback.bind(null, allCookies)); | 389 barrier.callWhenDone(callback.bind(null, allCookies)); |
392 }; | 390 }; |
393 | 391 |
394 /** | 392 /** |
395 * @param {!SDK.Target} target | 393 * @param {!SDK.Target} target |
396 * @param {!Protocol.Network.Cookie} protocolCookie | 394 * @param {!Protocol.Network.Cookie} protocolCookie |
397 * @return {!SDK.Cookie} | 395 * @return {!SDK.Cookie} |
398 */ | 396 */ |
399 SDK.Cookies._parseProtocolCookie = function(target, protocolCookie) { | 397 SDK.Cookies._parseProtocolCookie = function(target, protocolCookie) { |
400 var cookie = new SDK.Cookie(target, protocolCookie.name, protocolCookie.value,
null); | 398 var cookie = new SDK.Cookie(target, protocolCookie.name, protocolCookie.value,
null); |
(...skipping 29 matching lines...) Expand all Loading... |
430 /** | 428 /** |
431 * @param {string} cookieDomain | 429 * @param {string} cookieDomain |
432 * @param {string} resourceDomain | 430 * @param {string} resourceDomain |
433 * @return {boolean} | 431 * @return {boolean} |
434 */ | 432 */ |
435 SDK.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceD
omain) { | 433 SDK.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceD
omain) { |
436 if (cookieDomain.charAt(0) !== '.') | 434 if (cookieDomain.charAt(0) !== '.') |
437 return resourceDomain === cookieDomain; | 435 return resourceDomain === cookieDomain; |
438 return !!resourceDomain.match(new RegExp('^([^\\.]+\\.)*' + cookieDomain.subst
ring(1).escapeForRegExp() + '$', 'i')); | 436 return !!resourceDomain.match(new RegExp('^([^\\.]+\\.)*' + cookieDomain.subst
ring(1).escapeForRegExp() + '$', 'i')); |
439 }; | 437 }; |
OLD | NEW |