Closed
Bug 524995
Opened 14 years ago
Closed 14 years ago
Fix clearUserPref usage, back out no-throw change to prefbranch
Categories
(Core :: Preferences: Backend, defect, P1)
Core
Preferences: Backend
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
status1.9.2 | --- | beta1-fixed |
People
(Reporter: Gijs, Assigned: Gijs)
References
()
Details
(Keywords: regression)
Attachments
(7 files, 2 obsolete files)
2.03 KB,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
2.36 KB,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
16.35 KB,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
34.16 KB,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
1010 bytes,
patch
|
Gavin
:
review+
|
Details | Diff | Splinter Review |
1.14 KB,
patch
|
beltzner
:
review+
|
Details | Diff | Splinter Review |
51.79 KB,
patch
|
Details | Diff | Splinter Review |
For discussion, see: http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/c083cf990ff2f03f# We need to check all the callsites ( http://mxr.mozilla.org/mozilla-central/search?string=clearUserPref, and possibly other repos?), fix any that need fixing, and back out the original change.
Updated•14 years ago
|
Flags: blocking1.9.2?
Priority: -- → P1
Updated•14 years ago
|
Flags: blocking1.9.2? → blocking1.9.2+
Comment 2•14 years ago
|
||
Ok, bug 499733 definitely had issues with this as well. From a precursory glance at the tree, aside for bug 487059, it seems the only two files with a possible issue would be: 1) DownloadLastDir.jsm in toolkit/mozapps/downloads/src/ 2) openLocationLastURL.jsm in browser/base/content/ Cc'ing ehsan as he worked on both.
Depends on: 499733
Assignee | ||
Comment 3•14 years ago
|
||
This is a funny bunch. I'm assuming we don't want exceptions from "innocent" setters on these things, right? There's still the EM to do, and the revert of the original patch. That seems to be it, AFAICT...
Assignee | ||
Updated•14 years ago
|
Attachment #408917 -
Flags: review?(gavin.sharp)
Updated•14 years ago
|
Attachment #408917 -
Flags: review?(gavin.sharp) → review+
Assignee | ||
Comment 4•14 years ago
|
||
I think these are the callsites which we *do* need to change, and I think we can get away with leaving the other ones alone.
Attachment #408928 -
Flags: review?
Comment 5•14 years ago
|
||
I remember hitting a problem with this in a sessionstore test (for bug 490040) & needing to try/catch for 1.9.1 but not trunk at the time, so just make sure you run all those tests too.
Assignee | ||
Comment 6•14 years ago
|
||
-R version of the original patch against current tip (with some bitrot fixed)
Attachment #408934 -
Flags: review?(gavin.sharp)
Assignee | ||
Updated•14 years ago
|
Attachment #408928 -
Flags: review? → review?(gavin.sharp)
Assignee | ||
Comment 7•14 years ago
|
||
(In reply to comment #5) > I remember hitting a problem with this in a sessionstore test (for bug 490040) > & needing to try/catch for 1.9.1 but not trunk at the time, so just make sure > you run all those tests too. We're not doing anything to 1.9.1 at the moment, I don't think. I just sent all the attached patches to tryserver on 1.9.2, though, so if something breaks, I guess I'll see it... As for that particular test, it sets a pref, and resets it at the end. AIUI that ought to be fine, because there's a guarantee that the pref *will* have a "user" set value (unless the earlier pref call borked, but in that case you have bigger problems). Did I miss something?
Comment 8•14 years ago
|
||
Comment on attachment 408934 [details] [diff] [review] Revert patch of bug 487059 >diff --git a/netwerk/test/unit/test_bug396389.js b/netwerk/test/unit/test_bug396389.js > for each (var pref in prefData) { > try { > pref.oldVal = prefs.getBoolPref(pref.name); >+ pref.set = true; > } catch(e) { >+ pref.set = false; > } > prefs.setBoolPref(pref.name, pref.newVal); > } > for each (var pref in prefData) { >- prefs.clearUserPref(pref.name); >+ if (pref.set) { >+ prefs.setBoolPref(pref.name, pref.oldVal); >+ } else { >+ prefs.clearUserPref(pref.name); >+ } > } > } This change, and the other few like it, seems unnecessary to revert (if the test is currently fine with just clearing the pref value, that should be sufficient even if we throw-on-nonexistence.) We can make that change only on the trunk, or in a followup, though, if you want to keep this a straight backout for simplicity's sake.
Attachment #408934 -
Flags: review?(gavin.sharp) → review+
Updated•14 years ago
|
Attachment #408928 -
Flags: review?(gavin.sharp) → review+
Comment 9•14 years ago
|
||
(In reply to comment #7) > As for that particular test, it sets a pref, and resets it at the end. AIUI > that ought to be fine, because there's a guarantee that the pref *will* have a > "user" set value (unless the earlier pref call borked, but in that case you > have bigger problems). Did I miss something? You're missing that clearUserPref used to throw if the set value happens to equal the default value.
Assignee | ||
Comment 10•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/d0b7ef28c23a for the EM and other callsite patch. I'll attach an updated revert patch, but per Dao's comment, we do need the try catch around those calls -- and in fact, there's probably other tests in the tree which will need it, based on that.
Comment 11•14 years ago
|
||
(In reply to comment #7) > We're not doing anything to 1.9.1 at the moment, I don't think. I just sent all > the attached patches to tryserver on 1.9.2, though, so if something breaks, I > guess I'll see it... Right. The test had counted on not throwing, so I had to backport to 1.9.1 and try/catch there. > Did I miss something? What Dao said.
Assignee | ||
Comment 12•14 years ago
|
||
(In reply to comment #8) > This change, and the other few like it, seems unnecessary to revert (if the > test is currently fine with just clearing the pref value, that should be > sufficient even if we throw-on-nonexistence.) We can make that change only on > the trunk, or in a followup, though, if you want to keep this a straight > backout for simplicity's sake. I've added a prefHasUserValue call in two of them to make sure that if they're set to user values, they don't throw. The third case sets the update URL to a test value, which I'm sure can't be the same as the default, so I think that's fine like this.
Attachment #408934 -
Attachment is obsolete: true
Assignee | ||
Comment 13•14 years ago
|
||
Egh, correct patch this time.
Attachment #408953 -
Attachment is obsolete: true
Attachment #408955 -
Flags: review?(gavin.sharp)
Updated•14 years ago
|
Attachment #408955 -
Flags: review?(gavin.sharp) → review+
Assignee | ||
Comment 14•14 years ago
|
||
There is one case visible in the patch, and one case in toolkit/crashreporter/test/browser/browser_aboutCrashesResubmit.js that I didn't wrap up, because I could not imagine the default pref and the value it's set to by the test ever possibly being the same. :-)
Attachment #408993 -
Flags: review?(gavin.sharp)
Assignee | ||
Comment 15•14 years ago
|
||
Attachment #408994 -
Flags: review?(gavin.sharp)
Comment 16•14 years ago
|
||
Comment on attachment 408993 [details] [diff] [review] Patch tests that have added clearUserPref since the change >diff --git a/content/events/test/test_bug226361.xhtml b/content/events/test/test_bug226361.xhtml > function setOrRestoreTabFocus(newValue) { >- if (!newValue) { >+ if (!newValue && prefs.prefHasUserValue("tabfocus")) { > prefs.clearUserPref("tabfocus"); > } else { > prefs.setIntPref("tabfocus", newValue); This is a behavior change (will setIntPref("tabfocus", null) if !newValue && !prefs.prefHasUserValue, which I don't think is desired given the function name). You should just put the prefHasUserValue check inside the if(). >diff --git a/content/xul/content/test/test_bug486990.xul b/content/xul/content/test/test_bug486990.xul > try { >- if (allow) { >+ if (allow && prefs.prefHasUserValue("enabled")) { > prefs.clearUserPref("enabled"); > } else { > prefs.setBoolPref("enabled", allow); > } ditto r=me with those changed.
Attachment #408993 -
Flags: review?(gavin.sharp) → review+
Updated•14 years ago
|
Attachment #408994 -
Flags: review?(gavin.sharp) → review+
Assignee | ||
Comment 17•14 years ago
|
||
Per http://tinderbox.mozilla.org/showlog.cgi?log=MozillaTry/1256806880.1256820612.23642.gz&fulltext=1 , we need this checked too. :-(
Assignee | ||
Updated•14 years ago
|
Attachment #409072 -
Flags: review?
Assignee | ||
Updated•14 years ago
|
Attachment #408928 -
Attachment description: Patch for EM → Patch for EM [checked in: trunk]
Assignee | ||
Comment 18•14 years ago
|
||
Comment on attachment 408917 [details] [diff] [review] Patch 1: DownloadLastDir.jsm, gOpenLocationLastURL.jsm, private browsing test [checked in: trunk] [checked in: trunk]
Assignee | ||
Updated•14 years ago
|
Attachment #408917 -
Attachment description: Patch 1: DownloadLastDir.jsm, gOpenLocationLastURL.jsm, private browsing test → Patch 1: DownloadLastDir.jsm, gOpenLocationLastURL.jsm, private browsing test [checked in: trunk]
Comment 19•14 years ago
|
||
Comment on attachment 409072 [details] [diff] [review] Still further EM fixes r=beltzner, this is very straightforward
Attachment #409072 -
Flags: review? → review+
Assignee | ||
Comment 20•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/9e89c0d4e570 for the last 4 patches.
Assignee | ||
Comment 21•14 years ago
|
||
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/b015a068cf8b
Assignee | ||
Updated•14 years ago
|
status1.9.2:
--- → beta1-fixed
Comment 22•14 years ago
|
||
All tests went green on mozilla-1.9.2, please land this on relbranch
Assignee | ||
Comment 23•14 years ago
|
||
(In reply to comment #22) > All tests went green on mozilla-1.9.2, please land this on relbranch Shawn landed http://hg.mozilla.org/releases/mozilla-1.9.2/rev/3b49c063bb42 . I changed these devmo pages: https://developer.mozilla.org/index.php?title=en/nsIPrefBranch&action=diff&revision=27&diff=29 https://developer.mozilla.org/index.php?title=en/Code_snippets/Preferences&action=diff&revision=53&diff=54 I think that's it for this bug... If I missed something, please feel free to reopen.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Comment 24•14 years ago
|
||
Gijs, could you suggest places to poke around in test this fix? Preferences and migration have been mentioned. Any other?
Assignee | ||
Comment 25•14 years ago
|
||
(In reply to comment #24) > Gijs, could you suggest places to poke around in test this fix? Preferences and > migration have been mentioned. Any other? When I checked what code added a clearUserPref call between this stuff no longer throwing, and going back to throwing (just now :-)), everything I found was in tests, with the only exception being the add-on manager, so that'd be my final suggestion... gOpenLocationLastURL technically changed, but the only callsite for that method (reset()) is in a test, according to MXR.
Updated•14 years ago
|
status1.9.2:
beta1-fixed → ---
Comment 26•14 years ago
|
||
On relbranch: http://hg.mozilla.org/releases/mozilla-1.9.2/rev/3b49c063bb42
status1.9.2:
--- → beta1-fixed
Comment 27•14 years ago
|
||
I don't see what needs changing in the docs here. Isn't this fix simply reverting to the same behavior that's already documented?
Comment 28•14 years ago
|
||
(In reply to comment #16) > (From update of attachment 408993 [details] [diff] [review]) > >diff --git a/content/events/test/test_bug226361.xhtml b/content/events/test/test_bug226361.xhtml > >diff --git a/content/xul/content/test/test_bug486990.xul b/content/xul/content/test/test_bug486990.xul > r=me with those changed. Looks like neither of these were actually fixed?
Assignee | ||
Comment 29•14 years ago
|
||
(In reply to comment #28) > (In reply to comment #16) > > (From update of attachment 408993 [details] [diff] [review] [details]) > > >diff --git a/content/events/test/test_bug226361.xhtml b/content/events/test/test_bug226361.xhtml > > > >diff --git a/content/xul/content/test/test_bug486990.xul b/content/xul/content/test/test_bug486990.xul > > > r=me with those changed. > > Looks like neither of these were actually fixed? Ugh. Really sorry - I remember making this change, but I must have committed an outdated version of the patch. I'll check the fix into trunk when it's green, and I guess we want this on branch too, but not on relbranch? I should note this isn't breaking right now only because all the callers of those functions pass false or 0 explicitly, and so setBool/IntPref get called with those, which also works. (In reply to comment #27) > I don't see what needs changing in the docs here. Isn't this fix simply > reverting to the same behavior that's already documented? Yes. If that behaviour is documented enough (2 MDC pages and the interface file right now, AFAICT), then IMHO nothing else is needed.
Assignee | ||
Comment 30•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/c2f0df485f9d for those tests.
Updated•14 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Comment 31•14 years ago
|
||
http://hg.mozilla.org/releases/mozilla-1.9.2/rev/444be380ca8b for branch.
You need to log in
before you can comment on or make changes to this bug.
Description
•