From: Andrew Balholm Date: Wed, 25 Jul 2012 02:09:58 +0000 (+1000) Subject: exp/html: allow frameset if body contains whitespace X-Git-Tag: go1.1rc2~2780 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=4d2251967847cf9b710da09525c676a7e733113d;p=gostls13.git exp/html: allow frameset if body contains whitespace If the body of an HTML document contains text, the tag is ignored. But not if the text is only whitespace. Pass 4 additional tests. R=nigeltao CC=golang-dev https://golang.org/cl/6442043 --- diff --git a/src/pkg/exp/html/parse.go b/src/pkg/exp/html/parse.go index 70c26c75f5..393a97d2ee 100644 --- a/src/pkg/exp/html/parse.go +++ b/src/pkg/exp/html/parse.go @@ -725,7 +725,10 @@ func inBodyIM(p *parser) bool { } p.reconstructActiveFormattingElements() p.addText(d) - p.framesetOK = false + if p.framesetOK && strings.TrimLeft(d, whitespace) != "" { + // There were non-whitespace characters inserted. + p.framesetOK = false + } case StartTagToken: switch p.tok.DataAtom { case a.Html: 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 1d8aee8423..80f6f92d06 100644 --- a/src/pkg/exp/html/testlogs/plain-text-unsafe.dat.log +++ b/src/pkg/exp/html/testlogs/plain-text-unsafe.dat.log @@ -1,9 +1,9 @@ PASS "FOO ZOO" PASS "\x00" -FAIL " \x00 " +PASS " \x00 " PASS "a\x00a" PASS "\x00\x00" -FAIL "\x00\n " +PASS "\x00\n " FAIL "" PASS "" PASS "" -FAIL "
" +PASS "
" PASS "a" PASS " " PASS "aaa"