Alternative to prompt() in a Firefox WebExtension

1

I am porting a Chrome Extension to Firefox and there's a use case which requires generating a prompt to take input.

A context menu is created, on page context a prompt should open whose result is passed onto a function. In Chrome it works fine, but in Firefox it doesn't. The debugger stops & shows the stack trace and displays undefined:undefined. I'm trying to use window.prompt()

Please suggest an alternative or a method to work with this.

Console shows this, not sure if it's related:

NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMWindowUtils.isParentWindowMainWidgetVisible]

chrome.contextMenus.create({
  "title": "Title...",
  "contexts":["page"],
  "onclick": function(info, tab)
    {
      someFunc(window.prompt("someDisplayText", info.selectionText));
    }
  });
javascript
google-chrome
firefox
prompt
firefox-webextensions
asked on Stack Overflow Nov 13, 2018 by Sushrita Yerra • edited Nov 14, 2018 by Xan

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0