There's frontend code / tests that rely on the current behavior, so rather than having to deal with this one by one as we migrate XUL elements to HTML I think we should have an up-front change where we change those callers and update the behavior.
It seems tricky to find every caller that would have it's behavior change from this, but the things I expect to come up are test assertions, and stuff like:
// String concatenation
xulEl.getAttribute("foo") + "string” // “string”
htmlEl.getAttribute("foo") + "string" // "nullstring"
// Expecting it to always return a string which will throw once it’s null:
docTitle = tab.getAttribute("label").replace(/\0/g, "”);
I’m hoping our tests will catch most issues like this.
I have some (4 years old...) abandoned patches in Bug 232598 that may or
may not be useful here. Tests will definitely complain at you -- the
bulk of the work was fixing tests.
(I'm not really sure why I gave up, tbh.)
Web Compat, Mozilla
too bad we don't support optional chaining yet, this might have made the
transition a bit easier:
> tab.getAttribute("label")?.replace(/\0/g, "”);
Would it make sense to prioritize optional chaining before making this
change or would that conflict with your followup changes' timing?
> On 7. Nov 2019, at 9:59 PM, Brian Grinstead <bgrin...@mozilla.com>
> Thanks for the heads up Mike! I guess I should give precedence to the