Closed Bug 335692 Opened 18 years ago Closed 18 years ago

Remove nsIPref from profile/pref-migrator

Categories

(Core Graveyard :: Profile: Migration, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: alfred.peng, Assigned: alfred.peng)

References

Details

Attachments

(1 file, 3 obsolete files)

Replace nsIPref with nsIPrefBranch and nsIPrefService.
Attached patch Patch v1 (obsolete) — Splinter Review
Some questions for the patch:

1. For the method GetComplexValue, nsIFileSpec has been marked as a deprecated argument. Do we need to remove it from nsPrefMigration::GetPremigratedFilePref?

2. nsIPref has a method named EnumerateChildren. I replace it with GetChildList in my patch. Don't know whether it's appropriate.
Assignee: nobody → alfred.peng
Status: NEW → ASSIGNED
Attachment #220018 - Flags: review?(bzbarsky)
I'm not a great reviewer for this patch.  I don't know much about this code, so it would take me a while to get to it.  You might want to try someone who's reviewed nsIPref/nsIPrefBranch stuff before.

> Do we need to remove it from nsPrefMigration::GetPremigratedFilePref?

I doubt it...
Attachment #220018 - Flags: review?(roc)
Comment on attachment 220018 [details] [diff] [review]
Patch v1

caillon, roc, I checked on bugzilla and found out that  you've helped review nsIPref/nsIPrefBranch related bugs. Hope you can help me review this one.
Attachment #220018 - Flags: superreview?(roc)
Attachment #220018 - Flags: review?(roc)
Attachment #220018 - Flags: review?(caillon)
Attachment #220018 - Flags: review?(bzbarsky)
Sorry about the delay Alfred. This patch needs to be updated to trunk. I promise I'll review it quickly next time.
Attached patch Patch v2 (obsolete) — Splinter Review
Update the patch based on the change of the trunk.

roc, it's fine. Anyway, thanks for your review :-)
Attachment #220018 - Attachment is obsolete: true
Attachment #224857 - Flags: review?(roc)
Attachment #220018 - Flags: superreview?(roc)
Attachment #220018 - Flags: review?(caillon)
You need to call NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY after each successful GetChildList. Also, the GetChildList parameters should have a '.' after the preference so you don't match things like "intl.fontstuff".
Attached patch Patch v3 (obsolete) — Splinter Review
Update the patch based on roc's comment.

Two problems:
1. There are three chunk of similar code in the patch. Do I need to make a helper function to handle them?
2. I check the definition of nsPref::EnumerateChildren. It also calls GetChildList to get the array. If we add "." after the preferences, the meaning of the function will be changed I think.
Attachment #224857 - Attachment is obsolete: true
Attachment #224985 - Flags: review?(roc)
Attachment #224857 - Flags: review?(roc)
(In reply to comment #7)
> Two problems:
> 1. There are three chunk of similar code in the patch. Do I need to make a
> helper function to handle them?

No, I'll let that go :-)

> 2. I check the definition of nsPref::EnumerateChildren. It also calls
> GetChildList to get the array. If we add "." after the preferences, the
> meaning of the function will be changed I think.

True. The old code was buggy. I think this is the right thing to do.

+  if (prefs->GetChildList("intl.font.", &count, &childArray)) {

You should be calling NS_SUCCEEDED here, not just testing the result.

Almost done now :-)
Attached patch Patch v4Splinter Review
Updated patch.
Attachment #224985 - Attachment is obsolete: true
Attachment #225256 - Flags: review?(roc)
Attachment #224985 - Flags: review?(roc)
Checking in nsPrefMigration.cpp;
/cvsroot/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp,v  <--  nsPrefMigration.cpp
new revision: 1.206; previous revision: 1.205
done
Checking in nsPrefMigration.h;
/cvsroot/mozilla/profile/pref-migrator/src/nsPrefMigration.h,v  <--  nsPrefMigration.h
new revision: 1.54; previous revision: 1.53
done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
This broke the Windows SeaMonkey build (which uses the old-style for loop scoping rules):
http://tinderbox.mozilla.org/showbuilds.cgi?tree=SeaMonkey
Has been fixed by timeless. Thanks.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: