author | Alastor Wu <alwu@mozilla.com> |
Tue, 19 Jul 2016 16:30:57 +0800 | |
changeset 389453 | a3d0814f0b4580b47991bd62610d38d2465b19eb |
parent 389452 | 3cbf04dbd22445f0900ce1ae0941ee6bf3f19c9a |
child 389454 | db604e5efb3f38f37ecd5dd6f62b7674f0089c88 |
push id | 23406 |
push user | alwu@mozilla.com |
push date | Tue, 19 Jul 2016 09:08:14 +0000 |
bugs | 1283803 |
milestone | 50.0a1 |
--- a/dom/media/webvtt/vtt.jsm +++ b/dom/media/webvtt/vtt.jsm @@ -172,17 +172,17 @@ this.EXPORTED_SYMBOLS = ["WebVTT"]; // 4.1 WebVTT timestamp function consumeTimeStamp() { var ts = collectTimeStamp(input); if (ts === null) { throw new ParsingError(ParsingError.Errors.BadTimeStamp, "Malformed timestamp: " + oInput); } // Remove time stamp from input. - input = input.replace(/^[^\sa-zA-Z-]+/, ""); + input = input.replace(/^[^\s\uFFFDa-zA-Z-]+/, ""); return ts; } // 4.4.2 WebVTT cue settings function consumeCueSettings(input, cue) { var settings = new Settings(); parseOptions(input, function (k, v) { @@ -1261,17 +1261,18 @@ this.EXPORTED_SYMBOLS = ["WebVTT"]; // Advance the buffer early in case we fail below. if (buffer[pos] === '\r') { ++pos; } if (buffer[pos] === '\n') { ++pos; } self.buffer = buffer.substr(pos); - return line; + // Spec defined replacement. + return line.replace(/[\u0000]/g, "\uFFFD"); } function createCueIfNeeded() { if (!self.cue) { self.cue = new self.window.VTTCue(0, 0, ""); } }