If you left the window that popup opened in open, and did not click ANYTHING in it, then try this. Use the 3 fingered salute, Ctrl + Alt + Del. When the task manager opens, select the offending programs or processes and shut them down. If the shutdown process says it can’t finish because a running program is waiting for input, don’t go to the affected program. Instead close task manager and shut the system down, using the Force Shutdown button if necessary to avoid returning to the hung page and clicking anything.
Boot back up if necessary and open Firefox. Firefox may open the same window tabs again and if it does, just go through the three fingered salute process 1 more time. On the second try, Firefox should ask you if you want to open old tabs or start fresh. Start fresh.
If even that doesn’t work to keep FF from going right back into the loop, then download (with a different browser like IE then download ccCleaner and run it to get rid of the scripting that’s taken control. As soon as the system is back to being able to open and run FF without going to the rogue page, run a complete Virus Scan with your AV software.
Whenever a web page opens a popup that insists you click on it, DON’T DO IT. Instead, use the three fingered salute and start task manager. Close the program (browser, or browser process/es that are giving the problem).