Skip to content

Handle Firefox annotation with unknown role, simplify datastructures#14526

Merged
seanbudd merged 6 commits into
masterfrom
fixupAnnotationTyping
Jan 13, 2023
Merged

Handle Firefox annotation with unknown role, simplify datastructures#14526
seanbudd merged 6 commits into
masterfrom
fixupAnnotationTyping

Conversation

@seanbudd

@seanbudd seanbudd commented Jan 10, 2023

Copy link
Copy Markdown
Member

Link to issue number:

Follow up of #14507, #14480

Summary of the issue:

Firefox incorrectly throws an error when browsing annotated content with an unsupported role.
Instead an unknown role should be reported: i.e. "has details".

The typing for annotation data structures were incorrect.

Description of user facing changes

When browsing content in Firefox with an annotation with unsupported role, "has details" is reported instead of throwing an error.

Description of development approach

Update typing to be more accurate for annotation data structures, log and return None in the Firefox case to match Chromium behaviour.
Use Tuples rather than generators for annotations.targets and annotations.roles.
Drops the superfluous/unused annotations.summaries

Testing strategy:

Known issues with pull request:

Change log entries:

N/A unreleased bug

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • Security precautions taken.

@seanbudd seanbudd requested a review from a team as a code owner January 10, 2023 00:06
@seanbudd

Copy link
Copy Markdown
Member Author

cc @nvdaes, who reported this privately

@seanbudd seanbudd added this to the 2023.1 milestone Jan 10, 2023

@michaelDCurran michaelDCurran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the raise to return None looks good.
But I notice that you have changed typing of all the properties from iterator to Generator. This may more correctly reflect the truth, but it does then raise (most likely an existing issue) that returning generators from cachable properties may be problematic. If the property is called once then a new generator is fetched, and code may iterate over some or all of it. But if the property is again fetched within the same core cycle, that same generator will be returned, which has already be partially or fully exhausted. these properties really should only return lists or tuples...

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit cea73e5296

@seanbudd

seanbudd commented Jan 10, 2023

Copy link
Copy Markdown
Member Author

This may more correctly reflect the truth, but it does then raise (most likely an existing issue) that returning generators from cachable properties may be problematic.

The code which handles all these properties ensures to consider this by turning them into tuples where appropriate.
I don't believe any of these generators are cached properties, only the reference to the parent object i.e. AnnotationOrigin is cached.
I think the main concern is one of performance, it might be slower to generate the summary of all the annotation targets at once, as opposed to doing it on the fly.

@seanbudd seanbudd self-assigned this Jan 10, 2023
@seanbudd seanbudd changed the title Handle Firefox annotation with unknown role, fix typing Handle Firefox annotation with unknown role, simplify datastructures Jan 10, 2023
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 4dbd937f36

@seanbudd seanbudd merged commit 83c5e8c into master Jan 13, 2023
@seanbudd seanbudd deleted the fixupAnnotationTyping branch January 13, 2023 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants