onemen wrote:Hello Alex,
I'm the developer of Tab mix plus
Both Tab mix and your extension change Firefox code.
When your extension installed Tab mix can't access the original Firefox functions (hookFunctionInChain) since your extension hide it in a closure.
Is it possible for you to save the original function in an object that other extensions have access to?
Hello oneman,
Thank you for getting in touch. I'm a big admirer of your Tab Mix Plus extension. With regards to modifying the code, what BackTrack does by default is to replace the current firefox function with a new one, and call the current one from the new one. This is the recommended practice, as described by Mozilla:
http://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Appendix_C:_Avoid_using_eval_in_Add-ons#Overriding.2FExtending.2FAmending_existing_functionsThe idea being, if both our add-ons want to override, for example, openLinkIn, then the first one to execute replaces the native openLinkIn with their own version (openLinkInA), then calls the original. The second one to execute replaces the now current openLinkInA with
their override, openLinkInB, which calls the one they are replacing. So openLinkInB calls openLinkInA which finally calls the native openLinkIn. This works well if add-ons want to execute code before, or after the native function, or to modify parameter values. It doesn't work so well if they want to replace the function entirely and not call the original at all, but then logically it is not possible for more than one add-on to completely replace the behaviour with something different!
As I know that using string-patching and eval to modify functions has been used by several other add-ons, yours included, I provided a config setting,
extensions.backtrack.stringPatchCompatibility, which will make BackTrack modify the existing function rather than replacing it. I've done my best to try an ensure it won't interfere with other modifications by only adding minimal code at the start and marking it clearly, but it's still possible that clashes could occur.