"View Selection Source" generates XHTML, which is then (incorrectly) syntax highlighted.

RESOLVED FIXED in Firefox 11

Status

()

defect
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: henry.fai.hang.chan, Assigned: hsivonen)

Tracking

({regression})

Trunk
mozilla12
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox10- affected, firefox11- verified, firefox12+ verified, firefox-esr10- affected)

Details

(Whiteboard: [qa+][qa!:11][qa!:12])

Attachments

(3 attachments)

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0a1) Gecko/20111227 Firefox/12.0a1
Build ID: 20111227031015

Steps to reproduce:

Select and view source an HTML document.


Actual results:

The first element has a xmlns="http://www.w3.org/1999/xhtml" attribute appended.
iframes are self closing (/>) and thus text after it fails to be highlighted correctly in the html5 syntax highlighter.


Expected results:

text/html view source should dump html5 code.
text/xml view source should dump xml code.
Seems to be caused by selfclosing elements. Such as <script/> and <a/> on this page.

I have no idea why there's a selfclosing 'a' element, but there is
it happens everywhere even on html5 validating pages which don't ever have /> in them.  The view selection source code generator is dumping xhtml code at the wrong time.
Depends on: 650895
There is a new View source parser in Firefox 11 or 12 (bug 482921).

Can you provide some sample URL where this happens?

Is this the same as bug 503039?
Component: General → View Source
Depends on: 482921
Product: Firefox → Toolkit
QA Contact: general → view.source
Posted file testcase
Mozilla/5.0 (Windows NT 5.1; rv:12.0a1) Gecko/20111227 Firefox/12.0a1

Confirming with the attached testcase
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Summary: View Selection Source generates XHTML, which is then (incorrectly) syntax highlighted. → "View Selection Source" generates XHTML, which is then (incorrectly) syntax highlighted.
@aceman
this is firefox 12.  seen on firefox 11 as well.

@aceman and @jj
I meant about HTML5 documents showing up XHTML markup (and forced appending of XHTML attributes when they didn't exist in original document).
Attachment #585182 - Attachment mime type: text/plain → text/html
==Action 1==
Result of testcase:
the <html> becomes <html xmlns="http://www.w3.org/1999/xhtml">
iframe becomes self closing
syntax not highlighted after iframe.

Expected result:
no attribute appended (it's not even there in firebug or web inspector.)
iframe is not self closing.
syntax highlighted after iframe.

==Action2==
Result:
<div xmlns="http://www.w3.org/1999/xhtml">Select All, and then View Selection Source.</div>

Expected Result: 
<div>Select All, and then View Selection Source.</div>

This bug is about HTML spitting out as XHTML, then incorrect syntax highlighting.
This is odd. The View Source changes shouldn't have affected the serialization step in View Selection Source.
My wild guess is that this bug was caused by correctness fixes to createDocument() rather than changes to the View Source back end.

As usual with front end code, I have no clue what kind of unit test this should have.
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Attachment #589477 - Flags: review?(gavin.sharp)
OS: Windows 7 → All
Hardware: x86 → All
Version: 12 Branch → Trunk
Attachment #589477 - Flags: review?(gavin.sharp) → review+
https://hg.mozilla.org/mozilla-central/rev/d0db3841139c
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
No need to track for FF10/11. We'd consider uplifting for FF11 Aurora if nominated, but this bug does not need to be tracked for release. The "Page Source" Web Developer tool still has proper highlighting.
Comment on attachment 589477 [details] [diff] [review]
Use the HTMLness mode of the original doc for the serialization

[Approval Request Comment]
Regression caused by (bug #): Unknown. Something that changed document.createDocument() most likely.
User impact if declined: View Selection Source looks wrong for HTML documents.
Testing completed (on m-c, etc.): Has baked on m-c without complaints.
Risk to taking this patch (and alternatives if risky): Very low risk.
Attachment #589477 - Flags: approval-mozilla-aurora?
Comment on attachment 589477 [details] [diff] [review]
Use the HTMLness mode of the original doc for the serialization

[Triage Comment]
Recent regression and low risk - approved for Aurora.
Attachment #589477 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Whiteboard: [qa+]
Minusing for tracking-esr10. It's affected, but we will not fix minor functional regressions unless they affect enterprise users significantly.
(In reply to Alex Keybl [:akeybl] from comment #13)
> The "Page Source" Web Developer tool still has proper highlighting.

"View Selection Source" is a snapshot of current DOM and is partly unrelated to "Page source".
Depends on: 728655
(In reply to henry.fai.hang.chan from comment #8)
> ==Action 1==
> Result of testcase:
> the <html> becomes <html xmlns="http://www.w3.org/1999/xhtml">
> iframe becomes self closing
> syntax not highlighted after iframe.
> 
> Expected result:
> no attribute appended (it's not even there in firebug or web inspector.)
> iframe is not self closing.
> syntax highlighted after iframe.
> 
> ==Action2==
> Result:
> <div xmlns="http://www.w3.org/1999/xhtml">Select All, and then View
> Selection Source.</div>
> 
> Expected Result: 
> <div>Select All, and then View Selection Source.</div>
> 
> This bug is about HTML spitting out as XHTML, then incorrect syntax
> highlighting.

FF 11b3: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0

Action 1 - the issue is still reproducible
<html xmlns="http://www.w3.org/1999/xhtml">

Action 2 - the issue is not reproducible
<div>Select All, and then View Selection Source.</div>

Same results on FF 12.
(In reply to Paul Silaghi [QA] from comment #19)
> Action 1 - the issue is still reproducible
> <html xmlns="http://www.w3.org/1999/xhtml">

The source of the test case actually contains xmlns="http://www.w3.org/1999/xhtml"
(In reply to Henri Sivonen (:hsivonen) from comment #20)
> (In reply to Paul Silaghi [QA] from comment #19)
> > Action 1 - the issue is still reproducible
> > <html xmlns="http://www.w3.org/1999/xhtml">
> 
> The source of the test case actually contains
> xmlns="http://www.w3.org/1999/xhtml"

Indeed, there is no xmlns attribute appended.
But there is still one difference:
test case:             <div style="height:2em;background:gold"></div>
view selection source: <div style="height: 2em; background: none repeat scroll 0% 0% gold;"></div>
What do you think?
(In reply to Paul Silaghi [QA] from comment #21)
> Indeed, there is no xmlns attribute appended.
> But there is still one difference:
> test case:             <div style="height:2em;background:gold"></div>
> view selection source: <div style="height: 2em; background: none repeat
> scroll 0% 0% gold;"></div>
> What do you think?

That is a separate bug outside the scope of this bug.
Verified fixed on FF 11b4:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0
Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0

New bug 731172 filed.
Whiteboard: [qa+] → [qa+][qa!:11]
Verified fixed on FF 12b1:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0
Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20100101 Firefox/12.0
Whiteboard: [qa+][qa!:11] → [qa+][qa!:11][qa!:12]
You need to log in before you can comment on or make changes to this bug.