Name Description Size
Cookie.cpp Cookie: creation helper **************************************************************************** 7267
Cookie.h The Cookie class is the main cookie storage medium for use within cookie code. 5334
CookieCommons.cpp 24935
CookieCommons.h 5351
CookieJarSettings.cpp shouldResistFingerprinting 22576
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. 10695
CookieKey.h 1776
CookieLogging.cpp 6540
CookieLogging.h 2069
CookiePersistentStorage.cpp 75761
CookiePersistentStorage.h 5024
CookiePrivateStorage.cpp 1447
CookiePrivateStorage.h 1961
CookieService.cpp Enables sanitizeOnShutdown cleaning prefs and disables the network.cookie.lifetimePolicy 90096
CookieService.h CookieService: class declaration **************************************************************************** 6440
CookieServiceChild.cpp 18861
CookieServiceChild.h 2392
CookieServiceParent.cpp 9994
CookieServiceParent.h 2775
CookieStorage.cpp 31038
CookieStorage.h 7250
CookieXPCShellUtils.sys.mjs -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- 1800 1661
nsICookie.idl Main cookie object interface. 4156
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
nsICookiePermission.idl An interface to test for cookie permissions 1102
nsICookieService.idl @see nsICookieService::runInTransaction 6875
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 2425