Comment by twoodfin
That's what the question of strict scrutiny vs. intermediate scrutiny vs. rational basis is about. The courts would have to decide the appropriate level of scrutiny given the legal context and then apply that to the law as written.
Your hypothetical clearly implicates the Times' speech, so intermediate scrutiny at least would be applied, requiring that the law serve an important governmental purpose. I think that would be a difficult argument for the government to make, especially if the law was selective about which kinds of media institutions could and could not have any foreign ownership in general. The TikTok law is much more specific.
For those interested, https://crsreports.congress.gov/product/pdf/R/R47986 is a relatively approachable overview of these guidelines.
It's interesting to read the full TikTok opinion https://www.supremecourt.gov/opinions/24pdf/24-656_ca7d.pdf and search for "scrutiny" and "tailored" while referencing some of the diagrams from the overview above. It's a good case study of how different levels of scrutiny are evaluated!
(Not a lawyer, this is not legal advice.)