diff options
author | Matthieu Aubry <matt@piwik.org> | 2016-03-30 06:12:12 +0300 |
---|---|---|
committer | Matthieu Aubry <matt@piwik.org> | 2016-03-30 06:12:12 +0300 |
commit | 7a894b766390595b19746776ed97931c64a96fe5 (patch) | |
tree | f7c0010e96d178fd8dbeb6bf013234cec1c331bf /js | |
parent | 045ca764dad3d7e52587815b495674617a2d3bd4 (diff) | |
parent | 3ff659d4281637bb752800d32f18cdd0050590b2 (diff) |
Merge pull request #9933 from piwik/remove_magic_setCookiePath
piwik.js: remove the feature of `setDomains` that sets cookie path
Diffstat (limited to 'js')
-rw-r--r-- | js/piwik.js | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/js/piwik.js b/js/piwik.js index c5597236c5..3021ee0e40 100644 --- a/js/piwik.js +++ b/js/piwik.js @@ -4948,60 +4948,6 @@ if (typeof window.Piwik !== 'object') { }); } - /** - * Note: While we check whether the user is on a configHostAlias path we do not check whether the user is - * actually on the configHostAlias domain. This is already done where this method is called and for - * simplicity we do not check this again. - * - * Also we currently assume that all configHostAlias domains start with the same wild card of '*.', '.' or - * none. Eg either all like '*.piwik.org' or '.piwik.org' or 'piwik.org'. Piwik always adds '*.' so it - * should be fine. - */ - function findConfigCookiePathToUse(configHostAlias, currentUrl) - { - var aliasPath = getPathName(configHostAlias); - var currentPath = getPathName(currentUrl); - - if (!aliasPath || aliasPath === '/' || !currentPath || currentPath === '/') { - // no path set that would be useful for cookiePath - return; - } - - var aliasDomain = domainFixup(configHostAlias); - - if (isSiteHostPath(aliasDomain, '/')) { - // there is another configHostsAlias having same domain that allows all paths - // eg this alias is for piwik.org/support but there is another alias allowing - // piwik.org - return; - } - - if (stringEndsWith(aliasPath, '/')) { - aliasPath = removeCharactersFromEndOfString(aliasPath, 1); - } - - // eg if we're in the case of "apache.piwik/foo/bar" we check whether there is maybe - // also a config alias allowing "apache.piwik/foo". In this case we're not allowed to set - // the cookie for "/foo/bar" but "/foo" - var pathAliasParts = aliasPath.split('/'); - var i; - for (i = 2; i < pathAliasParts.length; i++) { - var lessRestrctivePath = pathAliasParts.slice(0, i).join('/'); - if (isSiteHostPath(aliasDomain, lessRestrctivePath)) { - aliasPath = lessRestrctivePath; - break; - } - } - - if (!isSitePath(currentPath, aliasPath)) { - // current path of current URL does not match the alias - // eg user is on piwik.org/demo but configHostAlias is for piwik.org/support - return; - } - - return aliasPath; - } - /* * Browser features (plugins, resolution, cookies) */ @@ -5580,11 +5526,6 @@ if (typeof window.Piwik !== 'object') { * case all links that don't go to '*.piwik.org/subsite1/ *' would be treated as outlinks. * For example a link to 'piwik.org/' or 'piwik.org/subsite2' both would be treated as outlinks. * - * We might automatically set a cookieConfigPath to avoid creating several cookies under one domain - * if there is a hostAlias defined with a path. Say a user is visiting 'http://piwik.org/subsite1' - * and '.piwik.org/subsite1' is set as a hostsAlias. Piwik will automatically use '/subsite1' as - * cookieConfigPath. - * * @param string|array hostsAlias */ setDomains: function (hostsAlias) { @@ -5595,15 +5536,6 @@ if (typeof window.Piwik !== 'object') { if (Object.prototype.hasOwnProperty.call(configHostsAlias, i) && isSameHost(domainAlias, domainFixup(String(configHostsAlias[i])))) { hasDomainAliasAlready = true; - - if (!configCookiePath) { - var path = findConfigCookiePathToUse(configHostsAlias[i], locationHrefAlias); - if (path) { - this.setCookiePath(path); - } - - break; - } } } |