W3C home > Mailing lists > Public > public-webapi@w3.org > August 2007

Re: [XHR] how to catch SECURITY_ERR on XMLHttpRequest.open()?

From: Dan Connolly <connolly@w3.org>
Date: Fri, 31 Aug 2007 08:55:08 -0500
To: Anne van Kesteren <annevk@opera.com>
Cc: Alexey Proskuryakov <ap-carbon@rambler.ru>, public-webapi@w3.org
Message-Id: <1188568508.29837.1805.camel@pav>

On Mon, 2007-08-20 at 17:16 +0200, Anne van Kesteren wrote:
> On Wed, 15 Aug 2007 10:01:12 +0200, Alexey Proskuryakov  
> <ap-carbon@rambler.ru> wrote:
> >> I'd like an example of how to catch this exception.
> >
> >   FWIW, WebKit trunk doesn't raise this exception yet, opting for a
> > temporary XMLHttpRequestException code. My feeling is that  
> > interoperability in this area will take a while to achieve.
> 
> I think there's general agreement that it should take ExceptionCode 18 on  
> DOMException. You should be able to catch it as follows, fwiw:
> 
>    try {
>      ...
>    } catch(e) {
>      switch(e.code) {
>        case e.SECURITY_ERR:
>        ...
>      }
>    }
> 
> if I haven't mixed up the syntax of the switch case construct in some way.

One way to be pretty sure you got all the details right is to make
a test case out of this sketch.

Is there an XHR test suite yet?

-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
Received on Friday, 31 August 2007 13:55:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:58 GMT