Thanks for the quick response. I used to see the timeout behavior, i
wanted to report that, strangely it was no longer happening, instead i
get the status as 0.

I just ran the above script from a background page in Chrome version
4.0.223.11, Please find the output below:

sending test request
hello inside onreadystatechange
hello  onreadystatechange:0
hello onerror:0

Luckily now I am getting the timeout behavior as well with an HTTPS
url from the background page.
r.open("POST", "https://api.del.icio.us/v1/posts/update";, true); //
Note that it is HTTPS now

--
Sibil Mohammed

On Nov 6, 7:12 am, Aaron Boodman <a...@chromium.org> wrote:
> Hello Sibil, thanks for reporting this.
>
> I investigated it and I think I see a problem, but it isn't what you describe.
>
> When I try this script from an extension page running in a tab, I get
> an auth dialog. If I cancel the dialog, the script does indeed see
> that the response status is 401.
>
> If I run the script in a background page, the request just times out.
> No response ever comes back.
>
> I can see why this is happening in Chromium. Can you confirm this is
> what you're seeing, though?
>
> - a
>
> On Thu, Nov 5, 2009 at 3:04 AM, Sibil <sibilsa...@gmail.com> wrote:
>
> > When the server responds with 401, onerror and onreadystatechange
> > returns r.status as 0. It works fine when the server responds with
> > 200. How can i detect 401?
>
> > var r = new XMLHttpRequest();
> > r.open("POST", "http://api.del.icio.us/v1/posts/update";, true); //
> > expects HTTP-Auth which is not provided.
> > //r.open("POST", "http://google.com";, true); //This works fine.
> > r.onreadystatechange = function() {
> >  console.log("hello inside onreadystatechange");
> >  if (r.readyState == 4) {
> >  console.log("hello  onreadystatechange:" + r.status);
> >  }
> > };
> > r.onload = function(e) {
> >  console.log("hello onload");
> > };
> > r.onerror = function(e) {
> >  console.log("hello onerror:" + r.status);
> > };
> > console.log("sending test request");
> > r.send("");
>
> > --
> > Sibil Mohammed
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensions@googlegroups.com
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to