From 4d2251967847cf9b710da09525c676a7e733113d Mon Sep 17 00:00:00 2001 From: Andrew Balholm Date: Wed, 25 Jul 2012 12:09:58 +1000 Subject: [PATCH] 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 --- src/pkg/exp/html/parse.go | 5 ++++- src/pkg/exp/html/testlogs/plain-text-unsafe.dat.log | 4 ++-- src/pkg/exp/html/testlogs/tests19.dat.log | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) 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" -- 2.48.1