Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(732)

Issue 46370043: code review 46370043: go.net/html: Tokenizer.Raw returns the original input w... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by piatek
Modified:
11 years, 2 months ago
Reviewers:
bradfitz
CC:
golang-codereviews, r, bradfitz
Visibility:
Public.

Description

go.net/html: Tokenizer.Raw returns the original input when tokenizer errors occur. Two tweaks enable this: 1) Updating the raw and data span pointers when Tokenizer.Next is called, even if an error has occurred. This prevents duplicate data from being returned by Raw in the common case of an EOF. 2) Treating '</>' as an empty comment token to expose the raw text as a tokenization event. (This matches the semantics of other non-token events, e.g., '</ >' is treated as '<!-- -->'.) Fixes issue 7029.

Patch Set 1 #

Patch Set 2 : diff -r 127da548775d http://code.google.com/p/go.net #

Patch Set 3 : diff -r 127da548775d http://code.google.com/p/go.net #

Patch Set 4 : diff -r 127da548775d http://code.google.com/p/go.net #

Total comments: 4

Patch Set 5 : diff -r 127da548775d http://code.google.com/p/go.net #

Total comments: 2

Patch Set 6 : diff -r 127da548775d http://code.google.com/p/go.net #

Unified diffs Side-by-side diffs Delta from patch set Stats (+28 lines, -11 lines) Patch
M html/token.go View 1 3 chunks +7 lines, -9 lines 0 comments Download
M html/token_test.go View 1 2 3 4 5 2 chunks +21 lines, -2 lines 0 comments Download

Messages

Total messages: 9
piatek
Hello golang-dev@googlegroups.com (cc: golang-codereviews@googlegroups.com), I'd like you to review this change to http://code.google.com/p/go.net
11 years, 2 months ago (2013-12-30 03:55:03 UTC) #1
gobot
Replacing golang-dev with golang-codereviews. To the author of this CL: If you are using 'hg ...
11 years, 2 months ago (2013-12-30 03:58:22 UTC) #2
piatek
Hello golang-codereviews@googlegroups.com, r@golang.org (cc: golang-codereviews@googlegroups.com), Please take another look.
11 years, 2 months ago (2014-01-02 17:29:03 UTC) #3
piatek
Rob, I've added you as a reviewer based on your reviews of previous changes. Please ...
11 years, 2 months ago (2014-01-02 17:30:38 UTC) #4
bradfitz
LGTM Nigel can propose an alternate fix later if he disagrees, but seems fine to ...
11 years, 2 months ago (2014-01-02 18:07:47 UTC) #5
piatek
https://codereview.appspot.com/46370043/diff/60001/html/token_test.go File html/token_test.go (right): https://codereview.appspot.com/46370043/diff/60001/html/token_test.go#newcode481 html/token_test.go:481: if _, err := parsed.Write(z.Raw()); err != nil { ...
11 years, 2 months ago (2014-01-02 18:38:15 UTC) #6
bradfitz
https://codereview.appspot.com/46370043/diff/80001/html/token_test.go File html/token_test.go (right): https://codereview.appspot.com/46370043/diff/80001/html/token_test.go#newcode486 html/token_test.go:486: t.Errorf("%s: parsed output:\ngot: %q\nwant: %q", test.desc, got, want) Add ...
11 years, 2 months ago (2014-01-02 18:39:50 UTC) #7
piatek
Thanks for the review. Will you submit? (I lack the permissions.) https://codereview.appspot.com/46370043/diff/80001/html/token_test.go File html/token_test.go (right): ...
11 years, 2 months ago (2014-01-02 18:43:16 UTC) #8
bradfitz
11 years, 2 months ago (2014-01-02 18:50:58 UTC) #9
*** Submitted as
https://code.google.com/p/go/source/detail?r=d4afe896f927&repo=net ***

go.net/html: Tokenizer.Raw returns the original input when tokenizer errors
occur.

Two tweaks enable this:
1) Updating the raw and data span pointers when Tokenizer.Next is called, even
if an error has occurred. This prevents duplicate data from being returned by
Raw in the common case of an EOF.

2) Treating '</>' as an empty comment token to expose the raw text as a
tokenization event. (This matches the semantics of other non-token events,
e.g., '</ >' is treated as '<!-- -->'.)

Fixes issue 7029.

R=golang-codereviews, r, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/46370043

Committer: Brad Fitzpatrick <bradfitz@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b