Commit f062a566 authored by Vincent Ardisson's avatar Vincent Ardisson Committed by Romain Bignon

contrib/webextension-session-importer: fix cookie if different domain

If a cookie was stored for example.com and the current url is example.net,
the webext cookie API would reject the cookie. Use the domain of the cookie
as the URL associated with the cookie.
parent 453eb903
......@@ -84,7 +84,11 @@ function clearCookies(cookieStoreId, url) {
function setCookies(cookieStoreId, url, objs) {
return new Promise(function(resolve, reject) {
var promises = objs.map(function(obj) {
obj.url = url;
if (obj.domain.startsWith('.')) {
obj.url = 'https://' + obj.domain.substring(1);
} else {
obj.url = 'https://' + obj.domain;
}
obj.storeId = cookieStoreId;
return makePromise(browser.cookies.set, browser.cookies, obj);
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment