Keep uncertain accessibility sources out of Remote speech
This commit is contained in:
1 parent
c03ffa7409
commit
02fb70e81a
3 files changed
+40
-17
No files matched your search
@@ -33,24 +33,33 @@ func accessibility_speech_origin(source atspi.Snapshot) speechOrigin {
|
||||
return speechOriginSecret
|
||||
}
|
||||
}
|
||||
if !known_speech_source(source) {
|
||||
return speechOriginUnknown
|
||||
}
|
||||
for _, ancestor := range source.SpeechContext {
|
||||
if !known_speech_source(ancestor) {
|
||||
return speechOriginUnknown
|
||||
}
|
||||
}
|
||||
return speechOriginLocal
|
||||
}
|
||||
|
||||
func known_speech_source(source atspi.Snapshot) bool {
|
||||
return !source.Defunct && source.Role != "" && source.Role != "unknown" && source.Role != "invalid"
|
||||
}
|
||||
|
||||
// Document producers may remove the current object from their presentation
|
||||
// context. Inspect the original sources before that filtering, including every
|
||||
// content object in an assembled line. A mixed sensitive line stays private.
|
||||
func document_speech_origin(source atspi.Snapshot, ancestors []atspi.Snapshot) speechOrigin {
|
||||
if accessibility_speech_origin(source) == speechOriginSecret {
|
||||
return speechOriginSecret
|
||||
if origin := accessibility_speech_origin(source); origin != speechOriginLocal {
|
||||
return origin
|
||||
}
|
||||
for _, ancestor := range ancestors {
|
||||
if accessibility_speech_origin(ancestor) == speechOriginSecret {
|
||||
return speechOriginSecret
|
||||
if origin := accessibility_speech_origin(ancestor); origin != speechOriginLocal {
|
||||
return origin
|
||||
}
|
||||
}
|
||||
if source.Role == "" {
|
||||
return speechOriginUnknown
|
||||
}
|
||||
return speechOriginLocal
|
||||
}
|
||||
|
||||
@@ -90,14 +99,6 @@ func review_speech_origin(contexts ...[]atspi.Snapshot) speechOrigin {
|
||||
if origin := document_speech_origin(source, source.SpeechContext); origin != speechOriginLocal {
|
||||
return origin
|
||||
}
|
||||
if source.Defunct || source.Role == "unknown" || source.Role == "invalid" {
|
||||
return speechOriginUnknown
|
||||
}
|
||||
for _, ancestor := range source.SpeechContext {
|
||||
if ancestor.Role == "" || ancestor.Role == "unknown" || ancestor.Role == "invalid" || ancestor.Defunct {
|
||||
return speechOriginUnknown
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return speechOriginLocal
|
||||
|
||||
Reference in new issue
Block a user