Skip to content

Criteo: Handle RemoveUserSyncIframe - #15522

Merged
patmmccann merged 1 commit into
prebid:masterfrom
criteo-forks:feature/handle_removeUserSyncIframe
Aug 27, 2026
Merged

patmmccann merged 1 commit into
prebid:masterfrom
criteo-forks:feature/handle_removeUserSyncIframe

Conversation

@TheodorCiuciucCriteo

Copy link
Copy Markdown
Contributor

Created as a response to the following issue: #15496

Basically this PR ensures that the new function of IFrame removal, doesn't let promises remain uncompleted indefinitely.

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

This PR introduces changes that may not work on all browsers. According to Babel, the following polyfills may be needed, and they are not automatically included:

  • Changes to src/utils.js may need:
    • esnext.weak-map.get-or-insert
    • esnext.weak-map.get-or-insert-computed
  • Changes to test/spec/modules/criteoBidAdapter_spec.js may need:
    • es.iterator.constructor
    • es.iterator.map
    • esnext.iterator.constructor
    • esnext.iterator.map

The best way to address this is to provide good test coverage, as normal PR checks run unit tests on older browsers.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4cdaba616c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/utils.js
export function politeInsertUserSyncIframe(url) {
runBackgroundTask(() => insertUserSyncIframe(url));
export function politeInsertUserSyncIframe(url, done, timeout, onCleanup) {
runBackgroundTask(() => insertUserSyncIframe(url, done, timeout, onCleanup));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cancel deferred iframe insertion during cleanup

When userSync.usePoliteSync is enabled and scheduler.postTask or requestIdleCallback has not executed yet, pbjs.removeUserSyncs() finds no iframe and therefore never invokes onCleanup; this queued task subsequently inserts the iframe after cleanup. For adapters such as Criteo, that leaves the message handler active and recreates a sync iframe after an SPA navigation attempted to remove it, so pending polite insertions need to be tracked and cancelled or cleaned up by removeUserSyncs().

Useful? React with 👍 / 👎.

@barecheck

barecheck Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Barecheck - Code coverage report

Total: 91.24%

Your code coverage diff: 0.01% ▴

Uncovered files and lines
FileLines
modules/criteoBidAdapter.js134, 245, 269, 283, 285, 442, 518, 533, 538, 562, 653, 659, 664, 669, 676-677
modules/mobkoiIdSystem.js57-58, 79-81, 125, 133, 135-138, 140-142, 149
src/adapters/bidderFactory.ts474-476, 578-579, 587, 601, 664-665, 669-670, 698-699
src/userSync.ts141, 181, 201, 281
src/utils.js48, 392, 408-409, 421, 459, 478, 493, 577, 610, 619, 636-637, 665-666, 740, 776, 780, 879-881, 960, 1008, 1049, 1054, 1058-1059, 1209, 1245, 1250, 1277, 1283

@patmmccann patmmccann linked an issue Aug 25, 2026 that may be closed by this pull request
@patmmccann
patmmccann requested a review from dgirardi August 25, 2026 13:32

@dgirardi dgirardi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Merging master should clear the test failures.

@TheodorCiuciucCriteo
TheodorCiuciucCriteo force-pushed the feature/handle_removeUserSyncIframe branch from 4cdaba6 to 690a265 Compare August 26, 2026 07:16
@patmmccann
patmmccann merged commit d74847c into prebid:master Aug 27, 2026
102 checks passed
steffenmllr pushed a commit to mllrsohn/Prebid.js that referenced this pull request Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modify sync cleanup to notify or cleanup listeners

3 participants