You need to request the current window size from a content script, which
is a little awkward in the SDK. The idea is that when you emit an event
into the content script that asks for the window size. The content
script then posts back the window data, and the panel is then sized
based on this.
I hacked a bit on this today and even came up with two slightly
different approaches:
1. implement the event passing and resize in the widget's onClick handler:
https://builder.addons.mozilla.org/addon/1023700/revision/8/
I noticed an odd behaviour with this option - the window is not placed
correctly the first time you click on the widget. I logged a bug for
that ( https://bugzilla.mozilla.org/show_bug.cgi?id=699710 ).
2. everything is handled after the panel is shown ( onShow() ):
https://builder.addons.mozilla.org/addon/1023723/revision/10/
The advantage to this second option is that the panel remains anchored
to the widget, but the first time it is shown you do see the resize happen.
HTH, Jeff