Closed Bug 2016741 Opened 9 months ago Closed 8 months ago

getShadowRoot command returns user agent shadow roots

Categories

(Remote Protocol :: Marionette, defect, P2)

defect
Points:
2

Tracking

(firefox150 fixed)

RESOLVED FIXED
150 Branch
Tracking Status
firefox150 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

(Blocks 1 open bug)

Details

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

Attachments

(1 external file, 1 obsolete file)

The WebDriver classic https://www.w3.org/TR/webdriver2/#get-element-shadow-root get element shadow root method relies on https://searchfox.org/firefox-main/rev/d5fa7178279c137900f4d0c46793e5ec1df3fb1b/remote/shared/DOM.sys.mjs#1081-1087

dom.getShadowRoot = function (el) {
  const shadowRoot = el.openOrClosedShadowRoot;
  if (!shadowRoot) {
    throw new lazy.error.NoSuchShadowRootError();
  }
  return shadowRoot;
};

This helper doesn't check if the shadow root is a UA shadowroot or not, so it will leak UA shadowroots, eg when called on a <select> element.

Type: task → defect
See Also: → 2016673
Severity: -- → S3
Points: --- → 2
Priority: -- → P2
Whiteboard: [webdriver:m19]

FYI on bug 2016673 a check for shadowRoot.isUAWidget() was added which can be done here as well.

I was writing a test for this, but weirdly enough, Chrome also returns a shadow root eg for a "select".
With BiDi they don't seem to return shadow roots for select elements, so not sure what's different here, but I think we should at least check on the spec side.

Might just do a PR on wpt to discuss that.

(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] (away from Feb 12th - Feb 22nd) from comment #1)

FYI on bug 2016673 a check for shadowRoot.isUAWidget() was added which can be done here as well.

Yes it's in see also already, that's what prompted to file this bug.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

Also created a PR at https://github.com/web-platform-tests/wpt/pull/57823
to discuss with the group.

Should land either the PR or this patch.

Blocks: 2017251
Attachment #9545621 - Attachment is obsolete: true
Pushed by jdescottes@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/bcf5ff66d425 https://hg.mozilla.org/integration/autoland/rev/3d126afd82d2 [marionette] dom.getShadowRoot should not return User Agent shadow roots r=whimboo
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch
See Also: → 2017222
Whiteboard: [webdriver:m19] → [webdriver:m19][webdriver-relnote]
Whiteboard: [webdriver:m19][webdriver-relnote] → [webdriver:m19][webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: