According to a contract seen by Recode, Yahoo CEO Marissa Mayer struck a deal with Mozilla in 2014 specifying annual payments of $375 million (£290 million) to the browser creator in exchange for Yahoo's search engine appearing in the default position on Firefox. That $375 million price tag will be paid out every year until 2019 one way or another—even if Mozilla doesn’t like the company that buys Yahoo and decides to walk away.

Of course, if Mozilla decides it likes whichever company buys the embattled search giant, then payments continue as before and the new owner of Yahoo’s search engine retains the default position on the browser.

The trick then, is, finding a buyer that is committed to keeping Yahoo’s search product robust, Recode says, at least for the next three years. If a potential buyer was thinking of abandoning search, however, that could come at a very steep price, as it would send Mozilla searching for a better search engine to serve up to its users.

Before the Yahoo deal, about 90 percent of Mozilla’s revenue came from Google, which was then its default search engine. Google paid Mozilla $300 million annually.

According to Recode, Mayer made the deal with Mozilla in a desperate attempt to keep Yahoo relevant. “When it became clear that Yahoo had lost too much market share to Google and also Microsoft, Mayer felt an aggressive—and very expensive—effort was needed to get it back,” the site writes. “That included striking search deals with both Mozilla and Oracle to get more search volume to monetize. Mayer has also been investing enormous amounts of money and efforts into Project Index, a mobile-focused search effort that Yahoo has yet to launch.” Mayer previously worked at Google on its search product and was brought in to hopefully save the failing company from a precipitous fall.

Yahoo has failed to turn around effectively, however. The company decided to split from the very profitable Alibaba in 2015, spinning off its core businesses for tax purposes. By February, the company was “exploring strategic alternatives” and cutting 15 percent of its employees. In May, the company disclosed that Mayer would be given a $55 million cushion if she were ousted from the company within a year of its sale. The company has also moved to sell some 3,000 patents it has acquired.

Potential buyers, including Verizon, Quicken Loans, and private equity firms, are now in the third round of offers for the company's core businesses.

Recode’s sources have also indicated that there could be more problems with selling the company. “Buyers estimate that there could be up to $1 billion in stock compensation costs—money owed to employees who were loaded up with shares and options in order to entice them to stay,” the news outlet wrote.