Skip to content

DIA-6123 prevent messageUI from being created on finished()#885

Merged
andresilveirah merged 2 commits intodevelopfrom
DIA-6123_prevent_duplicate_onUIReady
Mar 25, 2026
Merged

DIA-6123 prevent messageUI from being created on finished()#885
andresilveirah merged 2 commits intodevelopfrom
DIA-6123_prevent_duplicate_onUIReady

Conversation

@andresilveirah
Copy link
Copy Markdown
Member

@andresilveirah andresilveirah commented Mar 13, 2026

  • disposes messageUI view before setting its reference to null

  • Fixes a race condition causing the onUIReady to be called more than once while the consent ui is still being presented. More info below.


  1. First layer message loads, onUIReady() is called (isPresenting: false → true) ✅
  2. User takes a consent action (accept/reject all or save & exit)
  3. Async coroutine starts but finished(view) is called immediately
  4. If timing is right and the async coroutine executes fast enough, it sets messageUI = null
  5. Then finished() calls getOrCreateMessageUI().isPresenting = false
  6. If messageUI is already null, getOrCreateMessageUI() creates a NEW WebView instance
  7. The NEW WebView has isPresenting = false by default
  8. renderNextMessageIfAny() or loadPrivacyManager() then calls getOrCreateMessageUI().load()
  9. This uses the newly created WebView (or creates another one)
  10. When content loads, JavaScript calls loaded()
  11. Guard checks: isPresenting is false (new instance), so it calls onUIReady() again ❌

@andresilveirah andresilveirah merged commit 0fbc39c into develop Mar 25, 2026
5 of 6 checks passed
@andresilveirah andresilveirah deleted the DIA-6123_prevent_duplicate_onUIReady branch March 25, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant