Name Description Size
Cookie.cpp Cookie: creation helper **************************************************************************** 9570
Cookie.h The Cookie class is the main cookie storage medium for use within cookie code. 5965
CookieCommons.cpp 26486
CookieCommons.h 5431
CookieJarSettings.cpp 23133
CookieJarSettings.h CookieJarSettings ~~~~~~~~~~~~~~ CookieJarSettings is a snapshot of the cookie jar's configurations in a precise moment of time, such as the cookie policy and cookie permissions. This object is used by top-level documents to have a consistent cookie jar configuration also in case the user changes it. New configurations will apply only to new top-level documents. CookieJarSettings creation ~~~~~~~~~~~~~~~~~~~~~~~ CookieJarSettings is created when the top-level document's nsIChannel's nsILoadInfo is constructed. Any sub-resource and any sub-document inherits it from that nsILoadInfo. Also dedicated workers and their resources inherit it from the parent document. SharedWorkers and ServiceWorkers have their own CookieJarSettings because they don't have a single parent document (SharedWorkers could have more than one, ServiceWorkers have none). In Chrome code, we have a new CookieJarSettings when we download resources via 'Save-as...' and we also have a new CookieJarSettings for favicon downloading. Content-scripts WebExtensions also have their own CookieJarSettings because they don't have a direct access to the document they are running into. Anything else will have a special CookieJarSettings which blocks everything (CookieJarSettings::GetBlockingAll()) by forcing BEHAVIOR_REJECT as policy. When this happens, that context will not have access to the cookie jar and no cookies are sent or received. Propagation of CookieJarSettings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CookieJarSettings are shared inside the same top-level document via its nsIChannel's nsILoadInfo. This is done automatically if you pass a nsINode to NS_NewChannel(), and it must be done manually if you use a different channel constructor. For instance, this happens for any worker networking operation. We use the same CookieJarSettings for any resource belonging to the top-level document even if cross-origin. This makes the browser behave consistently a scenario where A loads B which loads A again, and cookie policy/permission changes in the meantime. Cookie Permissions propagation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CookieJarSettings populates the known cookie permissions only when required. Initially the list is empty, but when CookieJarSettings::CookiePermission() is called, the requested permission is stored in the internal list if it doesn't exist yet. This is actually nice because it relies on the permission propagation from parent to content process. No extra IPC is required. Note that we store permissions with UNKNOWN_ACTION values too because they can be set after the loading of the top-level document and we don't want to return a different value when this happens. Use of CookieJarSettings ~~~~~~~~~~~~~~~~~~~~~ In theory, there should not be direct access to cookie permissions or cookieBehavior pref. Everything should pass through CookieJarSettings. A reference to CookieJarSettings can be obtained from nsILoadInfo::GetCookieJarSettings(), from Document::CookieJarSettings() and from the WorkerPrivate::CookieJarSettings(). CookieJarSettings is thread-safe, but the permission list must be touched only on the main-thread. Testing ~~~~~~~ If you need to test the changing of cookie policy or a cookie permission, you need to workaround CookieJarSettings. This can be done opening a new window and running the test into that new global. 10862
CookieKey.h 1776
CookieLogging.cpp 6540
CookieLogging.h 2069
CookieNotification.cpp 1545
CookieNotification.h 1458
CookiePersistentStorage.cpp 78100
CookiePersistentStorage.h 5049
CookiePrivateStorage.cpp 1447
CookiePrivateStorage.h 2004
CookieService.cpp Enables sanitizeOnShutdown cleaning prefs and disables the network.cookie.lifetimePolicy 96979
CookieService.h CookieService: class declaration **************************************************************************** 6511
CookieServiceChild.cpp 27326
CookieServiceChild.h 2519
CookieServiceParent.cpp 12230
CookieServiceParent.h 3032
CookieStorage.cpp 35374
CookieStorage.h 7934
CookieXPCShellUtils.sys.mjs -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- 1768 1755
nsICookie.idl Main cookie object interface. 4593
nsICookieJarSettings.idl Cookie jar settings for top-level documents. Please see CookieJarSettings.h for more details. 3042
nsICookieManager.idl An optional interface for accessing or removing the cookies that are in the cookie list 10427
nsICookieNotification.idl Meta object dispatched by cookie change notifications. 2429
nsICookiePermission.idl An interface to test for cookie permissions 1102
nsICookieService.idl @see nsICookieService::runInTransaction 6111
PCookieService.ipdl PCookieService Provides IPDL methods for setting and getting cookies. These are stored on and managed by the parent; the child process goes through the parent for all cookie operations. Lower-level programmatic operations (i.e. those provided by the nsICookieManager interface) are not currently implemented and requesting these interfaces in the child will fail. @see nsICookieService @see nsICookiePermission 2432