Bug 256253 - HTML page load failure when javascript inside <script> includes && and xmlns is specified xhtml only on ubuntu
Summary: HTML page load failure when javascript inside <script> includes && and xmlns ...
Status: RESOLVED DUPLICATE of bug 232471
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: Unspecified Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-03 06:55 PDT by Terry Knowlton
Modified: 2023-05-03 07:48 PDT (History)
2 users (show)

See Also:


Attachments
html file that fails to load on Ubuntu 22.04 (290 bytes, text/html)
2023-05-03 06:55 PDT, Terry Knowlton
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Terry Knowlton 2023-05-03 06:55:29 PDT
Created attachment 466192 [details]
html file that fails to load on Ubuntu 22.04

There is an issue loading some pages on Ubuntu 22.04 but load correctly in Safari and other WebKit browsers on MacOS, as well as other browsers and platforms.

When loading an html page with

<html xmlns="http://www.w3.org/1999/xhtml"> root tag, it appears that javascript inlined within a <script> tag is not being properly parsed and ampersand (&) symbols are attempting parse as escaped html. Instead of loading the page I get "error on line {x} at column {y}: xmlParseEntityRef: no name" where the line and column are the second & symbol.


Below is some example html that demonstrates this issue.  I have also attached the html file to this report. 

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>ubuntu webkit redering</title>
    <script type="text/javascript">
      if (1 === 1 && 1 != 2) {
        console.log("Parsed!");
      }
    </script>
  </head>
  <body>
    <h1>Page loaded successfully</h1>
  </body>
</html>
Comment 1 Michael Catanzaro 2023-05-03 07:05:02 PDT
Your attachment actually gets parsed as HTML for me. What version of WebKitGTK? What version of shared-mime-info?

You have the strings "xmlns" and "xhtml" in the first line of the input, so it's pretty reasonable for WebKit to treat the input as XHTML, and then the error is required because it is not valid XHTML. Remove that and it will probably work? Or you could try adding an HTML DOCTYPE.
Comment 2 Michael Catanzaro 2023-05-03 07:07:23 PDT

*** This bug has been marked as a duplicate of bug 232471 ***
Comment 3 Terry Knowlton 2023-05-03 07:24:45 PDT
(In reply to Michael Catanzaro from comment #1)
> Your attachment actually gets parsed as HTML for me. What version of
> WebKitGTK? What version of shared-mime-info?
> 
> You have the strings "xmlns" and "xhtml" in the first line of the input, so
> it's pretty reasonable for WebKit to treat the input as XHTML, and then the
> error is required because it is not valid XHTML. Remove that and it will
> probably work? Or you could try adding an HTML DOCTYPE.

It does work if I remove it. The problem for me is I only have read access to the html files and I am validating cross browser and cross platform compatibility which only appears to be failing for webkit on ubuntu in this particular case.
Comment 4 Michael Catanzaro 2023-05-03 07:48:50 PDT
For avoidance of doubt: that input is malformed, and you cannot expect it to do the same thing on different platforms. Sorry. :(