diff options
author | Steve Block <steveblock@google.com> | 2010-05-26 10:11:43 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-27 11:14:42 +0100 |
commit | e78cbe89e6f337f2f1fe40315be88f742b547151 (patch) | |
tree | d778000b84a04f24bbad50c7fa66244365e960e9 /WebCore/dom/ScriptElement.cpp | |
parent | 7b582e96e4e909ed7dba1e07153d20fbddaec3f7 (diff) | |
download | external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.zip external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.tar.gz external_webkit-e78cbe89e6f337f2f1fe40315be88f742b547151.tar.bz2 |
Merge WebKit at r60074: Initial merge by git
Change-Id: I18a2dc5439e36c928351ea829d8fb4e39b062fc7
Diffstat (limited to 'WebCore/dom/ScriptElement.cpp')
-rw-r--r-- | WebCore/dom/ScriptElement.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/WebCore/dom/ScriptElement.cpp b/WebCore/dom/ScriptElement.cpp index 22d6981..b457f5d 100644 --- a/WebCore/dom/ScriptElement.cpp +++ b/WebCore/dom/ScriptElement.cpp @@ -32,9 +32,11 @@ #include "HTMLNames.h" #include "HTMLScriptElement.h" #include "MIMETypeRegistry.h" +#include "Page.h" #include "ScriptController.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" +#include "Settings.h" #include "StringHash.h" #include "Text.h" #include <wtf/StdLibExtras.h> @@ -82,12 +84,28 @@ void ScriptElement::childrenChanged(ScriptElementData& data) data.evaluateScript(ScriptSourceCode(data.scriptContent(), element->document()->url())); // FIXME: Provide a real starting line number here } +static inline bool useHTML5Parser(Document* document) +{ + ASSERT(document); + Settings* settings = document->page() ? document->page()->settings() : 0; + return settings && settings->html5ParserEnabled(); +} + void ScriptElement::finishParsingChildren(ScriptElementData& data, const String& sourceUrl) { // The parser just reached </script>. If we have no src and no text, // allow dynamic loading later. if (sourceUrl.isEmpty() && data.scriptContent().isEmpty()) data.setCreatedByParser(false); + // HTML5 Requires that we execute scripts from the parser, not from + // HTMLTokenizer like we currently do. + // FIXME: It may not be safe to execute scripts from here if + // HTMLParser::popOneBlockCommon is not reentrant. + else if (useHTML5Parser(data.element()->document())) { + // This is currently an incomplete implementation, see: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#parsing-main-incdata + data.evaluateScript(ScriptSourceCode(data.scriptContent(), data.element()->document()->url())); // FIXME: Provide a real starting line number here + } } void ScriptElement::handleSourceAttribute(ScriptElementData& data, const String& sourceUrl) |