Bug 784286: Use subscript loader for gloda mime builder to reduce JS compartment boundary crossings. r+a=Standard8 SEAMONKEY_2_13b2_BUILD1 SEAMONKEY_2_13b2_RELEASE
authorIrving Reid <irving@mozilla.com>
Wed, 05 Sep 2012 23:37:43 +0200
changeset 12994 e273f6ba2c37ee3d2d5d01961b2ecf270e6281db
parent 12993 0564977e1c9df5683443a91e217dd4e53a70ae09
child 12995 8aab685600d0a2f1cb20b8dd29c5fa3081ac301c
child 12997 a922a4f80d5522f788407129942494eebf95cb86
child 12999 43d1dd48668792c6e8e1f3e24e740ff45dd78ed6
push idunknown
push userunknown
push dateunknown
bugs784286
Bug 784286: Use subscript loader for gloda mime builder to reduce JS compartment boundary crossings. r+a=Standard8
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);