Closed Bug 2019511 Opened 8 months ago Closed 8 months ago

browsingContext.setViewport can timeout if several contexts are created in parallel

Categories

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

defect
Points:
1

Tracking

(firefox150 fixed)

RESOLVED FIXED
150 Branch
Tracking Status
firefox150 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

(Blocks 3 open bugs)

Details

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

Attachments

(1 external file, 1 obsolete file)

See Bug 1789544, the current logic which expects a resize event is fragile and can timeout if several browsing contexts are created in parallel.

Post patch + details about the failure.

Flags: needinfo?(jdescottes)
Priority: -- → P3
Whiteboard: [webdriver:backlog]

(In reply to Julian Descottes [:jdescottes] from Bug 1789544 comment #44)

For info, I modified https://searchfox.org/firefox-main/rev/3c52c9c886f7b0423001cef86abfafcf97f2b90a/remote/webdriver-bidi/modules/root/browsingContext.sys.mjs#2552-2570

if (targetHeight !== currentHeight || targetWidth !== currentWidth) {
  if (!navigable.isActive) {
    // Force a synchronous update of the remote browser dimensions so that
    // background tabs get resized.
    browser.ownerDocument.synchronouslyUpdateRemoteBrowserDimensions(
      /* aIncludeInactive = */ true
    );
  }
  // Wait until the viewport has been resized
  await this._forwardToWindowGlobal(
    "_awaitViewportDimensions",
    navigable.id,
    {
      height: targetHeight,
      width: targetWidth,
    },
    { retryOnAbort: true }
  );
}

to stop checking navigable.isActive, I think there's no guarantee that the navigable will remain active until the _awaitViewportDimention command is received. That seems to fix this intermittent.

Alternatively we could use the same approach as for _awaitVisibilityState and use a timeout (which we implemented in Bug 2003857 - Wait for document to be visible in browsingContext.create with background=false)

There is some additional info in the Bug 1789544 comment #43 as well. While the fix suggested above seems to fix the intermittent, I wasn't able to write a wdspec test to replicate the issue yet.

Flags: needinfo?(jdescottes)

Thanks Julian. So even the wdspec test you wrote doesn't reproduce the issue, could you maybe attach it to the bug?

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

Attached.

Assignee: jdescottes → nobody
Status: ASSIGNED → NEW
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/5aa299d600fe https://hg.mozilla.org/integration/autoland/rev/c6cc3860956c [bidi] Always call synchronouslyUpdateRemoteBrowserDimensions in browsingContext.create r=whimboo
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch
Severity: -- → S3
Points: --- → 1
Whiteboard: [webdriver:backlog] → [webdriver:m19]
Blocks: 2022762

Comment on attachment 9550595 [details]
Bug 2019511 - [wdspec] Add test for parallel setViewport calls

Revision D286451 was moved to bug 2022762. Setting attachment 9550595 [details] to obsolete.

Attachment #9550595 - Attachment is obsolete: true

The failure on bug 1789544 is still visible for mozilla-beta (but with only 2 failures). I assume it's already too late to uplift, or should we try?

Flags: needinfo?(jdescottes)

(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #10)

The failure on bug 1789544 is still visible for mozilla-beta (but with only 2 failures). I assume it's already too late to uplift, or should we try?

It's not too late, but the failure rate is low enough I don't think it's worth the effort.

Flags: needinfo?(jdescottes)
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: