Hi everyone,
I was trying to fix the focused page emulation in DevTools by correctly restoring it on navigation (
CL) while it works for regular navigations and reloads, there is an edge case when we hit a DCHECK in
v8_bindings_for_core caused by setting a frame to focused after the navigation commits. After checking values of DCHECK, I see that for normal reloads the context is empty. If the page was previously restored from bfcache and then reloaded, the context is non-empty causing the check to fail. The frame is in both situations detached.
I tried to understand what could be the reason: by tracing the code I saw that a new window is being created (and not re-used) but I could not see why the context would be non-empty in this situation.
Does anyone have any suggestions? Is the DCHECK perhaps outdated with bfcache? Thanks!
Best regards,
Alex