Closed
Bug 1372899
Opened 7 years ago
Closed 7 years ago
Provide a facility to encode/decode UTF-7 in JS so tests disabled in bug 1363281 can be reinstated
Categories
(MailNews Core :: Internationalization, enhancement)
MailNews Core
Internationalization
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 56.0
People
(Reporter: jorgk-bmo, Assigned: jorgk-bmo)
References
Details
Attachments
(1 file)
5.38 KB,
patch
|
aceman
:
review+
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #1363281 +++
Some tests related to UTF-7 encoding were remove here:
https://hg.mozilla.org/comm-central/rev/f2532fa2989b44536653261e53c179edf27c5400
https://hg.mozilla.org/comm-central/rev/322986aa2dbabda0ba031d76ba2dc959c7cc9f7a
since UTF-7 can no longer be decoded via the nsIScriptableUnicodeConverter.
We should provide a facility to do this decoding in JS so we can enable the tests again.
Assignee | ||
Comment 1•7 years ago
|
||
With this patch, this test works again:
mozilla/mach xpcshell-test mailnews/imap/test/unit/test_mailboxes.js
Let's send this for a try run:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=585d225c00f72bcb9d1a9adf70a76aa2a0587df7
Joshua, why the this.fullName.replace(/([\\"])/g, '\\$1') ?
It's from here:
https://hg.mozilla.org/comm-central/rev/a8d4959143e5#l5.276
I'd like to add a comment.
Comment 2•7 years ago
|
||
(In reply to Jorg K (GMT+2) from comment #1)
> Joshua, why the this.fullName.replace(/([\\"])/g, '\\$1') ?
> It's from here:
> https://hg.mozilla.org/comm-central/rev/a8d4959143e5#l5.276
That's a poor man's string escape. The regex is saying "replace every instance of \ and " with itself prepended by \".
Assignee | ||
Comment 3•7 years ago
|
||
Yes, that's what the regex says, but why is it necessary?
How about a comment:
// Escape \ and " with another \ since ...
Assignee | ||
Comment 4•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Attachment #8878215 -
Flags: review?(Pidgeot18) → review?(acelists)
Comment on attachment 8878215 [details] [diff] [review]
1372899-scriptable-utf-7.patch (v1).
Review of attachment 8878215 [details] [diff] [review]:
-----------------------------------------------------------------
::: mailnews/imap/test/unit/test_mailboxes.js
@@ +5,5 @@
> load("../../../resources/logHelper.js");
> load("../../../resources/asyncTestUtils.js");
> load("../../../resources/messageGenerator.js");
>
> +const folderName1 = "I18N box\u00E1";
Please add a comment that the names are in modified UTF-7 encoding.
::: mailnews/intl/nsCharsetConverterManager.cpp
@@ +16,5 @@
>
> #include "nsComponentManagerUtils.h"
> #include "nsISupportsPrimitives.h"
> #include "nsServiceManagerUtils.h"
> +#include "../base/util/nsMsgI18N.h"
Is the path needed? It's uncommon with other includes.
::: mailnews/intl/nsICharsetConverterManager.idl
@@ +61,5 @@
> nsIAtom getCharsetLangGroup(in string aCharset);
> nsIAtom getCharsetLangGroupRaw(in string aCharset);
> +
> + /**
> + * MUTF-7 Support.
Please describe what the M means.
::: mailnews/test/fakeserver/imapd.js
@@ +301,5 @@
> this.name;
> },
> get displayName() {
> + let manager = Cc['@mozilla.org/charset-converter-manager;1']
> + .getService(Ci.nsICharsetConverterManager);
How often do we call this displayName in the tests? May this be expensive to get the Manager every time here?
Attachment #8878215 -
Flags: review?(acelists) → review+
Assignee | ||
Comment 6•7 years ago
|
||
(In reply to :aceman from comment #5)
> How often do we call this displayName in the tests? May this be expensive to
> get the Manager every time here?
Before it got the scriptable Unicode encoder there:
https://hg.mozilla.org/comm-central/rev/f2532fa2989b44536653261e53c179edf27c5400
but since it doesn't handle UTF-7 any more I had to kill that code and now it's coming back.
Assignee | ||
Comment 8•7 years ago
|
||
(In reply to :aceman from comment #5)
> > +const folderName1 = "I18N box\u00E1";
> Please add a comment that the names are in modified UTF-7 encoding.
Actually, no, this is simply "I18N boxá". Without an MUTF-7 encoder I can't represent this name. That's why I dumbed the names down here:
https://hg.mozilla.org/comm-central/rev/322986aa2dbabda0ba031d76ba2dc959c7cc9f7a#l1.12
> > +#include "../base/util/nsMsgI18N.h"
> Is the path needed? It's uncommon with other includes.
Because this is not a published interface and it's in a different directory. Uncommon, but used:
https://dxr.mozilla.org/comm-central/rev/72afbd97238900cf27f9bbe59d7b238c5bd7b2e0/mailnews/base/util/nsMsgI18N.cpp#29
https://dxr.mozilla.org/comm-central/rev/72afbd97238900cf27f9bbe59d7b238c5bd7b2e0/mailnews/imap/src/nsImapService.cpp#72
Assignee | ||
Comment 9•7 years ago
|
||
https://hg.mozilla.org/comm-central/rev/df37b1887f4dc4170cc657bf4317f5870209485c
Landed with a few tweaked comments.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 56.0
You need to log in
before you can comment on or make changes to this bug.
Description
•