Closed Bug 479959 Opened 16 years ago Closed 13 years ago

[HTML5] Re-implement text/plain loading using the HTML5 tokenizer

Categories

(Core :: DOM: HTML Parser, defect, P3)

Other Branch
defect

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: hsivonen, Assigned: hsivonen)

References

(Blocks 1 open bug)

Details

(Keywords: html5)

Attachments

(1 file, 2 obsolete files)

Whoever is going to work on this could try to fix bug 369301 (or the issue it's a dupe of) at the same time.
Assignee: hsivonen → nobody
Attached patch Reimplement text/plain (obsolete) (deleted) — Splinter Review
What test cases should I write for this (if any)?
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Attachment #530600 - Flags: review?(jonas)
Blocks: 655434
Attached patch Reimplement text/plain, v2 (obsolete) (deleted) — Splinter Review
This patch fixes a wrong logical operator and increases the timeout on a test that uses setTimeout to poke a document loaded from a data: URL.
Attachment #531031 - Flags: review?(jonas)
Attached patch Reimplement text/plain, rebased (deleted) — Splinter Review
Attachment #530600 - Attachment is obsolete: true
Attachment #531031 - Attachment is obsolete: true
Attachment #567087 - Flags: review?(Olli.Pettay)
Attachment #530600 - Flags: review?(jonas)
Attachment #531031 - Flags: review?(jonas)
Comment on attachment 567087 [details] [diff] [review] Reimplement text/plain, rebased ># HG changeset patch ># Parent e4bbf1e529e9249dc01a6810e769fbf462514894 >Bug 479959 - Reimplement text/plain loading using the HTML5 parser. r=NOT_REVIEWED. > >diff --git a/content/base/test/chrome/test_bug430050.xul b/content/base/test/chrome/test_bug430050.xul >--- a/content/base/test/chrome/test_bug430050.xul >+++ b/content/base/test/chrome/test_bug430050.xul >@@ -31,17 +31,17 @@ https://bugzilla.mozilla.org/show_bug.cg > document.documentElement.addEventListener('DOMAttrModified', > function(evt) { > if (evt.target == evt.currentTarget) { > document.getElementById('b').setAttribute("src", > "data:text/plain,failed"); > document.getElementById('b').loadURI('data:text/plain,succeeded', > null, > 'UTF-8'); >- setTimeout(endTest, 0); >+ setTimeout(endTest, 100); Why this change? Looks pretty error prone. Perhaps the test should use load event listener and not timeout at all. > nsHTMLDocument::StartDocumentLoad(const char* aCommand, > nsIChannel* aChannel, > nsILoadGroup* aLoadGroup, > nsISupports* aContainer, > nsIStreamListener **aDocListener, > bool aReset, > nsIContentSink* aSink) > { >+ nsCAutoString contentType; >+ aChannel->GetContentType(contentType); >+ > bool viewSource = aCommand && !nsCRT::strcmp(aCommand, "view-source") && > NS_USE_NEW_VIEW_SOURCE; >- bool loadAsHtml5 = nsHtml5Module::sEnabled || viewSource; >+ bool plainText = (contentType.EqualsLiteral(TEXT_PLAIN) || >+ contentType.EqualsLiteral(TEXT_CSS) || >+ contentType.EqualsLiteral(APPLICATION_JAVASCRIPT) || >+ contentType.EqualsLiteral(APPLICATION_XJAVASCRIPT) || >+ contentType.EqualsLiteral(TEXT_ECMASCRIPT) || >+ contentType.EqualsLiteral(APPLICATION_ECMASCRIPT) || >+ contentType.EqualsLiteral(TEXT_JAVASCRIPT)); I was wondering whether this should be in a helper method in nsContentUtils, but since the old parser is going away, there shouldn't be any need. >@@ -878,17 +884,17 @@ nsHtml5StreamParser::OnStartRequest(nsIR > NS_ASSERTION(!mLastBuffer, "How come we have the last buffer set?"); > mFirstBuffer = mLastBuffer = newBuf; > > nsresult rv = NS_OK; > > // The line below means that the encoding can end up being wrong if > // a view-source URL is loaded without having the encoding hint from a > // previous normal load in the history. >- mReparseForbidden = !(mMode == NORMAL); >+ mReparseForbidden = !(mMode == NORMAL || mMode == PLAIN_TEXT); I'd write this mMode != NORMAL && mMode != PLAIN_TEXT. But either way is ok. >+void StartPlainText(); >+ So there is no EndPlainText(). StartPlainText() sounds a bit strange. Could you add some comment about that, or rename StartPlainText(). r=me if the test is fixed. I think adding a load event listener to the <browser> element should work there.
Attachment #567087 - Flags: review?(Olli.Pettay) → review+
Thanks. Landed with the test changed to use a load listener on <browser>. https://hg.mozilla.org/integration/mozilla-inbound/rev/9a0ef50b48d3
Target Milestone: --- → mozilla10
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Depends on: 702104
Depends on: 702212
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: