From 771cfc9ca6204c209dc50a30b57cc50360c50b45 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 15 Apr 2013 13:43:07 -0400 Subject: [PATCH] Make bookmarklet origin configurable for tests --- chrome/content/zotero/xpcom/server.js | 3 ++- chrome/content/zotero/xpcom/zotero.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/server.js b/chrome/content/zotero/xpcom/server.js index c16e3c018..5a84e6297 100755 --- a/chrome/content/zotero/xpcom/server.js +++ b/chrome/content/zotero/xpcom/server.js @@ -306,7 +306,8 @@ Zotero.Server.DataListener.prototype._generateResponse = function(status, conten if(!Zotero.isServer) { response += "X-Zotero-Version: "+Zotero.version+"\r\n"; response += "X-Zotero-Connector-API-Version: "+CONNECTOR_API_VERSION+"\r\n"; - if(this.origin === "https://www.zotero.org" || this.origin === "http://www.zotero.org") { + if(this.origin === ZOTERO_CONFIG.BOOKMARKLET_ORIGIN || + this.origin === ZOTERO_CONFIG.HTTP_BOOKMARKLET_ORIGIN) { response += "Access-Control-Allow-Origin: "+this.origin+"\r\n"; response += "Access-Control-Allow-Methods: POST, GET, OPTIONS\r\n"; response += "Access-Control-Allow-Headers: Content-Type,X-Zotero-Connector-API-Version,X-Zotero-Version\r\n"; diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 5bfe87605..2248ef4a9 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -35,6 +35,8 @@ const ZOTERO_CONFIG = { API_URL: 'https://api.zotero.org/', API_VERSION: 2, PREF_BRANCH: 'extensions.zotero.', + BOOKMARKLET_ORIGIN : 'https://www.zotero.org', + HTTP_BOOKMARKLET_ORIGIN : 'http://www.zotero.org', BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/', VERSION: "4.0.5.SOURCE" };