Bug 1384657 - fix pocket when cookie first party isolation has been turned on, r=tjr,thecount
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 27 Dec 2018 21:45:18 +0000
changeset 509121 623fa9efc4652d7d4d7386b70721b7ff844ca856
parent 509120 fa852dc8467264e74881f1c4d1610340349e7c26
child 509122 9a4d3d6e59ae472f58d621b219f1b8488a224f92
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstjr, thecount
bugs1384657
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1384657 - fix pocket when cookie first party isolation has been turned on, r=tjr,thecount Differential Revision: https://phabricator.services.mozilla.com/D15097
browser/components/pocket/content/pktApi.jsm
--- a/browser/components/pocket/content/pktApi.jsm
+++ b/browser/components/pocket/content/pktApi.jsm
@@ -43,16 +43,17 @@
  */
 
 var EXPORTED_SYMBOLS = ["pktApi"];
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyGlobalGetters(this, ["XMLHttpRequest"]);
+XPCOMUtils.defineLazyPreferenceGetter(this, "gCookieFirstPartyIsolate", "privacy.firstparty.isolate", false);
 
 var pktApi = (function() {
 
     /**
      * Configuration
      */
 
     // Base url for all api calls
@@ -151,17 +152,21 @@ var pktApi = (function() {
      */
 
     /*
      *  All cookies from the Pocket domain
      *  The return format: { cookieName:cookieValue, cookieName:cookieValue, ... }
     */
     function getCookiesFromPocket() {
         var cookies = {};
-        for (let cookie of Services.cookies.getCookiesFromHost(pocketSiteHost, {})) {
+        let oa = {};
+        if (gCookieFirstPartyIsolate) {
+          oa.firstPartyDomain = pocketSiteHost;
+        }
+        for (let cookie of Services.cookies.getCookiesFromHost(pocketSiteHost, oa)) {
             cookies[cookie.name] = cookie.value;
         }
         return cookies;
     }
 
     /**
      * Returns access token or undefined if no logged in user was found
      * @return {string | undefined} Access token for logged in user user