Confirmed users, Bureaucrats and Sysops emeriti
419
edits
Line 136: | Line 136: | ||
// which the returned function will execute when called. | // which the returned function will execute when called. | ||
// Generally you pass |this|. | // Generally you pass |this|. | ||
nsIScriptable | nsIScriptable compileFunction(in nsISupports glob, | ||
in PRUint32 langID, | in PRUint32 langID, | ||
in DOMString aCode, | in DOMString aCode, | ||
Line 142: | Line 142: | ||
// Execute arbitrary code. | // Execute arbitrary code. | ||
void | void execute(PRUint32 langID, in DOMString aCode); | ||
// Takes a script-type ID (which is presumably the ID for | // Takes a script-type ID (which is presumably the ID for | ||
Line 149: | Line 149: | ||
// executing language) and returns an nsIScriptable, which is | // executing language) and returns an nsIScriptable, which is | ||
// the namespace for the requested language. | // the namespace for the requested language. | ||
nsIScriptable | nsIScriptable getLanguageGlobal(in PRUint32 aRequestedLanguage, in nsISupports glob); | ||
}; | }; | ||
Line 157: | Line 157: | ||
var s = components.classes["@mozilla.org/scriptobjectfactory"].getService(); | var s = components.classes["@mozilla.org/scriptobjectfactory"].getService(); | ||
var func = s. | var func = s.compileFunction(this, lang_id, handler, "event"); | ||
// |func| is an nsIScriptable - call it. | // |func| is an nsIScriptable - call it. | ||
var returned = func(event) | var returned = func(event) |