[Webkit-unassigned] [Bug 58542] New: Loading a Javascript file causes erroneous DOM information on first load

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 14 07:34:39 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=58542

           Summary: Loading a Javascript file causes erroneous DOM
                    information on first load
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows 7
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: claus.tondering at gmail.com


Created an attachment (id=89580)
 --> (https://bugs.webkit.org/attachment.cgi?id=89580&action=review)
.pro, .cpp, and .h file to demonstrate the problem

Briefly: The first time an HTML page containing a <script src=...> tag is loaded into a QWebView, the methods documentElement() and findAllElements() return errorneous data. On subsequent loads referring to the same Javascript file, the methods work correctly.

(This problem occurs in Qt WebKit version 4.7.0 which gives the WEBKIT_MAJOR_VERSION as 533.)

To reproduce the error:

* Build the enclosed Qt program. (I'm using the MinGW compiler.)
* Create an empty file called /tmp/webkitbug.js. (As far as I can tell, the contents of this file is unimportant for the bug.)
* Run the program from a command line. The program writes to standard output (std::cout), so it is important that you can see the output it produces.
* In the program's window, select the menu item "Show bug" | "Load".

This will cause the following HTML code to be loaded into the main window: 

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
      <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
      <title>WebKit Bug</title>
      <script type="text/javascript" src="file:///tmp/webkitbug.js"></script>
    </head>
    <body>
     <p>Hello world</p>
    </body>
    </html>


* The program writes this to standard output:

    OUTER XML IS:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">  <title>WebKit Bug</title>  <script type="text/javascript" src="file:///tmp/webkitbug.js"></script></head></html>
Web page contains 0 elements of type p

Notice that the content of the <body>...</body> is missing from the output, and that the program has not recognized the <p> tag.

* Once again: Select the menu item "Show bug" | "Load" to load the same HTML code again.

* The program writes this to standard output:

    OUTER XML IS:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">  <title>WebKit Bug</title>  <script type="text/javascript" src="file:///tmp/webkitbug.js"></script></head><body> <p>Hello world</p></body></html>
    Web page contains 1 elements of type p

Now the <body>...</body> is included and the <p> tag has been recognized.

* Close the program.
* Open the file webkitbug.cpp in an editor and remove the <script>...</script> line from the HTML code.
* Rebuild and run the program.
* The error has now gone away!

Further observations:

* If the second loading uses different HTML but with the same Javascript file, it prints correct information.
* If the second loading uses the same HTML except that it loads a different Javascript file, it prints erroneous information.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list