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));
    }
  });
Xan
  • 74,770
  • 16
  • 179
  • 206
  • Indeed, `prompt()` and friends are not available: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Chrome_incompatibilities#Miscellaneous_incompatibilities – Xan Nov 14 '18 at 13:22

0 Answers0