commit e6deac829c7394c21af0f0441b136fdc8904d416
parent 7acd6f6722e2e081bf469f60fbd45786cb054e64
Author: Simon Kornblith <simon@simonster.com>
Date: Sun, 2 Oct 2011 20:08:02 +0000
Disable cross-origin check for detection pending further investigation
Diffstat:
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/chrome/content/zotero/xpcom/utilities_translate.js b/chrome/content/zotero/xpcom/utilities_translate.js
@@ -417,17 +417,19 @@ Zotero.Utilities.Translate.prototype.doPost = function(url, body, onDone, header
* @private
*/
Zotero.Utilities.Translate.prototype._convertURL = function(url) {
- const hostPortRe = /^(?:(?:http|https|ftp):)\/\/([^\/]+)/i;
+ const hostPortRe = /^((?:http|https|ftp):)\/\/([^\/]+)/i;
// resolve local URL
var resolved = "";
// convert proxy to proper if applicable
- if(hostPortRe.test(url) && this._translate.translator && this._translate.translator[0]
- && this._translate.translator[0].properToProxy) {
- resolved = this._translate.translator[0].properToProxy(url);
- }
-
- if(Zotero.isFx) {
+ if(hostPortRe.test(url)) {
+ if(this._translate.translator && this._translate.translator[0]
+ && this._translate.translator[0].properToProxy) {
+ resolved = this._translate.translator[0].properToProxy(url);
+ } else {
+ resolved = url;
+ }
+ } else if(Zotero.isFx) {
resolved = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService).
newURI(this._translate.location, "", null).resolve(url);
@@ -439,18 +441,18 @@ Zotero.Utilities.Translate.prototype._convertURL = function(url) {
resolved = a.href;
}
- var m = hostPortRe.exec(resolved);
+ /*var m = hostPortRe.exec(resolved);
if(!m) {
throw new Error("Invalid URL supplied for HTTP request: "+url);
} else if(this._translate.document && this._translate.document.location) {
var loc = this._translate.document.location;
- if(this._translate._currentState !== "translate" && doc
- && (m[0].toLowerCase() !== loc.protocol.toLowerCase()
- || m[1].toLowerCase() !== loc.host.toLowerCase())) {
- throw new Error("Attempt to access "+m[0]+"//"+m[1]+" from "+loc.protocol+"//"+loc.host
+ if(this._translate._currentState !== "translate" && loc
+ && (m[1].toLowerCase() !== loc.protocol.toLowerCase()
+ || m[2].toLowerCase() !== loc.host.toLowerCase())) {
+ throw new Error("Attempt to access "+m[1]+"//"+m[2]+" from "+loc.protocol+"//"+loc.host
+" blocked: Cross-site requests are only allowed during translation");
}
- }
+ }*/
return resolved;
}