Closed Bug 1330062 Opened 7 years ago Closed 7 years ago

chrome.cookies.getAllCookieStores returns CookieStore objects containing Tabs instead of tab ids

Categories

(WebExtensions :: Untriaged, defect, P2)

53 Branch
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1330167

People

(Reporter: screenwise.browsers, Assigned: bsilverberg)

Details

(Whiteboard: triaged)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

Steps to reproduce:

In porting our Chrome WebExtension app to Firefox I found a difference in the way that  getAllCookieStores was implemented. I'm testing the port in Nightly Firefox 53.

Make a call to chrome.cookies.getAllCookies then iterate through the CookieStore objects that are returned.

function(storeId) {
  chrome.cookies.getAllCookieStores(function(cookieStores) {
    var matchingStore = array.find(cookieStores, function(store) {
      return store.id === storeId;
    });

    console.log('matching store ' + matchingStore);
  });
};


Actual results:

CookieStore objects were returned that had Tab objects in the tabIds array instead of just the integer tab ids. E.g:

matching store {
    "id": "firefox-default",
    "tabIds": [
        {
            "id": 1,
            "index": 0,
            "windowId": 3,
            ...
        },
        {
            "id": 4,
            "index": 1,
            "windowId": 3,
            ...
        },
    ],
    "incognito": false
}



Expected results:

According to the API documentation (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/cookies/CookieStore) the CookieStore object should have an array of integers (tabIds) that identify all of the browser tabs that share this cookie store.
E.g:

matching store {
    "id": "0",
    "tabIds": [
        2,
        24,
        12
    ]
}

I wasn't able to find anything online regarding this issue.

Thanks!
Component: Untriaged → WebExtensions: Untriaged
Product: Firefox → Toolkit
Assignee: nobody → bob.silverberg
Priority: -- → P2
Whiteboard: triaged
I am unable to reproduce this using Nightly on OS X. Can you please provide some more details on your environment and how you are able to produce this issue?
Flags: needinfo?(screenwise.browsers)
(In reply to Bob Silverberg [:bsilverberg] from comment #1)
> I am unable to reproduce this using Nightly on OS X. Can you please provide
> some more details on your environment and how you are able to produce this
> issue?

I'm running on a x86_64 GNU/Linux desktop with Firefox Nightly 53.0a1 (2017-01-09) (64-bit). I use the about:debugging page to load the temp add-on and then click the debug button to verify output.

Here is the implementation that we have:

function(storeId, callback) {
  chrome.cookies.getAllCookieStores(function(cookieStores) {
    var matchingStore = array.find(cookieStores, function(store) {
      return store.id === storeId;
    });
  
    if (matchingStore != null && !array.isEmpty(matchingStore.tabIds)) {
      chrome.tabs.get(matchingStore.tabIds[0], function(tab) {
        if (!tab.incognito) {
          callback();
        }
      });
    }
  });
};

We end up with the error 'Incorrect argument types for tabs.get'.


Also, within the same Debug console I entered the following on the command line:

chrome.cookies.getAllCookieStores(function(cs){console.log(JSON.stringify(cs,null,4));});

It, too, provided me with an object that had actual Tabs in the tabIds array:

[
    {
        "id": "firefox-default",
        "tabIds": [
            {
                "id": 1,
                "index": 0,
                "windowId": 3,
                "selected": true,
                "highlighted": true,
                "active": true,
                "pinned": false,
                "status": "complete",
                "incognito": false,
                "width": 1080,
                "height": 876,
                "audible": false,
                "mutedInfo": {
                    "muted": false
                },
                "cookieStoreId": "firefox-default",
                "url": "about:debugging",
                "title": "Debugging with Firefox Developer Tools"
            }
        ],
        "incognito": false
    }
]

Does this help?
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Flags: needinfo?(screenwise.browsers)
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.