I think the problem is that the url should be a fully qualified URL, including the protocol. This version works:
var finalCookieObj = { domain: ".qa.soul.com", name: "aaa", value: "as", path: "/", httpOnly: false, url: "https://qa.soul.com/", expirationDate: 1459788960 }; chrome.cookies.set(finalCookieObj, function(cookie) { console.log('added cookie'); });
I am updating documents to be explicit.
In addition, asynchronous functions report errors by setting chrome.runtime.lastError : it is always useful to check this in your callback.
Funny, however, I see another console output for you. I see an error:
[Exception... "Component returned failure code: 0x804b000a (NS_ERROR_MALFORMED_URI) [nsIIOService.newURI]" nsresult: "0x804b000a (NS_ERROR_MALFORMED_URI)" location: "JS frame :: resource://gre/modules/NetUtil.jsm :: NetUtil_newURI :: line 191" data: no]
... which includes a call stack containing NetUtil_newURI() , this was enough to point to the url as a problem. What console are you looking at?
source share