Closed Bug 897945 Opened 7 years ago Closed 6 years ago

Use an XPCOM string for nsContentUtils::ReportToConsole's category argument

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: Ms2ger, Assigned: Ms2ger)

References

Details

Attachments

(1 file)

Attached patch Patch v1Splinter Review
No description provided.
Attachment #780933 - Flags: review?(bobbyholley+bmo)
Comment on attachment 780933 [details] [diff] [review]
Patch v1

Review of attachment 780933 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/base/public/nsContentUtils.h
@@ +804,5 @@
>                                    const nsAFlatString& aSourceLine
>                                      = EmptyString(),
>                                    uint32_t aLineNumber = 0,
>                                    uint32_t aColumnNumber = 0);
> +  template<uint32_t N>

I don't understand. Why does this need to be templatized?
Attachment #780933 - Flags: review?(bobbyholley+bmo)
Comment on attachment 780933 [details] [diff] [review]
Patch v1

Review of attachment 780933 [details] [diff] [review]:
-----------------------------------------------------------------

The templates allow passing a literal string, which is fine, and I didn't really want to add NS_LITERAL_CSTRING to every call.
Attachment #780933 - Flags: review?(bobbyholley+bmo)
Why can't that overload take a const char* instead?
This bug was prompted by someone passing the result of ToNewUTF8String there, so that's exactly what I want to avoid here.
Comment on attachment 780933 [details] [diff] [review]
Patch v1

Review of attachment 780933 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/base/public/nsContentUtils.h
@@ +805,5 @@
>                                      = EmptyString(),
>                                    uint32_t aLineNumber = 0,
>                                    uint32_t aColumnNumber = 0);
> +  template<uint32_t N>
> +  static nsresult ReportToConsole(uint32_t aErrorFlags,

Please add a comment explaining the trick and why we need the overload.
Attachment #780933 - Flags: review?(bobbyholley+bmo) → review+
https://hg.mozilla.org/mozilla-central/rev/8a7a62729e5b
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Depends on: 900987
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.