Trailing spaces in CSP source lists should not generate console warnings.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 22:48:25 +0000 (22:48 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 22:48:25 +0000 (22:48 +0000)
commit98775c7bd8bc4eaeae43c7340151ac5a68681daa
treebc0e595ae94b2923aa72ef4225765f7117afbb3c
parentf10f71a586f08b670d28223c89f3d3eb28cd60cb
Trailing spaces in CSP source lists should not generate console warnings.
https://bugs.webkit.org/show_bug.cgi?id=94847

Patch by Mike West <mkwst@chromium.org> on 2012-08-23
Reviewed by Adam Barth.

Trailing space after a valid source in a Content Security Policy source
list was accidentally generating console warnings about an invalid
(empty) source. This patch silently ignores trailing whitespace instead.

Source/WebCore:

A test-case has been added to 'source-list-parsing-02.html' to cover
this case.

* page/ContentSecurityPolicy.cpp:
(WebCore::CSPSourceList::parse):
    Return early if we reach the end of the source list after skipping
    leading whitespace.

LayoutTests:

* http/tests/security/contentSecurityPolicy/source-list-parsing-02-expected.txt:
* http/tests/security/contentSecurityPolicy/source-list-parsing-02.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126488 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-02-expected.txt
LayoutTests/http/tests/security/contentSecurityPolicy/source-list-parsing-02.html
Source/WebCore/ChangeLog
Source/WebCore/page/ContentSecurityPolicy.cpp