This is a follow up to https://bugs.webkit.org/show_bug.cgi?id=206110, please see the discussion there. To recap, I believe there is a subtle issue here - when didClearWindowObjectInWorld is called for the User world before it is called for the Normal world, subsequent call to clear the normal world will erase this injected script from the InjectedScriptManager through m_injectedScriptManager->discardInjectedScripts(). This can either be patched via the following change to the dispatchDidClearWindowObjectsInAllWorlds (that is somewhat hacky), or via going back to instrumenting only normal worlds and iterating over the remaining worlds within agents explicitly.
Created attachment 390138 [details] Patch
Was this addressed by bug 207232? https://bugs.webkit.org/show_bug.cgi?id=207232
I believe it was! I missed it, thanks! *** This bug has been marked as a duplicate of bug 207232 ***