mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1691907 - Part 2: Add a method initWithURI
to nsICookieJarSettings. r=dimi,robwu
This patch adds a method `initwithURI` to nsICookieJarSetting in order to allow JS code to be able to set the paritionKey of the CookieJarSettings. This is needed for web extension for creating and setting the cookieJarSettings for the download resource. Differential Revision: https://phabricator.services.mozilla.com/D109759
This commit is contained in:
parent
13599190d6
commit
ba201347a4
@ -176,6 +176,16 @@ CookieJarSettings::~CookieJarSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CookieJarSettings::InitWithURI(nsIURI* aURI, bool aIsPrivate) {
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
mCookieBehavior = nsICookieManager::GetCookieBehavior(aIsPrivate);
|
||||
|
||||
SetPartitionKey(aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CookieJarSettings::GetCookieBehavior(uint32_t* aCookieBehavior) {
|
||||
*aCookieBehavior = mCookieBehavior;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "nsISerializable.idl"
|
||||
|
||||
interface nsIPrincipal;
|
||||
interface nsIURI;
|
||||
|
||||
/**
|
||||
* Cookie jar settings for top-level documents. Please see CookieJarSettings.h
|
||||
@ -56,4 +57,17 @@ interface nsICookieJarSettings : nsISerializable
|
||||
* during the life-time of the top document.
|
||||
*/
|
||||
unsigned long cookiePermission(in nsIPrincipal aPrincipal);
|
||||
|
||||
/**
|
||||
* Initiate the cookieJarSettings with a URI. The aURI will be used to build
|
||||
* the partition key for this cookieJarSettings. This function is added for
|
||||
* js code to be able to set the partitionKey from a first-party URI.
|
||||
*
|
||||
* The aIsPrivate indicates if this cookieJarSettings is initiated for the
|
||||
* private browsing mode or not. If aIsPrivate was true, it will get
|
||||
* cookieBehavior from the pref "network.cookie.cookieBehavior" which is for
|
||||
* the regular browsing mode. Otherwise, it will get from the pref
|
||||
* "network.cookie.cookieBehavior.pbmode" for the private browsing mode.
|
||||
*/
|
||||
void initWithURI(in nsIURI aURI, in boolean aIsPrivate);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user