Closed
Bug 1765727
Opened 2 years ago
Closed 2 years ago
Add comment explaining error.isWebDriverError() uses a name check and not `instanceof`
Categories
(Remote Protocol :: WebDriver BiDi, enhancement, P3)
Remote Protocol
WebDriver BiDi
Tracking
(firefox102 fixed)
RESOLVED
FIXED
102 Branch
Tracking | Status | |
---|---|---|
firefox102 | --- | fixed |
People
(Reporter: whimboo, Assigned: whimboo)
Details
Attachments
(1 file)
Currently isWebDriverError
uses just the name of the error to determine if it's a WebDriver error:
isWebDriverError(obj) {
return error.isError(obj) && "name" in obj && ERRORS.has(obj.name);
},
Instead we should use an instanceof
check to determine if the prototype chain of a given object contains the WebDriverError prototype.
Comment 1•2 years ago
|
||
Note that instanceof
could cause a problem if we are ever comparing objects that were created in different globals because they won't have the same prototype object.
Comment 2•2 years ago
|
||
As discussed, instanceof is usually dangerous (cross global / cross process etc...), let's just add a comment in the code.
Updated•2 years ago
|
Priority: -- → P3
Summary: error.isWebDriverError() should use `instanceof` to check for the prototype chain → Add comment explaining error.isWebDriverError() uses a name check and not `instanceof`
Assignee | ||
Comment 3•2 years ago
|
||
Updated•2 years ago
|
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fd9ec7652acf [remote] Add explanation comment to error.isWebDriverError() to explain why not using instanceof. r=webdriver-reviewers,jgraham DONTBUILD
Comment 5•2 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
status-firefox102:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•