Get window object from tab

前端 未结 2 963
臣服心动
臣服心动 2021-01-14 08:42

I am developing an extension on Firefox\'s Addon SDK (v1.10).

My extension has a toolbarbutton that updates a small badge to its left based on the contents of the ac

2条回答
  •  情话喂你
    2021-01-14 09:10

    Looking at the SDK source code (namely packages/api-utils/lib/tabs/tab.js), a tab object actually has a window property. I tested it and this works indeed:

    console.log(require("tabs").activeTab.window.title);
    

    Not sure why this property isn't documented, probably a documentation bug.

提交回复
热议问题