Closed Bug 923591 Opened 11 years ago Closed 11 years ago

checkLoadURIStrWithPrincipal() should not warn when returning NS_ERROR_DOM_BAD_URI - WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x805303F4: file dev/caps/src/nsScriptSecurityManager.cpp, line 1563

Categories

(Core :: Security: CAPS, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: karlt, Assigned: karlt)

References

Details

Attachments

(1 file)

NS_ERROR_DOM_BAD_URI is an expected result of checkLoadURIStrWithPrincipal().
The purpose of the method is to determine whether aPrincipal can load uri.  It
indicates the result by returning NS_OK or NS_ERROR_DOM_BAD_URI, and so should
not warn when returning these values.  checkLoadURIWithPrincipal() usually correctly doesn't warn when returning this expected result:

http://hg.mozilla.org/mozilla-central/annotate/51b36c5fd45f/caps/src/nsScriptSecurityManager.cpp#l1325

http://hg.mozilla.org/mozilla-central/annotate/51b36c5fd45f/caps/src/nsScriptSecurityManager.cpp#l1339
http://mxr.mozilla.org/mozilla-central/source/caps/src/nsNullPrincipal.cpp#258

http://hg.mozilla.org/mozilla-central/annotate/51b36c5fd45f/caps/src/nsScriptSecurityManager.cpp#l1373

http://hg.mozilla.org/mozilla-central/annotate/51b36c5fd45f/caps/src/nsScriptSecurityManager.cpp#l1394
http://hg.mozilla.org/mozilla-central/annotate/51b36c5fd45f/caps/src/nsScriptSecurityManager.cpp#l1241

http://hg.mozilla.org/mozilla-central/annotate/51b36c5fd45f/caps/src/nsScriptSecurityManager.cpp#l1435

http://hg.mozilla.org/mozilla-central/annotate/51b36c5fd45f/caps/src/nsScriptSecurityManager.cpp#l1473

If the caller thinks that NS_ERROR_DOM_BAD_URI is not expected, then it can
warn, but there is already the consoleservice log if DONT_REPORT_ERRORS is not
set, or in one rare case already a warning from checkLoadURIWithPrincipal():

http://hg.mozilla.org/mozilla-central/annotate/51b36c5fd45f/caps/src/nsScriptSecurityManager.cpp#l1272

The client code triggering 50 warnings in this case is
http://mxr.mozilla.org/mozilla-central/source/toolkit/modules/NewTabUtils.jsm#735
but that is not the bug.
Attached patch patchSplinter Review
I've kept NS_ENSURE_SUCCESS for those that like the way it reports that the
nsresult code isn't changing as the call stack unwinds.
Attachment #813677 - Flags: review?(bzbarsky)
Comment on attachment 813677 [details] [diff] [review]
patch

Please add a comment inside that if, both places, explaining why we have that separate codepath.  Thank you for fixing this!

r=me
Attachment #813677 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/mozilla-central/rev/020593d16a93
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: