Cookie.cpp |
Cookie:
creation helper
**************************************************************************** |
8532 |
Cookie.h |
The Cookie class is the main cookie storage medium for use within cookie
code.
|
6386 |
CookieCommons.cpp |
|
36523 |
CookieCommons.h |
|
7458 |
CookieJarSettings.cpp |
|
23139 |
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 |
|
1856 |
CookieNotification.h |
|
1803 |
CookieParser.cpp |
|
38136 |
CookieParser.h |
|
3941 |
CookiePersistentStorage.cpp |
|
84411 |
CookiePersistentStorage.h |
|
5096 |
CookiePrivateStorage.cpp |
|
1419 |
CookiePrivateStorage.h |
|
2014 |
CookieService.cpp |
Enables sanitizeOnShutdown cleaning prefs and disables the
network.cookie.lifetimePolicy
|
60917 |
CookieService.h |
CookieService:
class declaration
**************************************************************************** |
4919 |
CookieServiceChild.cpp |
|
26508 |
CookieServiceChild.h |
|
2970 |
CookieServiceParent.cpp |
|
13802 |
CookieServiceParent.h |
|
3397 |
CookieStorage.cpp |
|
41631 |
CookieStorage.h |
|
9195 |
CookieXPCShellUtils.sys.mjs |
-*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- |
1768 |
moz.build |
|
1824 |
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
|
11545 |
nsICookieNotification.idl |
Meta object dispatched by cookie change notifications.
|
2743 |
nsICookiePermission.idl |
An interface to test for cookie permissions
|
1102 |
nsICookieService.idl |
@see nsICookieService::runInTransaction
|
7490 |
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
|
2659 |
test |
|
|