Bug 17444 - nested script inside external script cause error
Summary: nested script inside external script cause error
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 19680 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-02-20 02:06 PST by johnnyding
Modified: 2008-07-01 06:27 PDT (History)
3 users (show)

See Also:


Attachments
html file for this test case (466 bytes, text/html)
2008-02-20 02:07 PST, johnnyding
no flags Details
script file for this test case (238 bytes, text/html)
2008-02-20 02:08 PST, johnnyding
no flags Details
patch v1 for fixing this problem (5.21 KB, patch)
2008-02-20 06:26 PST, johnnyding
darin: review+
Details | Formatted Diff | Diff
it's basically same patch as patch v1, only change the wording in test case according to darin's comment (5.12 KB, patch)
2008-02-24 22:44 PST, johnnyding
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***