Thanks for the response @wOxxOm
I was reading your answers on Stackoverflow.com and it helped me a lot. Thank you!
Can you help with the below query
1. If there is some state in the old content script, how can we transfer the state to the new content script. I tried sending the custom event with state in the document/window event detail after disconnecting all the listeners in the old content script but when the event was received by the new content script the event detail was undefined