Is it possible to clear down the URL bar?

I’m trying to port my Neo Diggler extension to a WebExtention, and one key feature of it is a one-click clear-the-URL-bar button (prior to paste / typing / etc.), followed by focusing the URL bar.

Are either of these two actions possible now in any way, shape or form? I’m not trying set the URL bar to something arbitrary, which I know could be a security issue, just clear it (and possibly reset it back to what it ought to be after clearing it, another option of the extension).

After some rummaging and cursory experimentation, I’ve a horrid feeling I can’t do it …

If browser.urlbar.clickSelectsAll is set to true (default on Windows), pressing F6 or clicking the URL-bar will select all text. Pasting, typing or pressing del will thus replace/remove the current content. Pressing escape twice after changing stuff will revert back to the original content.

If you absolutely want to do that programmatically, you could use native messaging with a program that sends those keyboard commands.

Ok, as I feared. That workaround doesn’t really help the use case, especially on Linux as it pilfers the primary selection (so you can’t do select / clear / middle-click-paste).

Oh well, I’ll just have to live with it doing (some of) its secondary functionality [it also used to give short cuts to a couple of browser prefs, but they’re unavailable now, too].