Commit 4d225196 authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

exp/html: allow frameset if body contains whitespace

If the body of an HTML document contains text, the <frameset> 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
parent 3e980e24
...@@ -725,7 +725,10 @@ func inBodyIM(p *parser) bool { ...@@ -725,7 +725,10 @@ func inBodyIM(p *parser) bool {
} }
p.reconstructActiveFormattingElements() p.reconstructActiveFormattingElements()
p.addText(d) p.addText(d)
p.framesetOK = false if p.framesetOK && strings.TrimLeft(d, whitespace) != "" {
// There were non-whitespace characters inserted.
p.framesetOK = false
}
case StartTagToken: case StartTagToken:
switch p.tok.DataAtom { switch p.tok.DataAtom {
case a.Html: case a.Html:
......
PASS "FOO&#x000D;ZOO" PASS "FOO&#x000D;ZOO"
PASS "<html>\x00<frameset></frameset>" PASS "<html>\x00<frameset></frameset>"
FAIL "<html> \x00 <frameset></frameset>" PASS "<html> \x00 <frameset></frameset>"
PASS "<html>a\x00a<frameset></frameset>" PASS "<html>a\x00a<frameset></frameset>"
PASS "<html>\x00\x00<frameset></frameset>" PASS "<html>\x00\x00<frameset></frameset>"
FAIL "<html>\x00\n <frameset></frameset>" PASS "<html>\x00\n <frameset></frameset>"
FAIL "<html><select>\x00" FAIL "<html><select>\x00"
PASS "\x00" PASS "\x00"
PASS "<body>\x00" PASS "<body>\x00"
......
...@@ -45,7 +45,7 @@ PASS "<html><frameset></frameset></html><!doctype html>" ...@@ -45,7 +45,7 @@ PASS "<html><frameset></frameset></html><!doctype html>"
PASS "<!doctype html><body><frameset>" PASS "<!doctype html><body><frameset>"
PASS "<!doctype html><p><frameset><frame>" PASS "<!doctype html><p><frameset><frame>"
PASS "<!doctype html><p>a<frameset>" PASS "<!doctype html><p>a<frameset>"
FAIL "<!doctype html><p> <frameset><frame>" PASS "<!doctype html><p> <frameset><frame>"
PASS "<!doctype html><pre><frameset>" PASS "<!doctype html><pre><frameset>"
PASS "<!doctype html><listing><frameset>" PASS "<!doctype html><listing><frameset>"
PASS "<!doctype html><li><frameset>" PASS "<!doctype html><li><frameset>"
...@@ -72,7 +72,7 @@ PASS "<!doctype html><iframe></iframe><frameset>" ...@@ -72,7 +72,7 @@ PASS "<!doctype html><iframe></iframe><frameset>"
PASS "<!doctype html><select></select><frameset>" PASS "<!doctype html><select></select><frameset>"
PASS "<!doctype html><svg></svg><frameset><frame>" PASS "<!doctype html><svg></svg><frameset><frame>"
PASS "<!doctype html><math></math><frameset><frame>" PASS "<!doctype html><math></math><frameset><frame>"
FAIL "<!doctype html><svg><foreignObject><div> <frameset><frame>" PASS "<!doctype html><svg><foreignObject><div> <frameset><frame>"
PASS "<!doctype html><svg>a</svg><frameset><frame>" PASS "<!doctype html><svg>a</svg><frameset><frame>"
PASS "<!doctype html><svg> </svg><frameset><frame>" PASS "<!doctype html><svg> </svg><frameset><frame>"
PASS "<html>aaa<frameset></frameset>" PASS "<html>aaa<frameset></frameset>"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment