From: Andrew Balholm Date: Fri, 27 Jul 2012 06:05:25 +0000 (+1000) Subject: exp/html: parse CDATA sections in foreign content X-Git-Tag: go1.1rc2~2770 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a1f340fa1a26fd29f1369cbc91755e7519813dd0;p=gostls13.git exp/html: parse CDATA sections in foreign content Also convert NUL to U+FFFD in comments. Pass 23 additional tests. R=nigeltao CC=golang-dev https://golang.org/cl/6446055 --- diff --git a/src/pkg/exp/html/parse.go b/src/pkg/exp/html/parse.go index 82edb2263f..986e9bbe46 100644 --- a/src/pkg/exp/html/parse.go +++ b/src/pkg/exp/html/parse.go @@ -390,6 +390,10 @@ func (p *parser) reconstructActiveFormattingElements() { // read reads the next token from the tokenizer. func (p *parser) read() error { + // CDATA sections are allowed only in foreign content. + n := p.oe.top() + p.tokenizer.cdataOK = n != nil && n.Namespace != "" + p.tokenizer.Next() p.tok = p.tokenizer.Token() if p.tok.Type == ErrorToken { diff --git a/src/pkg/exp/html/testlogs/plain-text-unsafe.dat.log b/src/pkg/exp/html/testlogs/plain-text-unsafe.dat.log index 65ee908f55..b63a237a15 100644 --- a/src/pkg/exp/html/testlogs/plain-text-unsafe.dat.log +++ b/src/pkg/exp/html/testlogs/plain-text-unsafe.dat.log @@ -8,9 +8,9 @@ PASS "