Add a product to cart then go to the cart page. If you notice, the ajax request for "reclaim/checkout/reload" is going to a 404. This is just one issue. Next, you may notice that when that 404 ajax request finishes, it contains headers with cookies. Now, go ahead and add any random coupon code so you receive an error notice. Now keep adding random coupon codes to generate more error messages. You will notice the messages just keep accumulating with each page refresh while on the cart page. This is because your extension's 404 is returning the old messages after magento is trying to clear them on page load.
So, in other words:
1) On page load, Magento clears the messages cookie in local browser
2) Then, your module's 404 ajax request returns from the server which contains the old message cache, which then just re-adds it to the local browser cookie
Add a product to cart then go to the cart page. If you notice, the ajax request for "reclaim/checkout/reload" is going to a 404. This is just one issue. Next, you may notice that when that 404 ajax request finishes, it contains headers with cookies. Now, go ahead and add any random coupon code so you receive an error notice. Now keep adding random coupon codes to generate more error messages. You will notice the messages just keep accumulating with each page refresh while on the cart page. This is because your extension's 404 is returning the old messages after magento is trying to clear them on page load.
So, in other words: 1) On page load, Magento clears the messages cookie in local browser 2) Then, your module's 404 ajax request returns from the server which contains the old message cache, which then just re-adds it to the local browser cookie