fix getTranslatorObject(), and throw an error if cross-site getTranslatorObject() is attempted
This commit is contained in:
parent
253e439a0c
commit
ee101b5bc0
1 changed files with 6 additions and 2 deletions
|
@ -264,12 +264,16 @@ Zotero.Translate.Sandbox = {
|
||||||
return translation.translate(false);
|
return translation.translate(false);
|
||||||
};
|
};
|
||||||
safeTranslator.getTranslatorObject = function() {
|
safeTranslator.getTranslatorObject = function() {
|
||||||
translation._loadTranslator();
|
translation._loadTranslator(translation.translator[0]);
|
||||||
|
if(translate._sandboxLocation != translation._sandboxLocation) {
|
||||||
|
throw "Translate: getTranslatorObject() may not be called from web or search "+
|
||||||
|
"translators to web or search translators with different URIs.";
|
||||||
|
}
|
||||||
translation._prepareTranslation();
|
translation._prepareTranslation();
|
||||||
setDefaultHandlers(translate, translation);
|
setDefaultHandlers(translate, translation);
|
||||||
|
|
||||||
// return sandbox
|
// return sandbox
|
||||||
return translation.sandboxManager.sandbox;
|
return translation._sandboxManager.sandbox;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO security is not super-tight here, as someone could pass something into arg
|
// TODO security is not super-tight here, as someone could pass something into arg
|
||||||
|
|
Loading…
Add table
Reference in a new issue