Bug 1536047 - Revert rev 58d5b2195fc8 and only use MOZ_CAN_RUN_SCRIPT_BOUNDARY once in nsMsgCompose.cpp. r+a=me
authorJorg K <jorgk@jorgk.com>
Tue, 19 Mar 2019 18:02:04 +0100
changeset 33954 43530adfd6da555e8c66d9ede229644c486ea8b9
parent 33953 95c94af6564ab3f52ba5e50558d61d5bf352b8ee
child 33955 4fa819fdd79f2e0f046cec2a0cbdcb77e6c8c7d5
push id2392
push usermozilla@jorgk.com
push dateSat, 23 Mar 2019 18:54:09 +0000
treeherdercomm-beta@8a987f6e6350 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1536047
Bug 1536047 - Revert rev 58d5b2195fc8 and only use MOZ_CAN_RUN_SCRIPT_BOUNDARY once in nsMsgCompose.cpp. r+a=me
mailnews/compose/public/nsIMsgCompose.idl
mailnews/compose/src/nsMsgCompose.cpp
mailnews/compose/src/nsMsgCompose.h
--- a/mailnews/compose/public/nsIMsgCompose.idl
+++ b/mailnews/compose/public/nsIMsgCompose.idl
@@ -229,17 +229,16 @@ interface nsIMsgCompose : nsIMsgSendList
 
   /**
    *  Init the editor THIS USED TO BE [noscript]
    *  Now, this is called after editor is created,
    *  which is triggered by loading startup url from JS.
    *  The completion of document loading is detected by observing
    *  the "obs_documentCreated" command
    */
-  [can_run_script]
   void initEditor(in nsIEditor editor, in mozIDOMWindowProxy contentWindow);
 
   /* The following functions are for internal use, essentially for the listener */
 
   /* ... */
   [noscript] void setCiteReference(in nsString citeReference);
 
   /* Set the URI of the folder where the message has been saved */
@@ -250,33 +249,33 @@ interface nsIMsgCompose : nsIMsgSendList
                                    in boolean aQuoted,
                                    inout nsString aMsgBody);
 
   /* set any reply flags on the original message's folder */
   [noscript] void processReplyFlags();
   [noscript] void rememberQueuedDisposition();
 
   /* ... */
-  [can_run_script, noscript]
+  [noscript]
   void convertAndLoadComposeWindow(in nsStringRef aPrefix,
                                    in nsStringRef aBuf,
                                    in nsStringRef aSignature,
                                    in boolean aQuoted,
                                    in boolean aHTMLEditor);
 
   /* Tell the doc state listeners that the doc state has changed
    * aNotificationType is from nsIMsgComposeNotificationType
    */
   [noscript] void notifyStateListeners(in long aNotificationType, in nsresult aResult);
 
   /* Retrieve the progress object */
   readonly attribute nsIMsgProgress progress;
 
   /* ... */
-  [can_run_script, noscript]
+  [noscript]
   void buildBodyMessageAndSignature();
 
   /* ... */
   [noscript] void buildQuotedMessageAndSignature();
 
   /* ... */
   [noscript] void getQuotingToFollow(out boolean quotingToFollow);
 
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -608,17 +608,17 @@ remove_plaintext_tag(nsString &body)
     index = 0;
     while ((index = body.Find("</plaintext", /* ignoreCase = */ true, index)) != kNotFound) {
       body.Insert(u"x-", index+2);
       index += 13;
     }
   }
 }
 
-MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION NS_IMETHODIMP
+MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP
 nsMsgCompose::ConvertAndLoadComposeWindow(nsString& aPrefix,
                                           nsString& aBuf,
                                           nsString& aSignature,
                                           bool aQuoted,
                                           bool aHTMLEditor)
 {
   NS_ASSERTION(m_editor, "ConvertAndLoadComposeWindow but no editor");
   NS_ENSURE_TRUE(m_editor && m_identity, NS_ERROR_NOT_INITIALIZED);
@@ -1630,17 +1630,17 @@ static nsresult fixCharset(nsCString &aC
   }
   return NS_OK;
 }
 
 // This used to be called BEFORE editor was created
 //  (it did the loadURI that triggered editor creation)
 // It is called from JS after editor creation
 //  (loadURI is done in JS)
-MOZ_CAN_RUN_SCRIPT_FOR_DEFINITION NS_IMETHODIMP
+NS_IMETHODIMP
 nsMsgCompose::InitEditor(nsIEditor* aEditor, mozIDOMWindowProxy* aContentWindow)
 {
   NS_ENSURE_ARG_POINTER(aEditor);
   NS_ENSURE_ARG_POINTER(aContentWindow);
   nsresult rv;
 
   m_editor = aEditor;
 
@@ -2464,22 +2464,16 @@ QuotingOutputStreamListener::ConvertToPl
 NS_IMETHODIMP QuotingOutputStreamListener::OnStartRequest(nsIRequest *request)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, nsresult status)
 {
-  return OnStopRequestInternal(request,status);
-}
-
-MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult
-QuotingOutputStreamListener::OnStopRequestInternal(nsIRequest *request, nsresult status)
-{
   nsresult rv = NS_OK;
 
   if (!mHtmlToQuote.IsEmpty())
   {
     // If we had a selection in the original message to quote, we can add
     // it now that we are done ignoring the original body of the message
     mHeadersOnly = false;
     rv = AppendToMsgBody(mHtmlToQuote);
@@ -4605,18 +4599,17 @@ nsMsgCompose::ProcessSignature(nsIMsgIde
     }
   }
 
   aMsgBody->Append(sigOutput);
   PR_Free(preopen);
   return NS_OK;
 }
 
-MOZ_CAN_RUN_SCRIPT nsresult
-nsMsgCompose::BuildBodyMessageAndSignature()
+nsresult nsMsgCompose::BuildBodyMessageAndSignature()
 {
   nsresult    rv = NS_OK;
 
   //
   // This should never happen...if it does, just bail out...
   //
   if (!m_editor)
     return NS_ERROR_FAILURE;
--- a/mailnews/compose/src/nsMsgCompose.h
+++ b/mailnews/compose/src/nsMsgCompose.h
@@ -171,17 +171,16 @@ public:
                                   bool delsp,
                                   bool formatted,
                                   bool disallowBreaks);
     NS_IMETHOD InsertToCompose(nsIEditor *aEditor, bool aHTMLEditor);
     NS_IMETHOD AppendToMsgBody(const nsCString &inStr);
 
 private:
     virtual ~QuotingOutputStreamListener();
-    nsresult OnStopRequestInternal(nsIRequest *request, nsresult status);
     nsWeakPtr                   mWeakComposeObj;
     nsString                    mMsgBody;
     nsString                    mCitePrefix;
     nsString                    mSignature;
     bool                        mQuoteHeaders;
     bool                        mHeadersOnly;
     bool                        mCharsetFixed;
     nsCOMPtr<nsIMsgQuote>       mQuote;