Closed Bug 2032387 Opened 1 month ago Closed 1 month ago

Don't use properties but the prototype chain for the "isWebDriverError()"

Categories

(Remote Protocol :: Agent, defect, P3)

defect
Points:
2

Tracking

(firefox151 fixed)

RESOLVED FIXED
151 Branch
Tracking Status
firefox151 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

Details

(Whiteboard: [webdriver:m20][webdriver:relnote])

Attachments

(1 file)

Recently while working on bug 2031596 I noticed that a platform bug caused an error to be thrown which had the same name (UnknownError) as one of our known WebDriver Errors. As such the check that we run before serializing an error via isWebDriverError() returned true and caused the toJSON() method to be called which only exists for WebDriver errors:

https://searchfox.org/firefox-main/rev/662d18616bbb2da4c5a8758da50fc9d591d18c19/remote/shared/webdriver/Errors.sys.mjs#120-125

Given that this could be always the case when a fake object has similar properties and values we should not rely on them but find a better way to identify errors that are based on the WebDriver error type. Given that we cannot use instanceof we could use the actual prototype chain to check for a base WebDriverError entry. For the case above it works just fine.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Severity: -- → S3
Points: --- → 2
Priority: -- → P3
Whiteboard: [webdriver:m20]
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch
Whiteboard: [webdriver:m20] → [webdriver:m20][webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: