Firefox add-on works with “jpm run”, but not whith .xpi file generated with “jpm xpi”

后端 未结 1 1414
天命终不由人
天命终不由人 2020-12-18 13:59

I\'m using the Firefox Add-on SDK to develop a Firefox add-on. I have followed the Getting Started tutorial.

Firefox version : 41.0.2
My Process is :

相关标签:
1条回答
  • 2020-12-18 14:03

    As you have determined, if you desire your Firefox Add-on SDK add-on to work in Private Browsing mode you need to have add the key private-browsing with a value of true in your package.json file.

    If you are using no other permissions, you could add a line to your package.json file that looks like:

    "permissions": {"private-browsing": true}
    

    The Firefox documentation on writing SDK add-ons for private browsing mode specifically states that the require("sdk/private-browsing").isPrivate() method will return true when any of the following is the case (emphasis mine):

    • a private window, or
    • a tab belonging to a private window, or
    • a worker that's associated with a document hosted in a private window
    • any window, tab, or worker if the browser has been configured to never remember history (Options->Privacy->History)

    If you do not have "private-browsing": true, then, as the documentation states, the following will be the case (emphasis mine):

    • the windows module will not list any private browser windows, generate any events for private browser windows, or let the add-on open any private browser windows
    • the tabs module will not list any tabs that belong to private browser windows, and the add-on won't receive any events for such tabs
    • any ui components will not be displayed in private browser windows
    • any menus or menu items created using the context-menu will not be shown in context menus that belong to private browser windows
    • the page-mod module will not attach content scripts to documents belonging to private browser windows
    • any panel objects will not be shown if the active window is a private browser window
    • the selection module will not include any selections made in private browser windows

    The net effect will be that your add-on will appear to not work when the profile you are using is configured to never remember history without having the "private-browsing": true permission in your package.json.

    If you do put that permission in your package.json file, you must use the private-browsing module, require("sdk/private-browsing").isPrivate(object), to check for being in a private window or tab. If you are in such a window or tab you need to not store any information about such environment.

    0 讨论(0)
提交回复
热议问题