6 ms·
When Firefox tried to make the "X is undefined" JavaScript exception message user-friendlier, it broke flipkart.com. The website's JavaScript explicitly depende
by cpeterso 8y ago
When Firefox tried to make the "X is undefined" JavaScript exception message user-friendlier, it broke flipkart.com. The website's JavaScript explicitly depended on the exact wording of exception messages. Simply loading the flipkart.com home page caused "X is undefined" exceptions, which it tried to parse with regular expressions. The new exception message had to be reverted. :(
https://www.fxsitecompat.com/en-CA/docs/2018/improved-javascript-error-message-breaks-code-relying-on-the-legacy-format/ https://www.fxsitecompat.com/en-CA/docs/2018/improved-javasc...
This is an unfortunate example of Hyrum's Law: "With a sufficient number of users of an API, all observable behaviors of your system will be depended on by somebody."
http://www.hyrumslaw.com/ http://www.hyrumslaw.com/
- ubertaco 8y agoWhy in the world was Flipkart regexing for an "X is undefined" message? That seems as brittle as possible.
- klmr 8y agoWhy in the world did Firefox care enough to revert the behaviour, rather than telling them to go to hell?
- runarberg 8y agoBecause it is the right thing to do. First, you shouldn’t brake the web. Second, you shouldn’t be mean to people. Some people do stupid things (perhaps they don’t know any better), accommodating for them and helping them do the right thing, is a far better option, then to ignore and shame them.
- mbrameld 8y agoI would argue that coddling FlipKart's engineers is NOT the right thing to do. Educate them on why what they did was wrong, help them fix it, but don't punish the rest of the world for one company's mistakes. Similarly, I would argue that by relying on undefined behavior it was the FlipKart engineers breaking the web.
- djakjxnanjak 8y agoPeople who would make that decision don’t end up making decisions at Firefox. Browser behavior consists mostly of arbitrary decisions which have been codified into rules to keep things from breaking.
- oftenwrong 8y agoBecause Flipkart is one of the biggest sites in India. Firefox devs didn't want to ruin the day-to-day web browsing experience of so many people, so they reverted the change. They preserved the user experience at the expense of the developer experience, and I think that was the right call. Doesn't matter that it was Flipkart's fault.
- bzbarsky 8y agoBecause: 1) It's not just Flipkart. It's a library that was being used on multiple sites. For example, lego.com was broken too, for the same reason. 2) Firefox can't tell Flipkart to go to hell per se. All it can do is tell its users to go to hell and not use Flipkart (or lego.com), or at least not use them in Firefox. Phrased that way, I think it's clearer why Firefox cared enough...
- oftenwrong 8y agoBecause they were using a demo function from a JS lib that attempts to match error messages: https://github.com/facebookincubator/idx https://github.com/facebookincubator/idx >The idx runtime function exists for the purpose of illustrating the expected behavior and is not meant to be executed. The idx function requires the use of a Babel plugin that replaces it with an implementation that does not depend on details related to browser error messages. https://github.com/facebookincubator/idx/issues/55 https://github.com/facebookincubator/idx/issues/55
- the_duke 8y agoA classic case of: https://xkcd.com/1172/ https://xkcd.com/1172/ "Every change breaks someones workflow..."
- keymone 8y ago> When Firefox tried to make the "X is undefined" JavaScript exception message user-friendlier, it broke flipkart.com. The new exception message had to be reverted. I am Jack's complete lack of surprise.
- snvzz 8y ago>all observable behaviors of your system will be depended on by somebody. And by all means, break them. They're undefined behaviour.
- deleted 8y ago[deleted]
- rwz 8y agoSoftware relying on undefined behavior like that deserves to be broken and made fun of. I fully support breaking it and the idea that they had to revert the error message change horrifies me. This is why we can't have nice things.
- MrStonedOne 8y agoI wouldn't be so quick to jump to that conclusion. Was there a better, more defined way to catch that error type globally? if there is not, that is not the site creators fault, that is on mozilla
- deleted 8y ago[deleted]
- TheRealPomax 8y agoNot sure I follow, if your code throws an exception, you should be able to code against why that exception would have been able to occur, not against "the toString() output of the exception", especially in a landscape with multiple browsers that all have different exception text.
- ris 8y agoUnfortunately sometimes software or APIs don't give codified error messages or exceptions and the _only way_ to detect the cause of the error programmatically is to scrape the error message, as horrible as it is.
- deepsun 8y agoBut if you do that, you can easily wrap it in try-catch, to make it robust to wording changes, not breaking the site.
- ris 8y agoI thought about this, but I think in the general case it's not always obvious whether the lesser of two evils is to risk getting false positives (by being too "robust to wording changes") or false negatives by being too strict. Either way, my point really is that I'm not about to condemn error message scraping wholesale.
- richdougherty 8y agoI changed that message 12 years ago too—my first Firefox contribution! Those were clearly more innocent times. https://bugzilla.mozilla.org/show_bug.cgi?id=353116 https://bugzilla.mozilla.org/show_bug.cgi?id=353116
- eneveu 8y agoTheir code explicitly depended on the wording of exception messages because they were using a dynamic language. Java is a typed language, where we can match on exception types: if (ex instanceof NullPointerException) catch (NullPointerException ex) { It is therefore rare for Java programmers to match on exception messages (it would be a mistake).