Bug 1506587 Comment 48 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Interesting, changing to `displayName = displayName.replace(/\s+/g, " ").trim();` now makes *all* tabs disappear, when before only some disappeared:
https://bugzilla.mozilla.org/attachment.cgi?oldid=9078646&action=interdiff&newid=9079004&headers=1
There were already some tabs in the test case before you added more. Also, my test in comment #44 passed, so those tabs weren't collapsed with the other white-space.

That's certainly a plus. I still think some additional test cases to "visualise" what's happening wouldn't be bad. I've adjusted my additions to the new behaviour:

```
+      // Collapse multiple "special" spaces like NBSP (\u00A0), EM space (\u2003), etc.
+      ["Friend \u00A0\u00A0\u2003 A <ws@example.com>",
+        [{name: "Friend A", email: "ws@example.com"}]],
+      // Remove tabs.
+      ["Friend \t \t A\t\tB <ws@example.com>",
+        [{name: "Friend A B", email: "ws@example.com"}]],
```

So with these added and \u0600-\u0605 removed since we're really looking to avoid white-space spoofing, not eliminate characters that we deem not useful, that would be an r+, assuming that the surrogates are correct, which I haven't checked yet.
Interesting, changing to `displayName = displayName.replace(/\s+/g, " ").trim();` now makes *all* tabs disappear, when before only some disappeared:
https://bugzilla.mozilla.org/attachment.cgi?oldid=9078646&action=interdiff&newid=9079004&headers=1
There were already some tabs in the test case before you added more. Also, my test in comment #44 passed, so those tabs weren't collapsed with the other white-space before.

That's certainly a plus. I still think some additional test cases to "visualise" what's happening wouldn't be bad. I've adjusted my additions to the new behaviour:

```
+      // Collapse multiple "special" spaces like NBSP (\u00A0), EM space (\u2003), etc.
+      ["Friend \u00A0\u00A0\u2003 A <ws@example.com>",
+        [{name: "Friend A", email: "ws@example.com"}]],
+      // Remove tabs.
+      ["Friend \t \t A\t\tB <ws@example.com>",
+        [{name: "Friend A B", email: "ws@example.com"}]],
```

So with these added and \u0600-\u0605 removed since we're really looking to avoid white-space spoofing, not eliminate characters that we deem not useful, that would be an r+, assuming that the surrogates are correct, which I haven't checked yet.

Back to Bug 1506587 Comment 48