Closed Bug 1858977 Opened 2 years ago Closed 2 years ago

Access of window.screen in a detached contentWindow causes NS_ERROR_UNEXPECTED

Categories

(Core :: DOM: CSS Object Model, defect)

Firefox 118
defect

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: awathefox, Assigned: emilio)

References

Details

Attachments

(2 files)

Steps to reproduce:

  1. var elem = document.createElement('iframe')
  2. document.body.appendChild(elem)
  3. var win = elem.contentWindow
  4. document.body.removeChild(elem)
  5. win.screen
  6. This happens

Actual results:

Uncaught NS_ERROR_UNEXPECTED exception with no further information.

Expected results:

An Screen object with all values equal to default value (0, false, etc.) (Edge, Chromium, Android System Webview)

The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
OS: Unspecified → All
Hardware: Unspecified → All

https://drafts.csswg.org/cssom-view/#dom-window-screen says "The screen attribute must return the Screen object associated with the Window object" . Maybe it requires a bit clarity on the expected behavior when the screen isn't associated with a Window object?

Component: DOM: Core & HTML → DOM: CSS Object Model

The severity field is not set for this bug.
:jfkthame, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jfkthame)
Assignee: nobody → emilio
Flags: needinfo?(jfkthame)

The screen lifetime seems like it was a lot more complicated
in the past (looking at the comments in Window.webidl).

But nowadays it seems it can be more similar to the other
objects like VisualViewport etc.

mozLockOrientation etc haven't done anything for a while.

Depends on D193212

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bf2dfd2da634 Don't throw on screen getters. r=smaug,webidl https://hg.mozilla.org/integration/autoland/rev/9565b6ba1cc8 Remove dead code to lock orientation on video controls. r=smaug,webidl,reusable-components-reviewers,mconley,hjones
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/43076 for changes under testing/web-platform/tests
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
Upstream PR merged by moz-wptsync-bot
Duplicate of this bug: 1742750
See Also: → 1325110
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: