Skip to content

Add intersection and resize waits to web detection - #3239

Draft
GuiltyDolphin wants to merge 2 commits into
gd-c-web-detection-detector-eventsfrom
gd-c-web-detection-geometry-waits
Draft

GuiltyDolphin wants to merge 2 commits into
gd-c-web-detection-detector-eventsfrom
gd-c-web-detection-geometry-waits

Conversation

@GuiltyDolphin

@GuiltyDolphin GuiltyDolphin commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Asana Task/Github Issue: https://app.asana.com/1/137249556945/task/1220838335740488

Description

Builds on #3238.

Reading an element's place or size in a run (visibility: "visible", getBoundingClientRect) lays out the page synchronously when it has changed. This adds two wait bodies that get both from observers instead, which compute them in the engine's rendering update:

  • {"wait": {"intersection": {...}, "target": ...}} observes the element's place in the viewport with IntersectionObserver. The root is always the viewport, so root and rootMargin in the options are dropped. An item is the IntersectionObserverEntry, with timeStamp its time
  • {"wait": {"resize": {...}, "target": ...}} observes its size with ResizeObserver, passing the options to observe(). An item is the ResizeObserverEntry, with timeStamp from when the callback ran
  • both need a target, and like a mutation wait each has an observer of its own while the wait is open. observe() queues an entry for the element as it is, so a wait with no where gives its place or size within a frame, and one whose where rejects that keeps waiting for a change. A target that isn't an element fails the wait at its target straight away, and an engine without the observer gives no item, so the wait resumes at timeoutMs
  • IntersectionObserver and ResizeObserver, with their observe and disconnect, are captured with the other recorder globals

Neither observer delivers while the page isn't rendered, which detectors handle by observing the page hiding with whenBusy: "interrupt".

Testing Steps

  • unit tests cover intersection waits (viewport root, where, timeStamp from time, disconnecting), resize waits (options to observe()), a target that isn't an element failing straight away, an engine without the observer resuming at timeoutMs, and parse errors

Checklist

Please tick all that apply:

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

🤖 Generated with Claude Code

@github-actions github-actions Bot added the semver-minor New feature — triggers minor version bump label Nov 23, 2026
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

[Beta] Generated file diff

Time updated: Mon, 30 Nov 2026 12:59:31 GMT

Android
    - android/adsjsContentScope.js
  • android/contentScope.js

File has changed

Apple
    - apple/contentScopeIsolated.js

File has changed

Chrome-mv3
    - chrome-mv3/inject.js

File has changed

Firefox
    - firefox/inject.js

File has changed

Integration
    - integration/contentScope.js

File has changed

Windows
    - windows/contentScope.js

File has changed

@GuiltyDolphin
GuiltyDolphin force-pushed the gd-c-web-detection-geometry-waits branch from d23a114 to 1dad96b Compare November 24, 2026 16:53
@GuiltyDolphin
GuiltyDolphin force-pushed the gd-c-web-detection-geometry-waits branch 2 times, most recently from e166fc6 to bcd4096 Compare November 25, 2026 13:28
@GuiltyDolphin
GuiltyDolphin force-pushed the gd-c-web-detection-geometry-waits branch from bcd4096 to 3c879ce Compare November 25, 2026 16:36
@GuiltyDolphin
GuiltyDolphin force-pushed the gd-c-web-detection-geometry-waits branch from 3c879ce to 1ccc772 Compare November 25, 2026 17:46
@GuiltyDolphin
GuiltyDolphin force-pushed the gd-c-web-detection-geometry-waits branch from 1ccc772 to 7e9b732 Compare November 25, 2026 19:18
@GuiltyDolphin
GuiltyDolphin force-pushed the gd-c-web-detection-geometry-waits branch from 7e9b732 to 574a592 Compare November 25, 2026 20:51
@GuiltyDolphin
GuiltyDolphin force-pushed the gd-c-web-detection-geometry-waits branch from 574a592 to e9f7f35 Compare November 25, 2026 21:54
@GuiltyDolphin
GuiltyDolphin force-pushed the gd-c-web-detection-geometry-waits branch from e9f7f35 to 3c31718 Compare November 25, 2026 22:30
@GuiltyDolphin
GuiltyDolphin force-pushed the gd-c-web-detection-geometry-waits branch from 3c31718 to 52dc95b Compare November 30, 2026 10:47
GuiltyDolphin and others added 2 commits November 30, 2026 12:28
This lets a wait observe an element's place in the viewport or its size, with IntersectionObserver and ResizeObserver captured with the other recorder globals, so a detector reads geometry without laying out the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This matches mutation and event waits: a target the observer can't observe fails the wait at its target straight away, and an engine without the observer still gives no item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@GuiltyDolphin
GuiltyDolphin force-pushed the gd-c-web-detection-geometry-waits branch from 52dc95b to 1cf379d Compare November 30, 2026 12:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-minor New feature — triggers minor version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant