Bug 784286: Use subscript loader for gloda mime builder to reduce JS compartment boundary crossings. r+a=Standard8 CLOSED TREE
authorIrving Reid <irving@mozilla.com>
Wed, 05 Sep 2012 23:37:43 +0200
changeset 30857 f7ae9cfd45409ea906086112f2b92e123405744c
parent 30856 4c39c77cfe368a31e39ac1e433c0feeb958a2a43
child 30858 3bccb752ab1c23e6ad4cea525b537a286eab2987
push id1
push userclokep@gmail.com
push dateMon, 07 May 2018 22:45:56 +0000
treeherdercomm-esr60@57eacde5ef40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs784286
Bug 784286: Use subscript loader for gloda mime builder to reduce JS compartment boundary crossings. r+a=Standard8 CLOSED TREE
mailnews/db/gloda/components/jsmimeemitter.js
mailnews/db/gloda/modules/mimemsg.js
--- a/mailnews/db/gloda/components/jsmimeemitter.js
+++ b/mailnews/db/gloda/components/jsmimeemitter.js
@@ -450,18 +450,18 @@ MimeMessageEmitter.prototype = {
 
   /**
    * Write to the body.  When saneBodySize is active, we stop adding if we are
    *  already at the limit for this body part.
    */
   writeBody: function mime_emitter_writeBody(aBuf, aSize, aOutAmountWritten) {
     if (this._writeBody &&
         (!this._saneBodySize ||
-         this._curPart.body.length < MAX_SANE_BODY_PART_SIZE))
-      this._curPart.body += aBuf;
+         this._curPart.size < MAX_SANE_BODY_PART_SIZE))
+      this._curPart.appendBody(aBuf);
   },
 
   endBody: function mime_emitter_endBody() {
   },
 
   // ----- Generic Write (confusing)
   // (binary data writing...)
   write: function mime_emitter_write(aBuf, aSize, aOutAmountWritten) {
--- a/mailnews/db/gloda/modules/mimemsg.js
+++ b/mailnews/db/gloda/modules/mimemsg.js
@@ -560,16 +560,19 @@ MimeBody.prototype = {
     return []; // we are a leaf
   },
   get size() {
     return this.body.length;
   },
   set size (whatever) {
     // nop
   },
+  appendBody: function MimeBody_append(aBuf) {
+    this.body += aBuf;
+  },
   coerceBodyToPlaintext:
       function MimeBody_coerceBodyToPlaintext(aMsgFolder) {
     if (this.contentType == "text/plain")
       return this.body;
     // text/enriched gets transformed into HTML by libmime
     if (this.contentType == "text/html" ||
         this.contentType == "text/enriched")
       return aMsgFolder.convertMsgSnippetToPlainText(this.body);