Closed Bug 1330167 Opened 3 years ago Closed 3 years ago

cookies.CookieStore.tabIds is an array of Tabs, should be an array of tab IDs

Categories

(WebExtensions :: General, defect)

defect
Not set

Tracking

(firefox53 fixed)

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: wbamberg, Assigned: Tomislav)

References

Details

Attachments

(2 files)

Attached file cookies.zip
I've attached an example, which contains a background script like this:

function logStores(cookieStores) {
  for(store of cookieStores) {
    console.log(`Cookie store: ${store.id}\n Tab IDs:`, store.tabIds);
  }
}

function listCookieStores() {
  var getting = chrome.cookies.getAllCookieStores(logStores);
}

chrome.browserAction.onClicked.addListener(listCookieStores);

It gets all cookie stores, and logs each store's id and tabIds property. According to the docs (https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/Cookies/CookieStore), tabIds is an array of integers, where each integer is a Tab ID.

In Chrome, this is what you get. In Firefox, you get an array of Tab objects.
Assignee: nobody → tomica
Status: NEW → ASSIGNED
Attachment #8826547 - Flags: review?(aswan)
Comment on attachment 8826547 [details]
Bug 1330167 - CookieStore.tabIds should be an array of tab IDs

https://reviewboard.mozilla.org/r/104502/#review105206

::: toolkit/components/extensions/ext-cookies.js:425
(Diff revision 1)
>            let tabs = TabManager.for(extension).getTabs(window);
>            for (let tab of tabs) {
>              if (!(tab.cookieStoreId in data)) {
>                data[tab.cookieStoreId] = [];
>              }
> -            data[tab.cookieStoreId].push(tab);
> +            data[tab.cookieStoreId].push(tab.id);
>            }

This builds up a whole extension-facing Tab object for each tab only to discard everything except the id and the cookieStoreId.  But glancing through the code, I don't see any obvious way to address that without making much bigger changes than this really warrants...
Attachment #8826547 - Flags: review?(aswan) → review+
Comment on attachment 8826547 [details]
Bug 1330167 - CookieStore.tabIds should be an array of tab IDs

https://reviewboard.mozilla.org/r/104502/#review105206

> This builds up a whole extension-facing Tab object for each tab only to discard everything except the id and the cookieStoreId.  But glancing through the code, I don't see any obvious way to address that without making much bigger changes than this really warrants...

*nod*
Keywords: checkin-needed
Autoland can't push this due to unresolved issues in MozReview.
Keywords: checkin-needed
My bad.  It's almost invisible in the new design.  :/
Keywords: checkin-needed
Pushed by ihsiao@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b540a38f365f
CookieStore.tabIds should be an array of tab IDs r=aswan
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/b540a38f365f
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
Duplicate of this bug: 1330062
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.