summaryrefslogtreecommitdiffstats
path: root/comm/mailnews/mime/test/unit/custom_header.js
diff options
context:
space:
mode:
Diffstat (limited to 'comm/mailnews/mime/test/unit/custom_header.js')
-rw-r--r--comm/mailnews/mime/test/unit/custom_header.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/comm/mailnews/mime/test/unit/custom_header.js b/comm/mailnews/mime/test/unit/custom_header.js
new file mode 100644
index 0000000000..af2af97780
--- /dev/null
+++ b/comm/mailnews/mime/test/unit/custom_header.js
@@ -0,0 +1,11 @@
+// Custom header support for testing structured_headers.js
+
+/* globals jsmime */
+
+jsmime.headerparser.addStructuredDecoder("X-Unusual", function (hdrs) {
+ return Number.parseInt(hdrs[hdrs.length - 1], 16);
+});
+
+jsmime.headeremitter.addStructuredEncoder("X-Unusual", function (val) {
+ this.addUnstructured(val.toString(16));
+});