[orca] Filter out query strings from presentation of web content
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Filter out query strings from presentation of web content
- Date: Wed, 12 Jun 2019 21:24:52 +0000 (UTC)
commit e6ec039c953b5a414f1c38493c8b951715bef834
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Jun 12 17:21:27 2019 -0400
Filter out query strings from presentation of web content
Wikipedia references include accessible objects whose entire content
is a giant query string. While they claim no size, the giant query
string is exposed as an author-provided accessible name causing us to
ignore the lack of size.
src/orca/scripts/web/braille_generator.py | 3 +++
src/orca/scripts/web/script_utilities.py | 20 ++++++++++++++++++--
src/orca/scripts/web/speech_generator.py | 3 +++
3 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/scripts/web/braille_generator.py b/src/orca/scripts/web/braille_generator.py
index 51840782f..0c8c12461 100644
--- a/src/orca/scripts/web/braille_generator.py
+++ b/src/orca/scripts/web/braille_generator.py
@@ -142,6 +142,9 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
if self._script.utilities.preferDescriptionOverName(obj):
return [obj.description]
+ if not self._script.utilities.hasValidName(obj):
+ return []
+
return super()._generateName(obj, **args)
def _generateExpandedEOCs(self, obj, **args):
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index f551caffc..526250d9a 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -3250,6 +3250,21 @@ class Utilities(script_utilities.Utilities):
self._isUselessImage[hash(obj)] = rv
return rv
+ def hasValidName(self, obj):
+ if not obj.name:
+ return False
+
+ if len(obj.name.split()) > 1:
+ return True
+
+ parsed = urllib.parse.parse_qs(obj.name)
+ if len(parsed) > 2:
+ msg = "WEB: name of %s is suspected query string" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+
+ return True
+
def isUselessEmptyElement(self, obj):
if not (obj and self.inDocumentContent(obj)):
return False
@@ -3273,9 +3288,10 @@ class Utilities(script_utilities.Utilities):
rv = False
elif state.contains(pyatspi.STATE_EDITABLE):
rv = False
- elif obj.name or obj.description or obj.childCount:
+ elif self.hasValidName(obj) or obj.description or obj.childCount:
rv = False
- elif "Text" in interfaces and obj.queryText().characterCount:
+ elif "Text" in interfaces and obj.queryText().characterCount \
+ and obj.queryText().getText(0, -1) != obj.name:
rv = False
elif "Action" in interfaces and self._getActionNames(obj):
rv = False
diff --git a/src/orca/scripts/web/speech_generator.py b/src/orca/scripts/web/speech_generator.py
index 9d1050e24..33c8e2e42 100644
--- a/src/orca/scripts/web/speech_generator.py
+++ b/src/orca/scripts/web/speech_generator.py
@@ -176,6 +176,9 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
and not self._script.utilities.isDPub(obj):
return []
+ if not self._script.utilities.hasValidName(obj):
+ return []
+
if obj.parent and obj.name and obj.name == obj.parent.name \
and obj != orca_state.locusOfFocus:
return []
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]