Closed Bug 376460 Opened 15 years ago Closed 5 years ago

WARNING: NS_ENSURE_TRUE(aRequestingContext) failed: file .../mailnews/base/src/nsMsgContentPolicy.cpp, line xxx

Categories

(MailNews Core :: Backend, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1341060

People

(Reporter: standard8, Assigned: sgautherie)

References

()

Details

Attachments

(1 file)

Seen on current SeaMonkey trunk builds - both xpfe and toolkit:

WARNING: NS_ENSURE_TRUE(aRequestingContext) failed: file /mozilla/master/mozilla/mailnews/base/src/nsMsgContentPolicy.cpp, line 532
WARNING: NS_ENSURE_TRUE(NS_SUCCEEDED(rv)) failed: file /mozilla/master/mozilla/mailnews/base/src/nsMsgContentPolicy.cpp, line 236

Always seen on startup and at other times throughout the app. In suiterunner I see this when using the migration wizard (which isn't fully in yet).

The GetRootDocShellForContext call:

http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/mailnews/base/src/nsMsgContentPolicy.cpp&rev=1.41&mark=235#212

fails because aRequestingContext is null. The documentation for ShouldLoad says this is valid, in this case I think it is style sheets that are causing the null content (aContentType = 4). I believe we still go on to check for style sheets in other ShouldLoad functions.

This seems to have been caused by bug 330443.
Looks like attachment 260063 [details] [diff] [review] on bug 374577 may fix this assertion, adding dep.
Depends on: 374577
<http://tinderbox.mozilla.org/showlog.cgi?log=SeaMonkey/1217484420.1217485284.24505.gz>
{{
Linux nye Depend bloat on 2008/07/30 23:07:00

WARNING: NS_ENSURE_TRUE(aRequestingContext) failed: file /home/andrew/tbox/SeaMonkey-Debug/Linux_2.6.22.14-72.fc6_Depend/src/mailnews/base/src/nsMsgContentPolicy.cpp, line 547
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004003: file /home/andrew/tbox/SeaMonkey-Debug/Linux_2.6.22.14-72.fc6_Depend/src/mailnews/base/src/nsMsgContentPolicy.cpp, line 240
}}
Summary: WARNING: NS_ENSURE_TRUE(aRequestingContext) failed: file /mozilla/master/mozilla/mailnews/base/src/nsMsgContentPolicy.cpp, line 532 → WARNING: NS_ENSURE_TRUE(aRequestingContext) failed: file /mozilla/master/mozilla/mailnews/base/src/nsMsgContentPolicy.cpp, line 547
Keywords: assertion
http://tinderbox.mozilla.org/showlog.cgi?log=SeaMonkey/1234974060.1234974745.11301.gz&fulltext=1
Linux nye Depend bloat on 2009/02/18 08:21:00

Bug 374577 did not help:
line numbers have changed, but bug is still there.
Blocks: 330443
No longer depends on: 374577
Flags: wanted-seamonkey2?
Keywords: assertion
Summary: WARNING: NS_ENSURE_TRUE(aRequestingContext) failed: file /mozilla/master/mozilla/mailnews/base/src/nsMsgContentPolicy.cpp, line 547 → WARNING: NS_ENSURE_TRUE(aRequestingContext) failed: file .../mailnews/base/src/nsMsgContentPolicy.cpp, line 633
Assignee: general → nobody
Nice to have, but not a priority.
Flags: wanted-seamonkey2? → wanted-seamonkey2-
Assignee: nobody → sgautherie.bz
Severity: normal → minor
Status: NEW → ASSIGNED
Component: General → Backend
Flags: in-testsuite-
Product: SeaMonkey → MailNews Core
QA Contact: general → backend
Summary: WARNING: NS_ENSURE_TRUE(aRequestingContext) failed: file .../mailnews/base/src/nsMsgContentPolicy.cpp, line 633 → WARNING: NS_ENSURE_TRUE(aRequestingContext) failed: file .../mailnews/base/src/nsMsgContentPolicy.cpp, line xxx
TB gets a bug 333267 -like check,
the other apps get a DisableJSOnMailNewsUrlDocshells() -like check,
so they continue to return error or ok respectively:
this just avoid the warnings.
Attachment #439730 - Flags: superreview?(bugzilla)
Attachment #439730 - Flags: review?(bugzilla)
Comment on attachment 439730 [details] [diff] [review]
(Av1) Check aRequestingContext before calling GetRootDocShellForContext(), A few cleanups

>+  // Thunderbird will get this later.
> #ifndef MOZ_THUNDERBIRD
>+  // If there's no docshell to get to, then it can't be mailnews,
>+  // so we're already safe and don't need to disable anything.
>+  if (!aRequestingContext)
>+    return NS_OK;

I believe that comment isn't true. For instance I know that RSS feeds can load without docshells in the background - and that's within the mailnews code.

> #ifdef MOZ_THUNDERBIRD
>+  // NOTE: Not using NS_ENSURE_ARG_POINTER because this is a legitimate case
>+  // that can happen, and it shouldn't print a warning message.
>+  if (!aRequestingContext)
>+    return NS_ERROR_INVALID_POINTER;
>+

The comment and the return result differ, and it differs from the SeaMonkey version. The default here is to reject the request rather than allowing it - which needs explaining in itself.

This patch may be the right thing to do, but it concerns me that there is no analysis as to why this is the right thing to do - especially as this is security related.

For me to accept a patch like this I would need:

- an outline of the cases where the requesting context can be null (and why)
- confirmation that the security policy isn't checking, or required to check for any of the cases.

I'd also want agreement from bz and Neil that this is the right thing to do.
Attachment #439730 - Flags: superreview?(bugzilla)
Attachment #439730 - Flags: superreview-
Attachment #439730 - Flags: review?(bugzilla)
> - an outline of the cases where the requesting context can be null (and why)
> - confirmation that the security policy isn't checking, or required to check
> for any of the cases.
> 
> I'd also want agreement from bz and Neil that this is the right thing to do.
I haven't done an exhaustive scan but so far the only case I've found is for the creation of the hidden window.
This hasn't gone anywhere, I'll look into it in bug 1341060.
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1341060
You need to log in before you can comment on or make changes to this bug.