Selection in the location bar

I have a function that is called by an overlay of the popup window that is
opened when one right-click on the location bar.
I would like to have the text that could be selected in the location bar.
I tried vartiations on

 window.opener.content.document.getSelection();
...
 content.document.getSelection();

without success.

Thanks for any suggestion
F.

Popup window? You mean the context menu? It doesn’t have a separate overlay, just the same overlay as the rest of the window.

The selection in the urlbar itself is not part of content. You just find the urlbar textbox (shouldn’t be hard if it is the popupNode) and use the standard textbox selection properties.

OK thanks, I found this, that works

var w = document.popupNode;
var sel = w.value.substring(w.selectionStart, w.selectionEnd);

That looks right. I hate working with the urlbar, it has so many layers and anonymous nodes, but in this case it looks quite simple.