Comment 135 for bug 214366

Revision history for this message
In , Acelists (acelists) wrote :

Created attachment 8377817
patch v5

> > > >+ try {
> > > >+ root.copyFolderLocal(folderDeleted3, true, null, null);
> > > >+ do_throw("copyFolderLocal() should have failed here due to user prompt!");
> > > I'm not sure why you're trying to throw from inside this try block, but I
> > > don't know enough about writing tests to know whether there's a better way.
> > I expect .copyFolderLocal to throw and be catched by my catch. But if it
> > does not throw (wrong behaviour), the next throw is not catched and fails
> > the test.
> Sure, but my question is is it safe to put do_throw in a try block?
I use the same pattern in test_fileName.js. I don't know if it is safe enough. I now changed the catch a bit to only catch the specific exception. Is is safer now?

> > > >+ } catch (e) {
> > > >+ do_check_eq(e.result, parseInt("0x8055001a", 16));
> > > Why not just write 0x8055001a?
> > Because e.result returns the code in decimal. Is there other method of 'e' I
> > can use?
> nsIException.idl (if that's the right one) says that result is an unsigned
> long, not a decimal. So I don't see why you can't compare it to any other
> integer.
I knew octal literals are deprecated so somehow I extended that to hex too. Thanks.