From fcae86df04ab28f83b889ca873275f68551928df Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 9 Dec 2013 13:17:42 +0100 Subject: [PATCH] pz2.js: Allow overidding cookie do --- js/pz2.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/pz2.js b/js/pz2.js index becef33..a0afe3a 100644 --- a/js/pz2.js +++ b/js/pz2.js @@ -768,7 +768,7 @@ pz2.prototype = ** AJAX HELPER CLASS *********************************************************** ******************************************************************************** */ -var pzHttpRequest = function ( url, errorHandler ) { +var pzHttpRequest = function (url, errorHandler, cookieDomain) { this.maxUrlLength = 2048; this.request = null; this.url = url; @@ -777,6 +777,7 @@ var pzHttpRequest = function ( url, errorHandler ) { this.requestHeaders = {}; this.isXDomain = false; this.domainRegex = /https?:\/\/([^:/]+).*/; + this.cookieDomain = cookieDomain || null; var xhr = new XMLHttpRequest(); if ("withCredentials" in xhr) { @@ -843,6 +844,7 @@ pzHttpRequest.prototype = _getDomainFromUrl: function (url) { + if (this.cookieDomain) return this.cookieDomain; //explicit cookie domain var m = this.domainRegex.exec(url); return (m && m.length > 1) ? m[1] : null; }, @@ -854,6 +856,7 @@ pzHttpRequest.prototype = _isCrossDomain: function (domain) { + if (this.cookieDomain) return true; //assume xdomain is cookie domain set return !this._strEndsWith(domain, document.domain); }, -- 1.7.10.4