Bug 148855

Summary: Script element with an empty for or event attributes should not execute
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, esprehn+autocc, ggaren, kangil.han, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 150335    
Attachments:
Description Flags
Patch none

Description Ryosuke Niwa 2015-09-04 17:04:00 PDT
See https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script

When a script element has "for" or "event" attributes, we should not execute the script as a result of step 12.

This bug was found by the newly added test:
LayoutTests/http/tests/w3c/html/semantics/scripting-1/the-script-element/script-for-event.html
Comment 1 Radar WebKit Bug Importer 2015-09-04 17:05:45 PDT
<rdar://problem/22588156>
Comment 2 Chris Dumez 2015-10-16 15:32:29 PDT
Created attachment 263342 [details]
Patch
Comment 3 Darin Adler 2015-10-18 15:54:43 PDT
Comment on attachment 263342 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=263342&action=review

> Source/WebCore/dom/ScriptElement.cpp:372
>          forAttribute = forAttribute.stripWhiteSpace();

Looks like this uses the wrong stripping function; should be stripLeadingAndTrailingHTMLSpaces.
Comment 4 WebKit Commit Bot 2015-10-18 16:44:33 PDT
Comment on attachment 263342 [details]
Patch

Clearing flags on attachment: 263342

Committed r191270: <http://trac.webkit.org/changeset/191270>
Comment 5 WebKit Commit Bot 2015-10-18 16:44:38 PDT
All reviewed patches have been landed.  Closing bug.