Improve stability and error handling for _selection_location_helper()
Categories
(Core :: Layout, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox86 | --- | fixed |
People
(Reporter: TYLin, Assigned: TYLin)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file)
By searching test_accessiblecaret_
on bugzilla, we have a lot of intermittent bugs of KeyError: '0'
or KeyError: '-1'
for various testcase on AccessibleCaret. Most of them are on macOS.
One of the failure log looks like
Marionette DEBUG 21 -> [0,25,"WebDriver:ExecuteScript",{"script":"var sel = arguments[0].editor.selection;return sel.rangeCount;","newSandbox":true, ... 6-4254-9346-b55e-6588df576563"}],"filename":"tests/layout/base/tests/marionette/selection.py","sandbox":"system","line":178}]
Marionette DEBUG 21 <- [1,25,null,{"value":1}]
Marionette DEBUG 21 -> [0,26,"WebDriver:GetElementTagName",{"id":"e49c6566-4254-9346-b55e-6588df576563"}]
Marionette DEBUG 21 <- [1,26,null,{"value":"input"}]
Marionette DEBUG 21 -> [0,27,"WebDriver:ExecuteScript",{"script":"var sel = arguments[0].editor.selection;return sel.getRangeAt(0).getClientRects(); ... 6-4254-9346-b55e-6588df576563"}],"filename":"tests/layout/base/tests/marionette/selection.py","sandbox":"system","line":171}]
Marionette DEBUG 21 <- [1,27,null,{"value":{"item":{},"length":0}}]
Marionette DEBUG 21 -> [0,28,"WebDriver:GetElementTagName",{"id":"e49c6566-4254-9346-b55e-6588df576563"}]
Marionette DEBUG 21 <- [1,28,null,{"value":"input"}]
Marionette DEBUG 21 -> [0,29,"WebDriver:ExecuteScript",{"script":"var sel = arguments[0].editor.selection;return sel.getRangeAt(0).getClientRects(); ... 6-4254-9346-b55e-6588df576563"}],"filename":"tests/layout/base/tests/marionette/selection.py","sandbox":"system","line":171}]
Marionette DEBUG 21 <- [1,29,null,{"value":{"0":{"x":12,"y":22,"width":0,"height":14,"top":22,"right":12,"bottom":36,"left":12},"item":{},"length":1}}]
https://treeherder.mozilla.org/logviewer?job_id=323204001&repo=autoland&lineNumber=53626-53635
This should be the log of executing
range_count = self.range_count()
first_rect_list = self.selection_rect_list(0)
last_rect_list = self.selection_rect_list(range_count - 1)
The first getClientRects()
(via self.selection_rect_list()
) doesn't returns a rect, but the second one does. Some of the intermittent logs show the opposite.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 1•4 years ago
|
||
This patch doesn't change the behavior, but should improve the stability
and error handling of _selection_location_helper().
Throw exceptions if we don't see any range in Selection or we cannot get
any rects out of the first range, making the error message clearer.
Comment 3•4 years ago
|
||
bugherder |
Description
•