Closed Bug 1970598 Opened 5 months ago Closed 3 months ago

Frequent error "WeakMap key undefined must be an object" in WindowManager

Categories

(Remote Protocol :: WebDriver BiDi, defect, P3)

defect
Points:
1

Tracking

(firefox144 fixed)

RESOLVED FIXED
144 Branch
Tracking Status
firefox144 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

Details

(Whiteboard: [webdriver:m17][lang=js])

Attachments

(1 file)

When navigating to eg cnn.com, STDOUT is full of errors such as console.error: (new TypeError("WeakMap key undefined must be an object", "chrome://remote/content/shared/WindowManager.sys.mjs", 189))

TypeError: WeakMap key undefined must be an object
    getIdForWindow chrome://remote/content/shared/WindowManager.sys.mjs:189
    #onContextAttached chrome://remote/content/shared/WindowManager.sys.mjs:521
    emit resource://gre/modules/EventEmitter.sys.mjs:156
    observe chrome://remote/content/shared/listeners/BrowsingContextListener.sys.mjs:74
EventEmitter.sys.mjs:158:19

We should nullcheck window at https://searchfox.org/mozilla-central/rev/bd57b566959758d0455c6e37afca00648c8e4ff0/remote/shared/WindowManager.sys.mjs#517-522

#onContextAttached = (_, data = {}) => {
  const { browsingContext } = data;

  const window = this.#getBrowsingContextWindow(browsingContext);
  this.#clientWindowIds.set(browsingContext, this.getIdForWindow(window));
};

This probably happens for shortlived iframes?

Mentor: jdescottes
Priority: -- → P3
Whiteboard: [webdriver:backlog][lang=js]

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

For more information, please visit BugBot documentation.

Flags: needinfo?(hskupin)

This really results in a lot of log pollution when trying to debug real websites, so I'm going to address this.

Mentor: jdescottes
Severity: -- → S3
Flags: needinfo?(hskupin)
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/cb99fc828cd9 https://hg.mozilla.org/integration/autoland/rev/10c49ed3bbbb [remote] Avoid log pollution from short lived iframes in WindowManager r=webdriver-reviewers,whimboo
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch
Points: --- → 1
Whiteboard: [webdriver:backlog][lang=js] → [webdriver:m17][lang=js]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: