Closed Bug 814723 Opened 12 years ago Closed 12 years ago

Warning about undefined preference 'browser.newtab.url'

Categories

(Firefox OS Graveyard :: Gaia, defect)

All
Gonk (Firefox OS)
defect
Not set
minor

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: tzimmermann, Assigned: tzimmermann)

Details

Attachments

(1 file, 3 obsolete files)

> I/Gecko   ( 1470): [Child 1470] WARNING: NS_ENSURE_SUCCESS(rv, true) failed with result 0x8000FFFF: file /home/tdz/Projects/mozilla/src/mozilla-inbound/bug-801658/docshell/base/nsDocShell.cpp, line 10323

When entering the home screen (e.g., when waking up from suspend), this warning appears because the preference 'browser.newtab.url' is missing.
Attachment #684713 - Flags: review?(justin.lebar+bug)
I don't think this is the right fix.

This pref starts with "browser." because it's a pref for the "browser", by which we mean the desktop browser, Firefox.  It's only read from files inside browser/ and in that one place in nsDocShell.  So I don't think it makes sense to define it for B2G.

I'd r+ a patch which changes the pref check from an NS_ENSURE_TRUE to an if (NS_FAILED(rv)), which would have the same effect.
Attachment #684713 - Flags: review?(justin.lebar+bug) → review-
Note that fixing this by modifying nsDocShell will also get rid of the warning on Fennec and other products.
Assignee: nobody → tzimmermann
This patch silences the warning by simply returning 'true' if the key is not present.
Attachment #684713 - Attachment is obsolete: true
Attachment #685234 - Flags: review?(justin.lebar+bug)
Comment on attachment 685234 [details] [diff] [review]
Return default value if key is missing

>+    rv = Preferences::GetDefaultCString("browser.newtab.url", &pref);
>+
>+    if (NS_FAILED(rv) && rv == NS_ERROR_UNEXPECTED) {
>+        // We assume 'true' if 'browser.newtab.url' is not
>+        // explicitly set, but don't warn about it.
>+        return true;
>+    }

It's sufficient to check |if (NS_FAILED(rv))| -- we avoid checking for specific
error codes in Gecko where we can help it.

Also, I'm not wild about this comment; instead of saying what we're doing, we
should explain /why/ we're doing it.  Maybe something like "Apps other than the
browser don't have the 'browser.newtab.url' pref set." would be sufficient.  Or
I'd be OK if you left off the comment altogether.

>+    NS_ENSURE_SUCCESS(rv, true);

If we get rid of the rv == NS_ERROR_UNEXPECTED check above, we don't need this check.

r=me with these nits picked.
Attachment #685234 - Flags: review?(justin.lebar+bug) → review+
An update according to the review.
Attachment #685234 - Attachment is obsolete: true
Attachment #685551 - Flags: review?(justin.lebar+bug)
(In reply to Thomas Zimmermann from comment #6)
> Created attachment 685551 [details] [diff] [review]
> Return default value if key is missing [v2]
> 
> An update according to the review.

Since you got r+ on the last patch, you don't need to ask for another review; you can go straight to checkin-needed.  Unless of course you want my input on the new patch, in which case you're welcome to ask for review.
The only thing you need here before going to checkin-needed is "r=jlebar" in the first line of the checkin message.

Although since you asked for review: I might remove the newline between the Preferences:: call and the if statement.  But that's up to you.  :)
Attachment #685551 - Flags: review?(justin.lebar+bug) → review+
Attachment #685551 - Attachment is obsolete: true
Attachment #685663 - Flags: review+
Thanks a lot!
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/3d5420af2c27
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Verified in Unagi version 20130102070202.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: