Bug 1574458: remove unused `nsIDocumentEncoder::OutputDontRemoveLineEndingSpaces` functionality. r=hsivonen
authorMirko Brodesser <mbrodesser@mozilla.com>
Mon, 19 Aug 2019 07:55:22 +0000
changeset 488684 df8ab6a9bdf1782ec29aa500969a7b9ad9fe78b0
parent 488683 dfb2b670618490d4dafdf04c093d4420210edbcf
child 488685 f44a45ca4bf8b8ae55ed117751021e01a63bceae
push id36453
push useraciure@mozilla.com
push dateMon, 19 Aug 2019 16:09:32 +0000
treeherdermozilla-central@115a4bcdb596 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen
bugs1574458
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1574458: remove unused `nsIDocumentEncoder::OutputDontRemoveLineEndingSpaces` functionality. r=hsivonen Doesn't event seem to be used by comm-central/Thunderbird. Differential Revision: https://phabricator.services.mozilla.com/D42299
dom/base/nsIDocumentEncoder.idl
dom/base/nsPlainTextSerializer.cpp
dom/base/test/mochitest.ini
dom/base/test/test_bug902847.html
--- a/dom/base/nsIDocumentEncoder.idl
+++ b/dom/base/nsIDocumentEncoder.idl
@@ -193,21 +193,16 @@ interface nsIDocumentEncoder : nsISuppor
 
   /**
    * Output the content of non-text elements as the placehodler character
    * U+FFFC (OBJECT REPLACEMENT CHARACTER, only for serializing to plaintext).
    */
   const unsigned long OutputNonTextContentAsPlaceholder = (1 << 23);
 
   /**
-   * Don't Strip ending spaces from a line (only for serializing to plaintext).
-   */
-  const unsigned long OutputDontRemoveLineEndingSpaces = (1 << 24);
-
-  /**
    * Serialize in a way that is suitable for copying a plaintext version of the
    * document to the clipboard.  This can for example cause line endings to be
    * injected at preformatted block element boundaries.
    */
   const unsigned long OutputForPlainTextClipboardCopy = (1 << 25);
 
   /**
    * Include ruby annotations and ruby parentheses in the output.
--- a/dom/base/nsPlainTextSerializer.cpp
+++ b/dom/base/nsPlainTextSerializer.cpp
@@ -1342,17 +1342,16 @@ void nsPlainTextSerializer::EndLine(bool
 
   /* In non-preformatted mode, remove spaces from the end of the line for
    * format=flowed compatibility. Don't do this for these special cases:
    * "-- ", the signature separator (RFC 2646) shouldn't be touched and
    * "- -- ", the OpenPGP dash-escaped signature separator in inline
    * signed messages according to the OpenPGP standard (RFC 2440).
    */
   if (!(mFlags & nsIDocumentEncoder::OutputPreformatted) &&
-      !(mFlags & nsIDocumentEncoder::OutputDontRemoveLineEndingSpaces) &&
       (aSoftlinebreak || !(mCurrentLine.EqualsLiteral("-- ") ||
                            mCurrentLine.EqualsLiteral("- -- ")))) {
     // Remove spaces from the end of the line.
     while (currentlinelength > 0 &&
            mCurrentLine[currentlinelength - 1] == ' ') {
       --currentlinelength;
     }
     mCurrentLine.SetLength(currentlinelength);
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -578,17 +578,16 @@ skip-if = fission # Crashes: @ mozilla::
 [test_bug869002.html]
 [test_bug869006.html]
 [test_bug876282.html]
 [test_bug890580.html]
 [test_bug891952.html]
 [test_bug894874.html]
 [test_bug895239.html]
 [test_bug895974.html]
-[test_bug902847.html]
 [test_bug907892.html]
 fail-if = fission
 [test_bug913761.html]
 [test_bug922681.html]
 [test_bug927196.html]
 [test_bug962251.html]
 [test_bug976673.html]
 skip-if = fission # Times out in weird ways.
deleted file mode 100644
--- a/dom/base/test/test_bug902847.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=902847
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 902847</title>
-  <script src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript">
-  function testPaintextSerializerWithPlaceHolder() {
-
-    const de = SpecialPowers.Ci.nsIDocumentEncoder;
-    const Cc = SpecialPowers.Cc;
-
-    // Create a plaintext encoder.
-    var encoder = SpecialPowers.Cu.createDocumentEncoder("text/plain");
-    var flags = de.OutputRaw |
-                de.OutputLFLineBreak |
-                de.OutputDontRemoveLineEndingSpaces;
-    encoder.init(document, "text/plain", flags);
-
-    function toPlaintext(id) {
-      var element = document.getElementById(id);
-      var range = document.createRange();
-      range.selectNodeContents(element);
-      encoder.setRange(range);
-      return encoder.encodeToString().replace(/\n/g, '\\n')
-                                     .replace(/\r/g, '\\r');
-    }
-
-    // Test cases.
-    is(toPlaintext("case1"), "Hello \\nboy!", "Case 1 failed.");
-    is(toPlaintext("case2"), "Hello \\nboy!", "Case 2 failed.");
-    is(toPlaintext("case3"), "Hello \\nboy!", "Case 3 failed.");
-    is(toPlaintext("case4"), "Hello  \\nboy!", "Case 4 failed.");
-    SimpleTest.finish();
-  }
-
-  addLoadEvent(testPaintextSerializerWithPlaceHolder);
-  SimpleTest.waitForExplicitFinish();
-  </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=902847">Mozilla Bug 902847</a>
-<p id="display"></p>
-<div id="content">
-  <p id="case1">Hello <br>boy!</p>
-  <p id="case2">Hello  <br>boy!</p>
-  <p id="case3">Hello&nbsp;<br>boy!</p>
-  <p id="case4">Hello&nbsp;&nbsp;<br>boy!</p>
-</div>
-<pre id="test">
-</pre>
-</body>
-</html>