Question: It seems that Firefox WebExtension API doesn't provide APIs like "chrome.debugger" to handle Javascript dialogs.

Related code in Chrome extension

```
chrome.debugger.sendCommand({"tabId": tabId}, "Page.handleJavaScriptDialog", {accept:true}, function(msg){
        //TODO
    });

```

So how to achieve this in Firefox WebExtension?

Answer: 
You can intercept the alert and confirm functions on the page level by crossing the security boundary from the context script environment into the page environment at [document\_start](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/content_scripts#run_at) time 

<https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Sharing_objects_with_page_scripts>
I use notifications for displaying messages to the user:

```
browser.notifications.create({
    type: "basic",
    title: "Removed browsing data",
    message: "Removed everything"
});

```

<https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/notifications>

For input, I would open a new tab (if acceptable) or a modal popup, which you will have to make yourself. You could do that with a content script.