Bug 1328966 - Accept \r as a valid line ending. r?alwu draft
authorRalph Giles <giles@mozilla.com>
Thu, 12 Jan 2017 11:20:26 -0800
changeset 460837 1abfe78dcc68c2e21adeba8577e60956bc6ea2a8
parent 460673 de67fccc4c64a49f261aea29141357b94c7b3b9c
child 542156 eedc57ba93d30e0f4c28dbc597f0e1969f82a148
push id41511
push userbmo:giles@thaumas.net
push dateFri, 13 Jan 2017 23:12:25 +0000
reviewersalwu
bugs1328966
milestone53.0a1
Bug 1328966 - Accept \r as a valid line ending. r?alwu See https://w3c.github.io/webvtt/#webvtt-line-terminator for allowed values. MozReview-Commit-ID: C62Lu4PNQRE
dom/media/webvtt/vtt.jsm
--- a/dom/media/webvtt/vtt.jsm
+++ b/dom/media/webvtt/vtt.jsm
@@ -1433,17 +1433,17 @@ this.EXPORTED_SYMBOLS = ["WebVTT"];
         if (self.state === "HEADER") {
           line = parseHeader();
         }
 
         while (self.buffer) {
           if (!line) {
             // Since the data receiving is async, we need to wait until the
             // buffer gets the full line.
-            if (!/\r\n|\n/.test(self.buffer)) {
+            if (!/\r\n|\n|\r/.test(self.buffer)) {
               return this;
             }
             line = collectNextLine();
           }
 
           switch (self.state) {
           case "ID":
             // Ignore NOTE and line terminator