>+ bool containsChild = true;
>+ uint32_t i;
>+ for (i = 1; ; i++) {
>+ newFolderName.Assign(folderName);
>+ if (i > 1) {
>+ // This could be localizable but Toolkit is fine without it, see
>+ // mozilla/toolkit/content/contentAreaUtils.js::uniqueFile()
>+ newFolderName.Append('(');
>+ newFolderName.AppendInt(i);
>+ newFolderName.Append(')');
>+ }
>+ rv = ContainsChildNamed(newFolderName, &containsChild);
>+ if (NS_WARN_IF(NS_FAILED(rv))) {
>+ return rv;
>+ }
>+ if (!containsChild)
>+ break;
>+ }
Did you mean for (i = 1; containsChild; i++) ? Note that if you do this then i ends the loop being at least 2, so you'd need to change the subsequent check. Alternatively, you would have to rewrite the loop something like this (sorry if this is what the code did in one of the earlier patches):
uint32_t i = 1;
newFolderName.Assign(folderName);
for (;;) {
bool containsChild;
rv = ContainsChildNamed(newFolderName, &containsChild);
NS_ENSURE_SUCCESS(rv, rv);
if (!containsChild)
break;
>+ 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.
>+ } catch (e) {
>+ do_check_eq(e.result, parseInt("0x8055001a", 16));
Why not just write 0x8055001a?
>+confirmDuplicateFolderRename=A folder with that name already exists under folder '%1$S'. Would you like to copy the folder under a new name of '%2$S'?
A subfolder with that name already exists in the folder '%1$S'. Would you like to move the folder using the new name of '%2$S'?
Comment on attachment 8374439
WIP patch 4
>+ bool containsChild = true; Assign( folderName) ; toolkit/ content/ contentAreaUtil s.js::uniqueFil e() Append( '('); AppendInt( i); Append( ')'); med(newFolderNa me, &containsChild); IF(NS_FAILED( rv))) {
>+ uint32_t i;
>+ for (i = 1; ; i++) {
>+ newFolderName.
>+ if (i > 1) {
>+ // This could be localizable but Toolkit is fine without it, see
>+ // mozilla/
>+ newFolderName.
>+ newFolderName.
>+ newFolderName.
>+ }
>+ rv = ContainsChildNa
>+ if (NS_WARN_
>+ return rv;
>+ }
>+ if (!containsChild)
>+ break;
>+ }
Did you mean for (i = 1; containsChild; i++) ? Note that if you do this then i ends the loop being at least 2, so you'd need to change the subsequent check. Alternatively, you would have to rewrite the loop something like this (sorry if this is what the code did in one of the earlier patches):
uint32_t i = 1; Assign( folderName) ; med(newFolderNa me, &containsChild); SUCCESS( rv, rv);
newFolderName.
for (;;) {
bool containsChild;
rv = ContainsChildNa
NS_ENSURE_
if (!containsChild)
break;
i++; .Assign( folderName) ; .Append( '('); .AppendInt( i); .Append( ')');
newFolderName
newFolderName
newFolderName
newFolderName
}
>+ try { Local(folderDel eted3, true, null, null); "copyFolderLoca l() should have failed here due to user prompt!");
>+ root.copyFolder
>+ do_throw(
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.
>+ } catch (e) { eq(e.result, parseInt( "0x8055001a" , 16));
>+ do_check_
Why not just write 0x8055001a?
>+confirmDuplic ateFolderRename =A folder with that name already exists under folder '%1$S'. Would you like to copy the folder under a new name of '%2$S'?
A subfolder with that name already exists in the folder '%1$S'. Would you like to move the folder using the new name of '%2$S'?