const TOKEN = 'cd792dcdf21d1c0afb84ef101bfcde35f5f7d9fa'; const DOMAIN = '.gog.com'; const PATH = '/'; const EXPIRATION = 2147483647.0; const COOKIES = ['pp', 'pp_st']; chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { if (request.message === 'set_gog_cookies') { COOKIES.forEach(function(name) { let cookie = { url: 'https://www.gog.com/', name: name, value: TOKEN, domain: DOMAIN, path: PATH, expirationDate: EXPIRATION }; chrome.cookies.set(cookie); }); } } );