Re: HTML_AJAX cookies

From: Date: Fri, 14 Oct 2005 16:25:47 +0000
Subject: Re: HTML_AJAX cookies
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21475@lists.php.net to get a copy of this message
Ken Restivo wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, Oct 13, 2005 at 04:14:46PM -0700, Joshua Eichorn wrote:
Ken Restivo wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm fixing to use HTML_AJAX to add a database-driven subclasses of QF heirselect. One thing that is perplexing me, is trying to get HTML_AJAX's javascript to use the cookie (and resulting SESSION vars and auth tokens) I've already established when loading the parent page. Any ideas? Cookies are one of those things I'd expect would "just work", but apparently some configuration is required. - -ken
     
Cookies have always just worked for me, what browser are you using. -josh
OK that was pilot error on my part: my app uses SID so that it works if cookies were off, so I didn't realise I'd blocked them in the profile I use for testing. Thanks for your help. Couple of other issues: 1) Looks like grab() uses GET method? If I grab('foo.php'), everything works fine. If I grab('foo.html'), I get: Error: [Exception... "'Error: HTTP Error Making Request: [405] Method Not Allowed' when calling method: [nsIOnReadystatechangeHandler::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no] I guess grab could be updated to use a GET method but the default is requestType is actually POST and it doesn't override that. That looks like a 405 error from your Apache server since its not allowing POST requests to an HTML page.
2) I'm pretty dependent on the JavaScript Shell 1.0 which is included in the Extension Developers extension. I use it from its own JavaScript Shell interface as well as from within emacs using js-mode.el. From the JavaScript Shell, the clearTarget(), replaceUrl(), and grab[A]Sync() functions from your proxyless test work perfectly. But if I try to run the callSync() or callAsync() functions, I get: Security Error: Content at http://www/coop-dev/tests/jsontest.php may not load or link to resource://gre/res/jsonservertest.php?c=test&m=echo_string. Any idea where the URL "resource://gre/res" came from? Your url got messed up, try using a full url when using grab. I've only had that problem when combining AJAX and flash-javascript integration, but im sure other things can get firefox into a confused state.
3) So I tried from inside Venkmann instead. Just as from within JavaScript Shell, clearTarget(), replaceUrl(), and grab[A]Sync() work great, but callSync() dies a different death: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.setRequestHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://www/coop-dev/tests/jsonservertest.php?client=HttpClient :: anonymous :: line 79" data: no] That line 79 in httpClient is inside makeRequest(), specifically: this.xmlhttp.setRequestHeader('Content-Type',this.request.getContentType()). So in Venkmann I'm not getting complaints about the security, but it is puking on setRequestHeader(). I'm not sure what the deal is here, the XMLHttpRquest docs don't document what its failure conditions are.
4) Yet another obstacle blocking my path, is that from within emacs I can inspect objects like document, etc. But I get "ReferenceError: HTML_AJAX is not defined" if I try to inspect HTML_AJAX. But if from within the JavaScript Shell, I evaluate "a=HTML_AJAX", then I can inspect that object from within emacs! It doesn't seem to be a reference copy, but rather a *new* HTML_AJAX instance, strangely enough. It looks to me like HTML_AJAX is a class and 'a' is an instance, even though both JavaScript Shell and Venkmann report them both as [object Object]. HTML_AJAX isn't a real javascript object is a hash of functions you can use statically. I'm not sure why emacs doesn't like that.
At this point it doesn't look like PEAR problems, but rather JavaScript issues, specifically interactions between HTML_AJAX and Venkmann and/or JavaScript Shell. If I should take this off-list please let me know, though other users of the package may run into these problems too. On list is fine with me, as long as no one on pear-general complains about the noise.
-josh
- -ken - -- - --------------- The world's most affordable web hosting. http://www.nearlyfreespeech.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFDT0LKe8HF+6xeOIcRAsVWAJ954vTFiMMy/V7PI1uR2v8PjmXldACeKQ2W YPH6CbnT9moHk9POz5PrBws= =PcsV -----END PGP SIGNATURE-----


« previous php.pear.general (#21475) next »