Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2016-03-16 05:10:11 +0300
committermattab <matthieu.aubry@gmail.com>2016-03-30 06:11:40 +0300
commit3ff659d4281637bb752800d32f18cdd0050590b2 (patch)
tree682f028eebadb05c3eee2ed20a0aeb90093fb817 /js
parent25b2da923b2dbe999e4b716a37cfa4f804fa1770 (diff)
piwik.js: remove the feature of `setDomains` magically setting the cookie path.
Instead, we will better document how to correctly set the cookie configuration. https://github.com/piwik/piwik/issues/9932
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js68
1 files changed, 0 insertions, 68 deletions
diff --git a/js/piwik.js b/js/piwik.js
index cd00196bd2..83fcc3d6de 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -4946,60 +4946,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)
*/
@@ -5578,11 +5524,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) {
@@ -5593,15 +5534,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;
- }
}
}