piroor / treestyletab

Tree Style Tab, Show tabs like a tree.
http://piro.sakura.ne.jp/xul/treestyletab/
Other
3.48k stars 279 forks source link

[Bug] set-extra-contents to new-tab-button doesn't seem to respect window parameter #3578

Closed rixx closed 3 months ago

rixx commented 3 months ago

Abstract

I'm trying to put the number of tabs in the current window into the "new tab" button. However, all windows end up displaying the number of tabs in the last given window.

Steps to reproduce

You can see my code here. I'm sending a message like this:

{
    "messages": [
        {
            "type": "set-extra-contents",
            "place": "new-tab-button",
            "contents": "85 tabs",
            "windowId": 1
        },
        {
            "type": "set-extra-contents",
            "place": "new-tab-button",
            "contents": "4 tabs",
            "windowId": 10202
        }
    ]
}

However, both "new tab" buttons end up showing the latter message. I've verified that this happens if I send the messages individually instead of in an array, aswell.

Is this a limitation of Firefox or a bug in TST? It looks to me like setExtraNewTabButtonContents isn't attempting to read the passed windowID. I understood the documentation to say that passing a windowID is allowed, is this not correct?

Environment

piroor commented 3 months ago

Did you try this?:

{
    "messages": [
        {
            "type": "set-extra-contents",
            "place": "new-tab-button",
            "contents": "85 tabs",
            "windowId": 1  // <== windowI*d*, not windowI*D*
        },
        {
            "type": "set-extra-contents",
            "place": "new-tab-button",
            "contents": "4 tabs",
            "windowId": 10202  // <== windowI*d*, not windowI*D*
        }
    ]
}
rixx commented 3 months ago

@piroor Oh, yeah, sorry, I'll edit my original post – I tried both spellings and forgot to update that.

You can try this for yourself by running:

browser.runtime.sendMessage('treestyletab@piro.sakura.ne.jp', {type: 'set-extra-contents', place: 'new-tab-button', contents: 'appearing on all button instances', windowId: 1})
piroor commented 3 months ago

Thanks, I forgot to check the target window ID...

github-actions[bot] commented 3 months ago

This issue has been closed due to no response within 14 days after labeled as "fixed", 7 days after last reopened, and 7 days after last commented.