2010-07-02 Oliver Hunt <[email protected]>
Reviewed by Geoffrey Garen.
Move BOM handling out of the lexer and parser
https://bugs.webkit.org/show_bug.cgi?id=41539
Doing the BOM stripping in the lexer meant that we could
end up having to strip the BOMs from a source multiple times.
To deal with this we now require all strings provided by
a SourceProvider to already have had the BOMs stripped.
This also simplifies some of the lexer logic.
- parser/Lexer.cpp:
(JSC::Lexer::setCode):
(JSC::Lexer::sourceCode):
- parser/SourceProvider.h:
(JSC::SourceProvider::SourceProvider):
(JSC::UStringSourceProvider::create):
(JSC::UStringSourceProvider::getRange):
(JSC::UStringSourceProvider::UStringSourceProvider):
- wtf/text/StringImpl.h:
(WebCore::StringImpl::copyStringWithoutBOMs):
2010-07-02 Oliver Hunt <[email protected]>
Reviewed by Geoffrey Garen.
Move BOM handling out of the lexer and parser
https://bugs.webkit.org/show_bug.cgi?id=41539
Update WebCore to ensure that SourceProviders don't
produce strings with BOMs in them.
- bindings/js/ScriptSourceProvider.h:
(WebCore::ScriptSourceProvider::ScriptSourceProvider):
- bindings/js/StringSourceProvider.h:
(WebCore::StringSourceProvider::StringSourceProvider):
- loader/CachedScript.cpp:
(WebCore::CachedScript::CachedScript):
(WebCore::CachedScript::script):
- loader/CachedScript.h:
(WebCore::CachedScript::):
CachedScript now stores decoded data with the BOMs stripped,
and caches the presence of BOMs across memory purges.