Closed
Bug 1237546
Opened 10 years ago
Closed 9 years ago
SapiService::Speak should encode to entities
Categories
(Core :: Web Speech, defect)
Tracking
()
RESOLVED
FIXED
mozilla49
People
(Reporter: m_kato, Assigned: m_kato)
References
Details
Attachments
(1 file, 1 obsolete file)
1.64 KB,
patch
|
eeejay
:
review+
|
Details | Diff | Splinter Review |
To support pitch controll, we use XML for Speak parameter on SAPI backend. We should encode some character to entity
Assignee | ||
Comment 1•10 years ago
|
||
Assignee | ||
Comment 2•10 years ago
|
||
Comment on attachment 8705049 [details] [diff] [review]
Convert character to entity for SapiService::Speak
When using speechSynthesis.speak(new SpeechSynthesisUtterance("&") on SAPI backend, browser speaks as '&' only. It should be "&', 'a', 'm', 'p' and ';'.
Our SAPI implementation use XML to support pitch value. So some characters should be converted to entity.
Attachment #8705049 -
Flags: review?(eitan)
Comment 3•10 years ago
|
||
Two questions before I review:
1. Don't we have an actual library for escaping XML? Seems like a very common and security sensitive thing to do.
2. Do Mac/Linux need followup patches as well? I think we may need to escape or sanitize SSML.
Updated•10 years ago
|
Flags: needinfo?(m_kato)
Assignee | ||
Comment 4•10 years ago
|
||
(In reply to Eitan Isaacson [:eeejay] from comment #3)
> Two questions before I review:
> 1. Don't we have an actual library for escaping XML? Seems like a very
> common and security sensitive thing to do.
ContentUtils has internal method into StringBuilder, but it doesn't export to others and requires nsINode and nsTextFragment. If we should add this to ContentUtils, I will add it.
> 2. Do Mac/Linux need followup patches as well? I think we may need to escape
> or sanitize SSML.
OSX API doesn't recognize SSML.
speechd can use SSML mode, but to use SSML, we need call spd_set_data_mode(handle, SPD_DATA_SSML).
Flags: needinfo?(m_kato)
Comment 5•10 years ago
|
||
(In reply to Makoto Kato [:m_kato] from comment #4)
> (In reply to Eitan Isaacson [:eeejay] from comment #3)
> > Two questions before I review:
> > 1. Don't we have an actual library for escaping XML? Seems like a very
> > common and security sensitive thing to do.
>
> ContentUtils has internal method into StringBuilder, but it doesn't export
> to others and requires nsINode and nsTextFragment. If we should add this to
> ContentUtils, I will add it.
>
I'm not sure. Let's see what smaug thinks.
Flags: needinfo?(bugs)
Comment 6•10 years ago
|
||
Whatever StringBuilder does is very innerHTML specific and super performance hot code.
But, perhaps you could factor some of EncodeTextFragment to a macro which is then called twice in that method and used also for a method needed in this bug.
Or even better would be to not use macro, but some template method which should get inlined.
something like
void templace<T>EncodeText(const T aChar, nsAString& aOut)
{
switch (aChar) {
case '<':
aOut.AppendLiteral("<");
break;
case '>':
aOut.AppendLiteral(">");
break;
case '&':
aOut.AppendLiteral("&");
break;
case 0x00A0:
aOut.AppendLiteral(" ");
break;
default:
aOut.Append(aChar);
break;
}
}
Flags: needinfo?(bugs)
Comment 7•10 years ago
|
||
Comment on attachment 8705049 [details] [diff] [review]
Convert character to entity for SapiService::Speak
Review of attachment 8705049 [details] [diff] [review]:
-----------------------------------------------------------------
This is good for now. We may need to figure out a way to share this across services or escape strings before they reach the service.
Attachment #8705049 -
Flags: review?(eitan) → review+
Updated•9 years ago
|
Keywords: checkin-needed
Updated•9 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 8•9 years ago
|
||
mach try -b do -p win32,win64 -u all -t none
Assignee | ||
Comment 9•9 years ago
|
||
Comment 10•9 years ago
|
||
Do you plan to land this?
This might be last minute, but what do you think of using nsEscapeHTML2?
https://dxr.mozilla.org/mozilla-central/source/xpcom/io/nsEscape.h#56
Flags: needinfo?(m_kato)
Assignee | ||
Comment 11•9 years ago
|
||
Attachment #8705049 -
Attachment is obsolete: true
Flags: needinfo?(m_kato)
Attachment #8747648 -
Flags: review?(eitan)
Updated•9 years ago
|
Attachment #8747648 -
Flags: review?(eitan) → review+
Updated•9 years ago
|
Keywords: checkin-needed
Comment 12•9 years ago
|
||
Keywords: checkin-needed
Comment 13•9 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in
before you can comment on or make changes to this bug.
Description
•