Closed Bug 1302582 Opened 8 years ago Closed 8 years ago

Add explicit JS_ReportError*ASCII variants

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox51 --- wontfix
firefox52 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Added ASCII variants.
they forward to UTF8 variants.

the forwarding part is simple, but the validation part is somewhat tricky,
as we have multiple parameters, and some of them may be non-string for JS_ReportErrorASCII and JS_ReportWarningASCII cases.

maybe we'd better adding actual ASCII variants, that asserts after formatting in ReportErrorVA or ExpandErrorArgumentsVA.
how do you think?
Attachment #8791018 - Flags: review?(jwalden+bmo)
(In reply to Tooru Fujisawa [:arai] from comment #1)
> maybe we'd better adding actual ASCII variants, that asserts after
> formatting in ReportErrorVA or ExpandErrorArgumentsVA.

Hmm, it does seem like it'd be worth pushing the asserting into the when-splatting-each-argument code.  Having an extra allocation/possibility to OOM in order to format the entire string, to verify this, is unideal.  I don't believe *technically* there's any reason the formatter callback can't be impure -- and this would add a reason, and IMO not really a super-great one.

So I guess this really wants a JS::detail::Report8Bit(cx, ..., enum { ArgumentsAreASCII, ArgumentsAreUTF8 }) that both would call, I think.  Shouldn't quite be forwarding from the ASCII function to the UTF-8 one, as I was initially thinking.
Attachment #8791018 - Flags: review?(jwalden+bmo)
Thanks :)
Changed it to just a copy of other variants, with ASCII, and added assertion.
Assignee: nobody → arai.unmht
Attachment #8791018 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8793057 - Flags: review?(jwalden+bmo)
Comment on attachment 8793057 [details] [diff] [review]
Add JS_ReportError*ASCII variants.

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

::: js/src/jscntxt.cpp
@@ +317,5 @@
>      return false;
>  }
>  
> +#ifdef DEBUG
> +static inline void

We probably don't want inline, if all callers ever die.
Attachment #8793057 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/mozilla-central/rev/d028babfbb85
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Mark 51 as won't fix. If it's worth uplifting to 51, feel free to nominate it.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: