Convert ThrowTypeError/ThrowRangeError to the new JS_ReportErrorNumberUTF8Array API
Categories
(Core :: DOM: Bindings (WebIDL), task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox75 | --- | fixed |
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(6 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
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....
Assignee | ||
Comment 1•5 years ago
|
||
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.
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
Assignee | ||
Comment 4•5 years ago
|
||
Assignee | ||
Comment 5•5 years ago
|
||
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.
Assignee | ||
Comment 6•5 years ago
|
||
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
Comment 8•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d0caab4d75ad
https://hg.mozilla.org/mozilla-central/rev/5006a4d63a02
https://hg.mozilla.org/mozilla-central/rev/572c7a308bdb
https://hg.mozilla.org/mozilla-central/rev/b534dbd8363d
https://hg.mozilla.org/mozilla-central/rev/6c096ce0e3e6
https://hg.mozilla.org/mozilla-central/rev/29ad47d40718
Description
•