Closed Bug 832589 Opened 11 years ago Closed 11 years ago

B2G reftest runs have errors like "E/GeckoConsole( 812): [JavaScript Error: "The character encoding of the HTML document was not declared..." between each test, from data URI for "<!--CLEAR-->"

Categories

(Testing :: Reftest, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla21

People

(Reporter: dholbert, Assigned: dholbert)

Details

Attachments

(1 file)

When glancing at an Android reftest run, I noticed lines like these between each test:
{
16:38:02     INFO -  E/GeckoConsole(  812): [JavaScript Error: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." {file: "data:text/html,%3C%21%2D%2DCLEAR%2D%2D%3E" line: 0}]
}
https://tbpl.mozilla.org/php/getParsedLog.php?id=18943080&tree=Mozilla-Inbound 

That is for data:text/html,<!--CLEAR-->, which is hardcoded into the reftest harness to be loaded between each test. Sure enough, If I load that URI directly, I get a similar error spammed to the error console.

If I add <meta charset="UTF-8"> after <!--CLEAR-->, there's no error reported. I suggest we add this to the hardcoded URI in reftest.js, so that we save 1 line of JS-error-spam per test, in each reftest log.
Attached patch fix v1Splinter Review
This replaces <!--CLEAR--> with the following document:
<!DOCTYPE html><meta charset="UTF-8"><!--CLEAR-->

I added the DOCTYPE as well because view-source was complaining at me (highlighting <meta> in red) if I didn't declare a doctype. With that and the <meta> tag, both view-source and the error console are happy with this, so I think it should silence the JS-error-output.
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #704184 - Flags: review?(dbaron)
Comment on attachment 704184 [details] [diff] [review]
fix v1

With data URIs, I'd rather have the charset in the MIME type than in the contents, i.e., the properly-escaped version of:

data:text/html;charset=UTF-8,<!DOCTYPE HTML><!--CLEAR-->

r=dbaron with that (assuming it works)
Attachment #704184 - Flags: review?(dbaron) → review+
That's cleaner, thanks! We won't need <!DOCTYPE html> after all then -- that was only to make the parser happy about the <meta> tag.

Also, it looks like semicolon, equals, dash, and comma characters in ";charset=UTF-8," have to be unescaped, or else it's not recognized (we still post an error-console warning and/or the page pops up a 'save' dialog because it doesn't get to correctly parsing the mimetype).  So I've left those unescaped.

So, the fix is literally to just insert ";charset=UTF-8" into the hardcoded string, just before the comma.

I'll push that later today.
Try run, for the same platform/test-run as in comment 0, w/ the patch applied, has no character encoding errors reported, so I think that demonstrates that this works:
  https://tbpl.mozilla.org/php/getParsedLog.php?id=18965437&tree=Try
(Incidentally, I misspoke in comment 0 -- this is for b2g test-runs, not Android test-runs)
Summary: On Android, reftest runs trigger "E/GeckoConsole( 812): [JavaScript Error: "The character encoding of the HTML document was not declared..." between each test, from data URI for "<!--CLEAR-->" → B2G reftest runs have errors like "E/GeckoConsole( 812): [JavaScript Error: "The character encoding of the HTML document was not declared..." between each test, from data URI for "<!--CLEAR-->"
Version: unspecified → Trunk
https://hg.mozilla.org/mozilla-central/rev/1d122eaa9070
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: