hi, there

    I updated to the git's newest JSF code recently, there is 2 issuse:

1, APE_Cookie seted duplicate on every page with diffent path.
2, When use JSONP method, docoment.domain doesn't set, so, other sub domain
page (within the same top domain)
can't read the APE_Cookie, so, I need JSONP use APE.Config.domain to store
cookie to top domain.

I made the following changeset, please check it:

==========================================================
diff --git a/Clients/JavaScript.js b/Clients/JavaScript.js
index e80b94b..c070b7e 100755
--- a/Clients/JavaScript.js
+++ b/Clients/JavaScript.js
@@ -44,8 +44,9 @@ APE.Client.prototype.onError = function(type, fn,
internal) {

 APE.Client.prototype.cookie = {};

-APE.Client.prototype.cookie.write = function (name, value) {
-       document.cookie = name + "=" + encodeURIComponent(value) + ";
domain=" + document.domain;
+APE.Client.prototype.cookie.write = function (name, value, domain) {
+       if (domain == 'auto') domain = document.domain;
+       document.cookie = name + "=" + encodeURIComponent(value) + ";path=/
; domain=" + domain;
 }

 APE.Client.prototype.cookie.read = function (name) {
@@ -97,7 +98,7 @@ APE.Client.prototype.load = function(config){

        var reg = new RegExp('"frequency":([ 0-9]+)' , "g")
        cookie = cookie.replace(reg, '"frequency":' + config.frequency);
-       this.cookie.write('APE_Cookie', cookie);
+       this.cookie.write('APE_Cookie', cookie, config.domain);

        var iframe = document.createElement('iframe');
        iframe.setAttribute('id','ape_' + config.identifier);
diff --git a/Source/Core/Session.js b/Source/Core/Session.js
index c772c5e..ed38fe0 100755
--- a/Source/Core/Session.js
+++ b/Source/Core/Session.js
@@ -75,7 +75,11 @@ APE.Core = new Class({
         * @return      Boolean false if application identifier isn't found
or an object with the instance and the cookie
         */
        getInstance: function(identifier) {
-               var     tmp = Cookie.read('APE_Cookie', {'domain':
document.domain});
+               var domain = document.domain;
+               if (this.options.transport == 2) {
+                       domain = this.options.domain;
+               }
+               var     tmp = Cookie.read('APE_Cookie', {'domain': domain});
                identifier = identifier || this.options.identifier;
                if (!tmp) return false;
                tmp = JSON.parse(tmp);
@@ -156,7 +160,11 @@ APE.Core = new Class({

        saveCookie: function(){
                //Save cookie on the parent window (this is usefull with
JSONP as domain in the iframe is different than the domain
-               Cookie.write('APE_Cookie', JSON.stringify(this.cookie),
{'domain': document.domain});
+               var domain = document.domain;
+               if (this.options.transport == 2) {
+                       domain = this.options.domain;
+               }
+               Cookie.write('APE_Cookie', JSON.stringify(this.cookie),
{'domain': domain, 'path': '/'});
        },

        clearSession: function(){


==========================================================


Can also be found on http://pastebin.com/NBkcFbgK

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

To unsubscribe, reply using "remove me" as the subject.

Reply via email to