« Return to Thread: Dwr in remote Xul web applications

Re: Dwr in remote Xul web applications

by Joe Walker-3 :: Rate this Message:

Reply to Author | View in Thread


Thanks for the submission.
I'm nervous about adding this to engine.js for 2 reasons:
- I want to keep it as small as possible - ideally much smaller than it is now.
- I'm concerned about the security implications of what you're doing. Is it safe to download remote scripts for execution in a chrome context?

Joe.

On Thu, Sep 11, 2008 at 11:48 AM, S.Pérès-Labourdette <sperlab@...> wrote:

I've just packaged a new release of my portal web app including latest 2.0.5
release of Dwr.
It just runs perfectly and very fast with jawr integration.

I would like to point out engine.js changes i've done to make dwr working
into a Mozilla remote Xul context so maybe someone could include it in
future releases, because i think this would be great.

The only 'blocking' issue i found is in the dwr.engine._getJSessionId member
which i rewrote like that

......
/** @private What is our session id? */
dwr.engine._getJSessionId =  function() {
       if (typeof document.cookie == 'undefined') { // not in a classic html
context so guessing xul
               netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
               var cookieManager =
Components.classes["@mozilla.org/cookiemanager;1"].getService(Components.interfaces.nsICookieManager2);
               var iter = cookieManager.enumerator;
               while (iter.hasMoreElements()) {
                       var cookie = iter.getNext();
                       if (cookie instanceof Components.interfaces.nsICookie) {
                               if (cookie.name == dwr.engine._sessionCookieName)
                                       return cookie.value;
                       }
               }
       }
       else {
               var cookies = document.cookie.split(';');
               for (var i = 0; i < cookies.length; i++) {
                       var cookie = cookies[i];
                       while (cookie.charAt(0) == ' ')
                               cookie = cookie.substring(1, cookie.length);
                       if (cookie.indexOf(dwr.engine._sessionCookieName + "=") == 0) {
                               return cookie.substring(dwr.engine._sessionCookieName.length + 1,
cookie.length);
                       }
               }
       }
       return "";
}
.........


Regards,
S.PERES-LABOURDETTE

--
View this message in context: http://www.nabble.com/Dwr-in-remote-Xul-web-applications-tp19432203p19432203.html
Sent from the DWR - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


 « Return to Thread: Dwr in remote Xul web applications