Paste from Clipboard

I added “clipboardRead” to permissions to my extension, but can’t find right way to use it. My javascript file:

browser.browserAction.onClicked.addListener(function() {
// Returns: false
//var item = “” + String(document.execCommand(“copy”));

// Returns: true
//let item = “” + document.execCommand(“paste”);

// Returns: [object Promise]
let item = “” + navigator.clipboard.readText();

// Returns nothing
//let item = “” + await this.getClipboardText();

var creating = browser.tabs.create({
url: item
creating.then(onCreated, onError);

The easiest way to get the text contents of the clipboard without using HTML elements is

Thank you! Got code partially working. Can use only URLs from clipboard. Now need to find a way to compare if clipboard contains URL or some other text string and that case to start google search.

Current code

    clipText => browser.tabs.create({

You could use the URL constructor to detect strings that aren’t valid URLs, since it throws in that case: