]> Cypherpunks repositories - gostls13.git/commitdiff
exp/html: allow frameset if body contains whitespace
authorAndrew Balholm <andybalholm@gmail.com>
Wed, 25 Jul 2012 02:09:58 +0000 (12:09 +1000)
committerNigel Tao <nigeltao@golang.org>
Wed, 25 Jul 2012 02:09:58 +0000 (12:09 +1000)
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

src/pkg/exp/html/parse.go
src/pkg/exp/html/testlogs/plain-text-unsafe.dat.log
src/pkg/exp/html/testlogs/tests19.dat.log

index 70c26c75f5d0d09e4a1b231ea14ba1b61d1186a0..393a97d2eedbd161ccf246f1543d6273e0c2616c 100644 (file)
@@ -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:
index 1d8aee842354cc404ec0725eb48116ee3716a4c4..80f6f92d06979ab17aebaa10a55a6c3744c73ba5 100644 (file)
@@ -1,9 +1,9 @@
 PASS "FOO&#x000D;ZOO"
 PASS "<html>\x00<frameset></frameset>"
-FAIL "<html> \x00 <frameset></frameset>"
+PASS "<html> \x00 <frameset></frameset>"
 PASS "<html>a\x00a<frameset></frameset>"
 PASS "<html>\x00\x00<frameset></frameset>"
-FAIL "<html>\x00\n <frameset></frameset>"
+PASS "<html>\x00\n <frameset></frameset>"
 FAIL "<html><select>\x00"
 PASS "\x00"
 PASS "<body>\x00"
index 61afadd73ddddbd98526b873f4242b7aa3d520cf..7025103d472fac124fa70f6469f62f6d0fe725ca 100644 (file)
@@ -45,7 +45,7 @@ PASS "<html><frameset></frameset></html><!doctype html>"
 PASS "<!doctype html><body><frameset>"
 PASS "<!doctype html><p><frameset><frame>"
 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><listing><frameset>"
 PASS "<!doctype html><li><frameset>"
@@ -72,7 +72,7 @@ PASS "<!doctype html><iframe></iframe><frameset>"
 PASS "<!doctype html><select></select><frameset>"
 PASS "<!doctype html><svg></svg><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> </svg><frameset><frame>"
 PASS "<html>aaa<frameset></frameset>"