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