Closed Bug 1619112 Opened 5 years ago Closed 5 years ago

Convert ThrowTypeError/ThrowRangeError to the new JS_ReportErrorNumberUTF8Array API

Categories

(Core :: DOM: Bindings (WebIDL), task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(6 files)

Once bug 1619087 lands we can use that API and store nsCString instead of nsString in the typeerror/rangeerror cases in ErrorResult. Then we can easily remove the u"" bits at callsites, just using "" string literals. We'll need to do some cleanup to deal with the actual nsAStrings that are being passed in. Worst case, we can implement dom::StringArrayAppender::Append for nsAString to do a conversion to UTF-8 (which the JS engine is doing anyway right now, by the way, when we throw the exception) and then find callsites and change them if possible one by one....

Depends on: 1619087

CStringArrayAppender is just a copy of StringArrayAppender with the incoming
types expanded to accept both wide and narrow strings. Later patches will
remove the wide-string variants incrementally.

Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED

Callers should pass in UTF-8, since that's what the JS engine ends up with in the end anyway.

The various URL changes are because NS_NewURI converts incoming nsAString to
UTF-8 anyway. So we might as well do that up-front and then use the UTF-8
string for both the NS_NewURI call and the error-reporting if it fails.

Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d0caab4d75ad
part 1.  Change the internal storage for ErrorResult errors-with-messages to UTF8 strings. r=smaug
https://hg.mozilla.org/integration/autoland/rev/5006a4d63a02
part 2.  Pass char literals instead of char16_t literals into ErrorResult throwing methods. r=smaug
https://hg.mozilla.org/integration/autoland/rev/572c7a308bdb
part 3. Pass UTF8 strings to MaybeRejectWithType/RangeError promise methods. r=smaug
https://hg.mozilla.org/integration/autoland/rev/b534dbd8363d
part 4.  Remove some unnecessary string conversions in EME code. r=bryce
https://hg.mozilla.org/integration/autoland/rev/6c096ce0e3e6
part 5.  Stop accepting nsAString in ErrorResult error-throwing. r=smaug
https://hg.mozilla.org/integration/autoland/rev/29ad47d40718
part 6.  Remove duplicated string array appender bits. r=smaug
Regressions: 1628359
Regressions: 1629390
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: