There are two techniques to open content in a new tab or a popup:
window.open\(*\), because the method itself can be invoked as
w was previously assigned to
a.a() if the code was minified, or... well, you get the pattern.
More importantly, you need to know when the popup is opened. A page can spam user with five popups automatically as soon as it's opened, or a popup can be opened on a click event from the user, or maybe it's buried deep inside complex logic which means that it will be opened only in a very specific case which happens once per year for two-three users. This will make it difficult to impossible to determine the number of popups programmatically, because:
It comes to determining what should you include, and what you shouldn't. Should your crawler consider only popups which are shown on page start? Or maybe on page start and on click events? Or on a timer?
Finding all possible execution paths through the code may take a very long time your servers may not necessarily have.