Changeset 51097 in webkit
- Timestamp:
- Nov 17, 2009 4:35:56 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r51096 r51097 1 2009-11-17 Johnny Ding <jnd@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 In all valid script tags for JavaScript, the event handler in <script...for> should not get executed. 6 Change the original test to pure js test, and test the situation about script tags which have text or language attribute. 7 https://bugs.webkit.org/show_bug.cgi?id=31567 8 9 * fast/dom/HTMLScriptElement/script-for-attribute-unexpected-execution-expected.txt: 10 * fast/dom/HTMLScriptElement/script-for-attribute-unexpected-execution.html: 11 * fast/dom/HTMLScriptElement/script-tests: Added. 12 * fast/dom/HTMLScriptElement/script-tests/script-for-attribute-unexpected-execution.js: Added. 13 (ScriptForAttributeExecute): 14 1 15 2009-11-17 Mark Rowe <mrowe@apple.com> 2 16 -
trunk/LayoutTests/fast/dom/HTMLScriptElement/script-for-attribute-unexpected-execution-expected.txt
r43061 r51097 1 1 If a script has a for attribute, then it was intended to only be run under certain conditions, often as a result of a certain window event. 2 2 Since we don't yet support the full for attribute syntax we would run these scripts as we parsed them, often causing unintentional breakage of the site in question. 3 You should *not* see the alert() that is in a script element on this page. If you do, we're not properly running these scripts only when they were intended to be run. 3 You should *not* see any failure when running this test. If you do, we're not properly running these scripts only when they were intended to be run. 4 5 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 6 7 8 PASS scriptForExecuted is false 9 PASS scriptForExecuted is false 10 PASS scriptForExecuted is false 11 PASS successfullyParsed is true 12 13 TEST COMPLETE 14 -
trunk/LayoutTests/fast/dom/HTMLScriptElement/script-for-attribute-unexpected-execution.html
r43061 r51097 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 2 <html> 2 3 <head> 3 <script> 4 if (window.layoutTestController) 5 layoutTestController.dumpAsText(); 6 </script> 7 8 <script for=window event=onresize> 9 alert("This text should only be alerted if the window is resizing. If you see it as a mere result of the page loading, then you're seeing a symptom that breaks real world websites"); 10 </script> 11 4 <link rel="stylesheet" href="../../js/resources/js-test-style.css"> 5 <script src="../../js/resources/js-test-pre.js"></script> 12 6 </head> 13 7 <body> 14 If a script has a for attribute, then it was intended to only be run under certain conditions, often as a result of a certain window event.<br> 15 Since we don't yet support the full for attribute syntax we would run these scripts as we parsed them, often causing unintentional breakage of the site in question.<br> 16 You should *not* see the alert() that is in a script element on this page. If you do, we're not properly running these scripts only when they were intended to be run. 8 <p id="description"></p> 9 <div id="console"></div> 10 <script src="script-tests/script-for-attribute-unexpected-execution.js"></script> 11 <script src="../../js/resources/js-test-post.js"></script> 17 12 </body> 18 13 </html> 14 -
trunk/WebCore/ChangeLog
r51072 r51097 1 2009-11-17 Johnny Ding <jnd@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 In all valid script tags for JavaScript, the event handler in <script...for> should not get executed. 6 https://bugs.webkit.org/show_bug.cgi?id=31567 7 8 * dom/ScriptElement.cpp: 9 (WebCore::ScriptElementData::shouldExecuteAsJavaScript): 10 1 11 2009-11-17 Pavel Feldman <pfeldman@chromium.org> 2 12 -
trunk/WebCore/dom/ScriptElement.cpp
r49208 r51097 230 230 */ 231 231 String type = m_scriptElement->typeAttributeValue(); 232 if (!type.isEmpty()) 233 return MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSpace().lower()); 234 235 String language = m_scriptElement->languageAttributeValue(); 236 if (!language.isEmpty()) 237 return isSupportedJavaScriptLanguage(language); 232 if (!type.isEmpty()) { 233 if (!MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSpace().lower())) 234 return false; 235 } else { 236 String language = m_scriptElement->languageAttributeValue(); 237 if (!language.isEmpty() && !isSupportedJavaScriptLanguage(language)) 238 return false; 239 } 238 240 239 241 // No type or language is specified, so we assume the script to be JavaScript.
Note: See TracChangeset
for help on using the changeset viewer.