- Pass version to repo
- Handle translator deletion without logging errors - Tweak some flags on docShell
This commit is contained in:
parent
bbbc8991f2
commit
43f26d5b89
3 changed files with 18 additions and 9 deletions
|
@ -66,10 +66,12 @@ Zotero.Repo = new function() {
|
|||
}
|
||||
|
||||
// then try repo
|
||||
Zotero.HTTP.doGet(ZOTERO_CONFIG.REPOSITORY_URL+"/code/"+ZOTERO_CONFIG.REPOSITORY_CHANNEL+"/"+translatorID, function(xmlhttp) {
|
||||
Zotero.HTTP.doGet(ZOTERO_CONFIG.REPOSITORY_URL+"/code/"+translatorID+"?version="+Zotero.version,
|
||||
function(xmlhttp) {
|
||||
_haveCode(xmlhttp.status === 200 ? xmlhttp.responseText : false, translatorID,
|
||||
Zotero.Repo.SOURCE_REPO, callback);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -135,7 +137,7 @@ Zotero.Repo = new function() {
|
|||
* Retrieve metadata from repository
|
||||
*/
|
||||
function _updateFromRepo(reset, callback) {
|
||||
var url = ZOTERO_CONFIG.REPOSITORY_URL+"/metadata?last="+
|
||||
var url = ZOTERO_CONFIG.REPOSITORY_URL+"/metadata?version="+Zotero.version+"&last="+
|
||||
(reset ? "0" : Zotero.Prefs.get("connector.repo.lastCheck.repoTime"));
|
||||
|
||||
Zotero.HTTP.doGet(url, function(xmlhttp) {
|
||||
|
|
|
@ -243,7 +243,9 @@ Zotero.Translators = new function() {
|
|||
if(!newMetadata.length) return;
|
||||
|
||||
if(reset) {
|
||||
var serializedTranslators = newMetadata;
|
||||
var serializedTranslators = newMetadata.filter(function(translator) {
|
||||
return !translator.deleted;
|
||||
});
|
||||
} else {
|
||||
var serializedTranslators = [];
|
||||
var hasChanged = false;
|
||||
|
@ -252,7 +254,10 @@ Zotero.Translators = new function() {
|
|||
for(var i in newMetadata) {
|
||||
var newTranslator = newMetadata[i];
|
||||
|
||||
if(_translators.hasOwnProperty(newTranslator.translatorID)) {
|
||||
if(newTranslator.deleted) {
|
||||
// handle translator deletions
|
||||
delete _translators[newTranslator.translatorID];
|
||||
} else if(_translators.hasOwnProperty(newTranslator.translatorID)) {
|
||||
var oldTranslator = _translators[newTranslator.translatorID];
|
||||
|
||||
// check whether translator has changed
|
||||
|
@ -395,7 +400,7 @@ Zotero.Translator.prototype.init = function(info) {
|
|||
for(var i in TRANSLATOR_REQUIRED_PROPERTIES) {
|
||||
var property = TRANSLATOR_REQUIRED_PROPERTIES[i];
|
||||
if(info[property] === undefined) {
|
||||
this.logError('Missing property "'+property+'" in translator metadata JSON object in ' + info.label);
|
||||
Zotero.logError(new Error('Missing property "'+property+'" in translator metadata JSON object in ' + info.label));
|
||||
haveMetadata = false;
|
||||
break;
|
||||
} else {
|
||||
|
|
|
@ -29,7 +29,6 @@ const ZOTERO_CONFIG = {
|
|||
REPOSITORY_URL: 'https://repo.zotero.org/repo',
|
||||
REPOSITORY_CHECK_INTERVAL: 86400, // 24 hours
|
||||
REPOSITORY_RETRY_INTERVAL: 3600, // 1 hour
|
||||
REPOSITORY_CHANNEL: 'trunk',
|
||||
BASE_URI: 'http://zotero.org/',
|
||||
WWW_BASE_URL: 'http://www.zotero.org/',
|
||||
SYNC_URL: 'https://sync.zotero.org/',
|
||||
|
@ -2275,10 +2274,13 @@ Zotero.Browser = new function() {
|
|||
hiddenBrowser.setAttribute('disablehistory', 'true');
|
||||
win.document.documentElement.appendChild(hiddenBrowser);
|
||||
// Disable some features
|
||||
hiddenBrowser.docShell.allowAuth = false;
|
||||
hiddenBrowser.docShell.allowDNSPrefetch = false;
|
||||
hiddenBrowser.docShell.allowImages = false;
|
||||
hiddenBrowser.docShell.allowJavascript = false;
|
||||
hiddenBrowser.docShell.allowMetaRedirects = false;
|
||||
hiddenBrowser.docShell.allowPlugins = false;
|
||||
hiddenBrowser.docShell.canExecuteScripts = false;
|
||||
Zotero.debug("created hidden browser ("
|
||||
+ (win.document.getElementsByTagName('browser').length - 1) + ")");
|
||||
return hiddenBrowser;
|
||||
|
|
Loading…
Reference in a new issue