I am aware that both these apis are used to inject Javascript into the webpage. Is there any difference between loadSubScript and loadFrameScript in Firefox extension development? In which situation would you use them?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume that you are asking about mozIJSSubscriptLoader.loadSubScript() and nsIChromeFrameMessageManager.loadFrameScript(). These are two entirely different mechanisms with the only similarity being that both can load and execute code.
mozIJSSubscriptLoaderisn’t meant to load code into web pages – its primary goal is to load parts of your extension dynamically. This is a very old mechanism that even predates JavaScript code modules.The goal of
loadFrameScript()is to load content scripts however, originally introduced to support multi-process setups (e10s project). It will load scripts that will run with the privileges of the web page in the context of the web page. No direct interaction with the code that loaded it is possible, only messaging.