Open Bug 1611756 Opened 6 years ago Updated 3 years ago

Save as Web Page, Complete adds meta charset tag when it's already present

Categories

(Core :: DOM: Serializers, defect, P5)

72 Branch
defect

Tracking

()

People

(Reporter: u655930, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36

Steps to reproduce:

  1. I created an html5 page file with the updated charset tag:
    <meta charset="UTF-8">
  2. Note that this tag:
    a) Is the short method;
    b) Is the standard html5 specification to reduce file size and bandwidth;
    c) Is used in the source code of most html5 sites, examples: bugzilla.mozilla.org and www.google.com;
    d) See www.w3schools.com/tags/att_meta_charset.asp for more information.
  3. I opened the page using Firefox.
  4. Open the context menu and click on the option "View Page Info".
  5. I saved the page locally using the "Web page, complete" option.

Actual results:

  1. When opening the "View Page Info" context menu option:
    a) The browser recognizes the <meta charset = "UTF-8"> tag, but the values are not displayed correctly because the tag is short and does not have the attributes "name" and "content";
    b) Then there is an error and a blank space is displayed.

  2. When saving the page locally, the browser simply ignores the charset tag of the new html5 specification and adds the old charset tag, resulting in two different charset tags and an error in the code:
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">

Expected results:

  1. The browser, by clicking on the "View Page Info" context menu option:
    a) Recognize that the tag name is "charset";
    b) Recognize that the tag value is "UTF-8".

  2. The browser, when saving the page locally using the "Web page, complete" option:
    a) Do not add the old charset tag:
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    b) Keep the html5 charset tag:
    <meta charset="UTF-8">

OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64

Seems duplication of Bug 584285

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0
20200117190643

STR:

  1. Ctrl+S.
  2. Save as Web Page, complete.

Actual results:
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> is added to the document although <meta charset="UTF-8"> is already present.

Expected results:
Either <meta http-equiv="content-type" content="text/html; charset=UTF-8"> is not added to the document or <meta charset="UTF-8"> is removed at the same time.

(In reply to Alice0775 White from comment #1)

Seems duplication of Bug 584285

That's for the blank line in the Page Info window. There's no existing report for the save bug that I could find.

Status: UNCONFIRMED → NEW
Has STR: --- → yes
Component: Untriaged → DOM: Serializers
Ever confirmed: true
OS: Windows 10 → Unspecified
Product: Firefox → Core
Hardware: x86_64 → Unspecified
See Also: → 331991
Summary: Charset tag problem while saving a page locally or view page info → Save as Web Page, Complete adds meta charset tag when it's already present

Sounds like that this does not cause any inconvenience for users actually. So, setting P5, but Mirko may change it if this is more serious than I think.

Flags: needinfo?(mbrodesser)
Priority: -- → P5

I agree with Masayuki's comment.

I couldn't reproduce the issue with neither Firefox 72.0.2. nor with 73.0b12 on Ubuntu 18.04.

Flags: needinfo?(mbrodesser)
See Also: 331991

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0
20200229214828

Why did you clear the See Also field? The bug that introduced this feature is relevant (though it might fit better in the Blocks field).

(In reply to Mirko Brodesser (:mbrodesser) (PTO until 1st of March) from comment #4)

I couldn't reproduce the issue with neither Firefox 72.0.2. nor with 73.0b12 on Ubuntu 18.04.

Both bugs are still reproducible in the latest Nightly on Windows as described at comment 2.

Assignee: nobody → sciguyryan
Status: NEW → ASSIGNED

From what I can see issue 1 is no longer an issue now.

Issue 2 is still present and should be simple enough to fix.

My plan is to simply skip serialization of any <meta http-equiv="content-type" ...> tags present if mRewriteEncodingDeclaration is set. I also plan on switching the meta appending code to either append or update the <meta charset="..."> tag instead. It seems more fitting these days, it's shorter and cleaner.

I hope to have some time to look at this tomorrow.

The bug assignee didn't login in Bugzilla in the last 7 months.
:hsinyi, could you have a look please?
For more information, please visit auto_nag documentation.

Assignee: sciguyryan → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(htsai)
Flags: needinfo?(htsai)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: