Search code examples
javascriptfirefox-addonxulfirefox-addon-sdk

How to override a method in the script of a XUL in another add-on?


I would like to change the behavior/extend some of the functionality in another add-on. The answer in Is it possible to modify a firefox addon written using XUL with an addon written using the Addon SDK says

There are certain ways to monkey-patch code in Javascript code modules, if you really have to...

but the code I want to modify is the js script for a xul overlay

Is it possible to override some functions in that script? And if so, how? It looks like overlaying the xul with my own to run code in its context would work, as suggested in Overriding/Overlaying a XUL method, but is there a way to do this with the add-on sdk? (Jetpack)

Thanks.


Solution

  • This xul article shows how to override functions: https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Appendix_C:_Avoid_using_eval_in_Add-ons?redirectlocale=en-US&redirectslug=XUL_School%2FAppendix_C%3A_Avoid_using_eval_in_Add-ons

    This topic here shows how to access code scope of addons: Controlling a Firefox Extension via Javascript