Closed Bug 1995314 Opened 1 year ago Closed 1 year ago

Page Extractor Does Not Correctly Filter Hidden Nodes

Categories

(Core :: Machine Learning: On Device, defect)

defect

Tracking

()

RESOLVED FIXED
146 Branch
Tracking Status
firefox146 --- fixed

People

(Reporter: nordzilla, Assigned: nordzilla)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 external files)

Attached file test-page.html —

Description

I have noticed, when using the page extractor for Translations language identification, that there are cases where invisible page content is extracted when it otherwise should not be.


Steps to Reproduce

  1. Open the test page attached to this bug.

  2. Open the Browser Console.

  3. Run the following JS code:

await gBrowser.selectedBrowser.browsingContext.currentWindowGlobal.getActor("PageExtractor").getText();

Expected Results

The extracted text matches only the visible text on the test page.

Actual Results

The extracted text contains text within the HTML that is not visible on the page.

This patch updates the page extraction algorithm to consider whether
all encountered nodes are hidden, rather tha only HTML elements.

This improves the overall extraction algorithm, ensuring that only
page text that is truly visible to the user is extracted.

This improves the page extraction algorithm to consider nodes
with a zero-sized bounding client rect to be hidden on the page.

Attachment #9521102 - Attachment description: WIP: Bug 1995314 - Ensure hidden text nodes are ignored during extraction r=gregtatum! → Bug 1995314 - Ensure hidden text nodes are ignored during extraction r=gregtatum!
Attachment #9521103 - Attachment description: WIP: Bug 1995314 - Handle zero-sized bounding client rect r=gregtatum! → Bug 1995314 - Handle zero-sized bounding client rect r=gregtatum!
Attachment #9521103 - Attachment description: Bug 1995314 - Handle zero-sized bounding client rect r=gregtatum! → Bug 1995314 - Handle zero-sized bounding client rect during extraction r=gregtatum!
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 146 Branch
Component: Machine Learning: General → Machine Learning: On Device
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: