Bug 1718018 - Use vcard content types in place of the deprecated x-vcard. r=mkmelin
Differential Revision: https://phabricator.services.mozilla.com/D121744
This commit is contained in:
Родитель
27b76cba41
Коммит
0cff43fe39
|
@ -12,7 +12,7 @@ class VCardChild extends JSWindowActorChild {
|
|||
// This link comes from VCardMimeConverter.convertToHTML in VCardUtils.jsm.
|
||||
if (event.target.classList.contains("moz-vcard-badge")) {
|
||||
if (event.button == 0) {
|
||||
// The href is a data:text/x-vcard URL.
|
||||
// The href is a data:text/vcard URL.
|
||||
let href = event.target.href;
|
||||
href = href.substring(href.indexOf(",") + 1);
|
||||
this.sendAsyncMessage("addVCard", href);
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<mimetype>message/rfc822</mimetype>
|
||||
<mimetype>x-scheme-handler/mailto</mimetype>
|
||||
<mimetype>text/calendar</mimetype>
|
||||
<mimetype>text/vcard</mimetype>
|
||||
<mimetype>text/x-vcard</mimetype>
|
||||
</mimetypes>
|
||||
|
||||
|
|
|
@ -1140,14 +1140,14 @@ var cardsPane = {
|
|||
// A card implementation may throw NS_ERROR_NOT_IMPLEMENTED.
|
||||
// Don't break drag-and-drop if that happens.
|
||||
let vCard = card.translateTo("vcard");
|
||||
event.dataTransfer.setData("text/x-vcard", decodeURIComponent(vCard));
|
||||
event.dataTransfer.setData("text/vcard", decodeURIComponent(vCard));
|
||||
event.dataTransfer.setData(
|
||||
"application/x-moz-file-promise-dest-filename",
|
||||
card.displayName + ".vcf"
|
||||
);
|
||||
event.dataTransfer.setData(
|
||||
"application/x-moz-file-promise-url",
|
||||
"data:text/x-vcard," + vCard
|
||||
"data:text/vcard," + vCard
|
||||
);
|
||||
event.dataTransfer.setData(
|
||||
"application/x-moz-file-promise",
|
||||
|
@ -1173,7 +1173,7 @@ var cardsPane = {
|
|||
getFlavorData(aTransferable, aFlavor, aData) {
|
||||
if (aFlavor == "application/x-moz-file-promise") {
|
||||
let primitive = {};
|
||||
aTransferable.getTransferData("text/x-vcard", primitive);
|
||||
aTransferable.getTransferData("text/vcard", primitive);
|
||||
let vCard = primitive.value.QueryInterface(Ci.nsISupportsString).data;
|
||||
aTransferable.getTransferData(
|
||||
"application/x-moz-file-promise-dest-filename",
|
||||
|
|
|
@ -150,7 +150,7 @@ add_task(async function test_drag() {
|
|||
let transferUnicode = dataTransfer.getData("text/unicode");
|
||||
Assert.equal(transferUnicode, "contact 1 <contact.1@invalid>");
|
||||
|
||||
let transferVCard = dataTransfer.getData("text/x-vcard");
|
||||
let transferVCard = dataTransfer.getData("text/vcard");
|
||||
Assert.stringContains(transferVCard, `\r\nUID:${contact1.UID}\r\n`);
|
||||
|
||||
dragService.endDragSession(true);
|
||||
|
@ -178,7 +178,7 @@ add_task(async function test_drag() {
|
|||
"contact 1 <contact.1@invalid>,contact 2 <contact.2@invalid>,contact 3 <contact.3@invalid>"
|
||||
);
|
||||
|
||||
transferVCard = dataTransfer.getData("text/x-vcard");
|
||||
transferVCard = dataTransfer.getData("text/vcard");
|
||||
Assert.stringContains(transferVCard, `\r\nUID:${contact1.UID}\r\n`);
|
||||
|
||||
dragService.endDragSession(true);
|
||||
|
|
|
@ -137,7 +137,7 @@ var messages = [
|
|||
{ body: textAttachment, filename: "ubik.txt", format: "" },
|
||||
{
|
||||
body: vcardAttachment,
|
||||
contentType: "text/x-vcard",
|
||||
contentType: "text/vcard",
|
||||
filename: "ubik.vcf",
|
||||
encoding: "base64",
|
||||
format: "",
|
||||
|
|
|
@ -14,7 +14,7 @@ Content-Type: text/plain; charset=UTF-8
|
|||
has an attached vcf which has invalid data (null)
|
||||
|
||||
--------------B16B2089EF5F4ADD84A4E66F
|
||||
Content-Type: text/x-vcard;
|
||||
Content-Type: text/vcard;
|
||||
name="contentisnull.vcf"
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Disposition: attachment;
|
||||
|
|
|
@ -28,7 +28,7 @@ Content-Type: text/html; charset=UTF-8
|
|||
|
||||
</div></div></body></html>
|
||||
--sgnirk-111111111111111
|
||||
Content-Type: text/x-vcard; charset=UTF-8
|
||||
Content-Type: text/vcard; charset=UTF-8
|
||||
Content-Disposition: attachment; filename="Meister.vcf"
|
||||
|
||||
BEGIN:VCARD
|
||||
|
|
|
@ -333,7 +333,7 @@ VCardMimeConverter.prototype = {
|
|||
<body>
|
||||
<table class="moz-vcard-table">
|
||||
<tr>
|
||||
<td valign="top"><a class="moz-vcard-badge" href="data:text/x-vcard,${escapedVCard}"></a></td>
|
||||
<td valign="top"><a class="moz-vcard-badge" href="data:text/vcard,${escapedVCard}"></a></td>
|
||||
<td>
|
||||
${propertiesTable}
|
||||
</td>
|
||||
|
|
|
@ -131,7 +131,7 @@ class MimeEncoder {
|
|||
this._charset &&
|
||||
isCharsetMultiByte &&
|
||||
(this._contentType.startsWith("text") ||
|
||||
// text/x-vcard synonym
|
||||
// text/vcard synonym
|
||||
this._contentType == "application/directory")
|
||||
) {
|
||||
needsB64 = true;
|
||||
|
|
|
@ -371,7 +371,7 @@ nsresult nsMsgAttachmentHandler::PickEncoding(nsIMsgSend* mime_delivery_state) {
|
|||
m_type.LowerCaseEqualsLiteral(TEXT_ENRICHED) ||
|
||||
m_type.LowerCaseEqualsLiteral(TEXT_VCARD) ||
|
||||
m_type.LowerCaseEqualsLiteral(
|
||||
APPLICATION_DIRECTORY) || /* text/x-vcard synonym */
|
||||
APPLICATION_DIRECTORY) || /* text/vcard synonym */
|
||||
m_type.LowerCaseEqualsLiteral(TEXT_CSS) ||
|
||||
m_type.LowerCaseEqualsLiteral(TEXT_JSSS))) {
|
||||
needsB64 = true;
|
||||
|
|
|
@ -568,7 +568,7 @@ char* mime_generate_attachment_headers(
|
|||
(PL_strcasecmp(type, TEXT_ENRICHED) == 0) ||
|
||||
(PL_strcasecmp(type, TEXT_VCARD) == 0) ||
|
||||
(PL_strcasecmp(type, APPLICATION_DIRECTORY) ==
|
||||
0) || /* text/x-vcard synonym */
|
||||
0) || /* text/vcard synonym */
|
||||
(PL_strcasecmp(type, TEXT_CSS) == 0) ||
|
||||
(PL_strcasecmp(type, TEXT_JSSS) == 0)) ||
|
||||
(PL_strcasecmp(encoding, ENCODING_BASE64) != 0)) &&
|
||||
|
@ -679,7 +679,7 @@ char* mime_generate_attachment_headers(
|
|||
else if (!PL_strcasecmp(type, APPLICATION_OCTET_STREAM) ||
|
||||
!PL_strcasecmp(type, TEXT_VCARD) ||
|
||||
!PL_strcasecmp(type,
|
||||
APPLICATION_DIRECTORY)) /* text/x-vcard synonym */
|
||||
APPLICATION_DIRECTORY)) /* text/vcard synonym */
|
||||
buf.AppendLiteral("attachment");
|
||||
else
|
||||
buf.AppendLiteral("inline");
|
||||
|
|
|
@ -1177,7 +1177,7 @@ NS_IMETHODIMP nsMsgCompose::SendMsg(MSG_DeliverMode deliverMode,
|
|||
|
||||
if (NS_SUCCEEDED(rv) && !escapedVCard.IsEmpty()) {
|
||||
nsCString vCardUrl;
|
||||
vCardUrl = "data:text/x-vcard;charset=utf-8;base64,";
|
||||
vCardUrl = "data:text/vcard;charset=utf-8;base64,";
|
||||
nsCString unescapedData;
|
||||
MsgUnescapeString(escapedVCard, 0, unescapedData);
|
||||
char* result = PL_Base64Encode(unescapedData.get(), 0, nullptr);
|
||||
|
|
|
@ -166,7 +166,7 @@ var relImage = {
|
|||
|
||||
var tachVCard = {
|
||||
filename: "bob.vcf",
|
||||
contentType: "text/x-vcard",
|
||||
contentType: "text/vcard",
|
||||
encoding: "7bit",
|
||||
body: "begin:vcard\nfn:Bob\nend:vcard\n",
|
||||
};
|
||||
|
|
|
@ -125,7 +125,7 @@ var partRelImage = new SyntheticPartLeaf(relImage.body, relImage);
|
|||
|
||||
var tachVCard = {
|
||||
filename: "bob.vcf",
|
||||
contentType: "text/x-vcard",
|
||||
contentType: "text/vcard",
|
||||
encoding: "7bit",
|
||||
body: "begin:vcard\nfn:Bob\nend:vcard\n",
|
||||
};
|
||||
|
|
|
@ -473,7 +473,8 @@ static nsMsgAttachmentData* mime_draft_process_attachments(
|
|||
else
|
||||
tmpFile = mdd->attachments[attachmentsIndex++];
|
||||
|
||||
if (tmpFile->m_type.LowerCaseEqualsLiteral("text/x-vcard"))
|
||||
if (tmpFile->m_type.LowerCaseEqualsLiteral("text/vcard") ||
|
||||
tmpFile->m_type.LowerCaseEqualsLiteral("text/x-vcard"))
|
||||
tmp->m_realName = tmpFile->m_description;
|
||||
|
||||
if (tmpFile->m_origUrl) {
|
||||
|
|
|
@ -441,7 +441,8 @@ MimeObjectClass* mime_find_class(const char* content_type, MimeHeaders* hdrs,
|
|||
#endif
|
||||
|
||||
if (types_of_classes_to_disallow > 0 &&
|
||||
!PL_strncasecmp(content_type, "text/x-vcard", 12))
|
||||
(!PL_strncasecmp(content_type, "text/vcard", 10) ||
|
||||
!PL_strncasecmp(content_type, "text/x-vcard", 12)))
|
||||
/* Use a little hack to prevent some dangerous plugins, which ship
|
||||
with Mozilla, to run.
|
||||
For the truly user-installed plugins, we rely on the judgement
|
||||
|
|
|
@ -437,7 +437,8 @@ static int MimeMultipart_create_child(MimeObject* obj) {
|
|||
!mime_typep(body, (MimeObjectClass*)&mimeMultipartClass) &&
|
||||
!((mime_typep(body, (MimeObjectClass*)&mimeExternalObjectClass) ||
|
||||
mime_typep(body, (MimeObjectClass*)&mimeSuppressedCryptoClass)) &&
|
||||
!strcmp(body->content_type, "text/x-vcard"))) {
|
||||
(!strcmp(body->content_type, "text/vcard") ||
|
||||
!strcmp(body->content_type, "text/x-vcard")))) {
|
||||
status = obj->options->decompose_file_init_fn(
|
||||
obj->options->stream_closure, mult->hdrs);
|
||||
if (status < 0) return status;
|
||||
|
@ -525,7 +526,8 @@ static int MimeMultipart_close_child(MimeObject* object) {
|
|||
!mime_typep(kid, (MimeObjectClass *)&mimeMultipartClass) &&
|
||||
!((mime_typep(kid, (MimeObjectClass *)&mimeExternalObjectClass) ||
|
||||
mime_typep(kid, (MimeObjectClass *)&mimeSuppressedCryptoClass)) &&
|
||||
!strcmp(kid->content_type, "text/x-vcard"))) {
|
||||
(!strcmp(kid->content_type, "text/vcard") ||
|
||||
!strcmp(kid->content_type, "text/x-vcard")))) {
|
||||
status = object->options->decompose_file_close_fn(
|
||||
object->options->stream_closure);
|
||||
if (status < 0) return status;
|
||||
|
@ -568,7 +570,8 @@ static int MimeMultipart_parse_child_line(MimeObject* obj, const char* line,
|
|||
!mime_typep(kid, (MimeObjectClass*)&mimeMultipartClass) &&
|
||||
!((mime_typep(kid, (MimeObjectClass*)&mimeExternalObjectClass) ||
|
||||
mime_typep(kid, (MimeObjectClass*)&mimeSuppressedCryptoClass)) &&
|
||||
!strcmp(kid->content_type, "text/x-vcard")))
|
||||
(!strcmp(kid->content_type, "text/vcard") ||
|
||||
!strcmp(kid->content_type, "text/x-vcard"))))
|
||||
return obj->options->decompose_file_output_fn(
|
||||
line, length, obj->options->stream_closure);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче