Bug 17444

Summary: nested script inside external script cause error
Product: WebKit Reporter: johnnyding <johnnyding.webkit>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, darin, vincent.bradley
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
html file for this test case
none
script file for this test case
none
patch v1 for fixing this problem
darin: review+
it's basically same patch as patch v1, only change the wording in test case according to darin's comment darin: review+

Description johnnyding 2008-02-20 02:06:25 PST
nest script which is inside external script will cause error. Please see attached test cases.
Comment 1 johnnyding 2008-02-20 02:07:53 PST
Created attachment 19222 [details]
html file for this test case
Comment 2 johnnyding 2008-02-20 02:08:26 PST
Created attachment 19223 [details]
script file for this test case
Comment 3 johnnyding 2008-02-20 02:40:39 PST
Download both html file and script file to your local file system. The expected behavior is to display 'external_script_1', but 'put_content("external_script_1")" is displayed instead.

This is because, in HTMLTokenizer::write(HTMLTokenizer.cpp line:1345), the code checks 'pendingScripts.isEmpty()' to decide whether to save prependingSrc or not. However, in HTMLTokenizer::scriptHandler(HTMLTokenizer.cpp line:485) and HTMLTokenizer::scriptExecution(HTMLTokenizer.cpp line:544), the code checks testBit:LoadingExtScript to decide whether to save prependingSrc or not. The later behavior is not right because, in scriptHandler and scriptExecution, even the pendingScripts queue is empty, the testBit:LoadingExtScript might be TRUE, (it may not be updated until the end of the function).

A patch is coming soon.
Comment 4 johnnyding 2008-02-20 06:26:15 PST
Created attachment 19226 [details]
patch v1 for fixing this problem
Comment 5 johnnyding 2008-02-21 17:31:00 PST
This bug block some Chinese websites which have high traffic such as www.chinacars.com. Could anyone help me take a look this problem?
Comment 6 Darin Adler 2008-02-24 18:07:26 PST
Comment on attachment 19226 [details]
patch v1 for fixing this problem

Looks good to me.

+  <head>
+    <title></title>
+  </head>

Seems like we could just omit this whole section.

+    </div>

There's no <div> for this to close.

+document.write("SUCCESS (1 of 2)\n");
\ No newline at end of file

Would have been better having a newline at the end of this file.

r=me even without these changes
Comment 7 johnnyding 2008-02-24 22:44:27 PST
Created attachment 19340 [details]
it's basically same patch as patch v1, only change the wording in test case according to darin's comment
Comment 8 Mark Rowe (bdash) 2008-02-25 05:14:50 PST
Landed in r30563.
Comment 9 Yael 2008-07-01 06:27:26 PDT
*** Bug 19680 has been marked as a duplicate of this bug. ***