Commit 6b41247a authored by darin@chromium.org's avatar darin@chromium.org

2008-11-24 Darin Fisher <darin@chromium.org>

        Reviewed by Sam Weinig.

        https://bugs.webkit.org/show_bug.cgi?id=22448
        Create an abstraction for JSC::SourceCode

        * WebCore.vcproj/WebCore.vcproj:
        * bindings/js/CachedScriptSourceProvider.h:
        * bindings/js/ScriptController.cpp:
        (WebCore::ScriptController::evaluate):
        * bindings/js/ScriptController.h:
        * bindings/js/ScriptSourceCode.h: Added.
        (WebCore::ScriptSourceCode::ScriptSourceCode):
        (WebCore::ScriptSourceCode::length):
        (WebCore::ScriptSourceCode::jsSourceCode):
        * bindings/js/WorkerScriptController.cpp:
        (WebCore::Workevn ScriptController::evaluate):
        * bindings/js/WorkerScriptController.h:
        * dom/ScriptElement.cpp:
        (WebCore::ScriptElement::insertedIntoDocument):
        (WebCore::ScriptElement::childrenChanged):
        (WebCore::ScriptElementData::evaluateScript):
        (WebCore::ScriptElementData::notifyFinished):
        * dom/ScriptElement.h:
        * dom/WorkerThread.cpp:
        (WebCore::WorkerThread::workerThread):
        * dom/WorkerThread.h:
        * dom/XMLTokenizer.cpp:
        (WebCore::XMLTokenizer::notifyFinished):
        * dom/XMLTokenizerLibxml2.cpp:
        (WebCore::XMLTokenizer::endElementNs):
        * dom/XMLTokenizerQt.cpp:
        (WebCore::XMLTokenizer::parseEndElement):
        * html/HTMLTokenizer.cpp:
        (WebCore::HTMLTokenizer::scriptHandler):
        (WebCore::HTMLTokenizer::scriptExecution):
        (WebCore::HTMLTokenizer::notifyFinished):
        * html/HTMLTokenizer.h:
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::executeScript):
        * loader/FrameLoader.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38729 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1b861eb6
2008-11-24 Darin Fisher <darin@chromium.org>
Reviewed by Sam Weinig.
https://bugs.webkit.org/show_bug.cgi?id=22448
Create an abstraction for JSC::SourceCode
* WebCore.vcproj/WebCore.vcproj:
* bindings/js/CachedScriptSourceProvider.h:
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::evaluate):
* bindings/js/ScriptController.h:
* bindings/js/ScriptSourceCode.h: Added.
(WebCore::ScriptSourceCode::ScriptSourceCode):
(WebCore::ScriptSourceCode::length):
(WebCore::ScriptSourceCode::jsSourceCode):
* bindings/js/WorkerScriptController.cpp:
(WebCore::Workevn ScriptController::evaluate):
* bindings/js/WorkerScriptController.h:
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::insertedIntoDocument):
(WebCore::ScriptElement::childrenChanged):
(WebCore::ScriptElementData::evaluateScript):
(WebCore::ScriptElementData::notifyFinished):
* dom/ScriptElement.h:
* dom/WorkerThread.cpp:
(WebCore::WorkerThread::workerThread):
* dom/WorkerThread.h:
* dom/XMLTokenizer.cpp:
(WebCore::XMLTokenizer::notifyFinished):
* dom/XMLTokenizerLibxml2.cpp:
(WebCore::XMLTokenizer::endElementNs):
* dom/XMLTokenizerQt.cpp:
(WebCore::XMLTokenizer::parseEndElement):
* html/HTMLTokenizer.cpp:
(WebCore::HTMLTokenizer::scriptHandler):
(WebCore::HTMLTokenizer::scriptExecution):
(WebCore::HTMLTokenizer::notifyFinished):
* html/HTMLTokenizer.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::executeScript):
* loader/FrameLoader.h:
2008-11-24 Darin Adler <darin@apple.com>
Reviewed by Dan Bernstein.
......@@ -13880,6 +13880,10 @@
RelativePath="..\bindings\js\ScriptControllerWin.cpp"
>
</File>
<File
RelativePath="..\bindings\js\ScriptSourceCode.h"
>
</File>
<File
RelativePath="..\bindings\js\ScriptString.h"
>
......
......@@ -1801,6 +1801,7 @@
93442CA00D2B336000338FF9 /* HTMLTableRowsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93442C9F0D2B336000338FF9 /* HTMLTableRowsCollection.cpp */; };
934CC0E10ED39D6F00A658F2 /* ScriptValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 934CC0DF0ED39D6F00A658F2 /* ScriptValue.cpp */; };
934CC0E20ED39D6F00A658F2 /* ScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 934CC0E00ED39D6F00A658F2 /* ScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
934CC10A0EDB223900A658F2 /* ScriptSourceCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 934CC1090EDB223900A658F2 /* ScriptSourceCode.h */; };
934D9BA50B8C116B007B42A9 /* WebCoreNSStringExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 934D9BA40B8C116B007B42A9 /* WebCoreNSStringExtras.mm */; };
934D9BA70B8C1175007B42A9 /* WebCoreNSStringExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 934D9BA60B8C1175007B42A9 /* WebCoreNSStringExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
934F71380D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 934F71370D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp */; };
......@@ -6582,6 +6583,7 @@
93442C9F0D2B336000338FF9 /* HTMLTableRowsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTableRowsCollection.cpp; sourceTree = "<group>"; };
934CC0DF0ED39D6F00A658F2 /* ScriptValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptValue.cpp; sourceTree = "<group>"; };
934CC0E00ED39D6F00A658F2 /* ScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptValue.h; sourceTree = "<group>"; };
934CC1090EDB223900A658F2 /* ScriptSourceCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptSourceCode.h; sourceTree = "<group>"; };
934D9BA40B8C116B007B42A9 /* WebCoreNSStringExtras.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreNSStringExtras.mm; sourceTree = "<group>"; };
934D9BA60B8C1175007B42A9 /* WebCoreNSStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreNSStringExtras.h; sourceTree = "<group>"; };
934F71370D5A6EFF00018D69 /* AuthenticationChallengeBase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationChallengeBase.cpp; sourceTree = "<group>"; };
......@@ -13067,6 +13069,7 @@
93B70D5309EB0C7C009D8468 /* ScriptController.cpp */,
93B70D5409EB0C7C009D8468 /* ScriptController.h */,
A83E1C720E49042B00140B9C /* ScriptControllerMac.mm */,
934CC1090EDB223900A658F2 /* ScriptSourceCode.h */,
416F45EF0ED7B311008215B6 /* ScriptString.h */,
934CC0DF0ED39D6F00A658F2 /* ScriptValue.cpp */,
934CC0E00ED39D6F00A658F2 /* ScriptValue.h */,
......@@ -16388,6 +16391,7 @@
416F45F00ED7B311008215B6 /* ScriptString.h in Headers */,
080AEC820ED8708B00DF4CCE /* WMLIntrinsicEvent.h in Headers */,
080AEC840ED8708B00DF4CCE /* WMLIntrinsicEventHandler.h in Headers */,
934CC10A0EDB223900A658F2 /* ScriptSourceCode.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -28,6 +28,7 @@
#include "CachedResourceClient.h"
#include "CachedResourceHandle.h"
#include "CachedScript.h"
#include <parser/SourceCode.h>
namespace WebCore {
......
......@@ -38,9 +38,9 @@
#include "PageGroup.h"
#include "PausedTimeouts.h"
#include "runtime_root.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "Settings.h"
#include "StringSourceProvider.h"
#include <runtime/Completion.h>
#include <debugger/Debugger.h>
......@@ -88,10 +88,12 @@ ScriptController::~ScriptController()
disconnectPlatformScriptObjects();
}
ScriptValue ScriptController::evaluate(const JSC::SourceCode& sourceCode)
ScriptValue ScriptController::evaluate(const ScriptSourceCode& sourceCode)
{
// evaluate code. Returns the JS return value or 0
// if there was none, an error occured or the type couldn't be converted.
const SourceCode& jsSourceCode = sourceCode.jsSourceCode();
initScriptIfNeeded();
// inlineCode is true for <a href="javascript:doSomething()">
......@@ -100,7 +102,7 @@ ScriptValue ScriptController::evaluate(const JSC::SourceCode& sourceCode)
// See smart window.open policy for where this is used.
ExecState* exec = m_windowShell->window()->globalExec();
const String* savedSourceURL = m_sourceURL;
String sourceURL = sourceCode.provider()->url();
String sourceURL = jsSourceCode.provider()->url();
m_sourceURL = &sourceURL;
JSLock lock(false);
......@@ -110,7 +112,7 @@ ScriptValue ScriptController::evaluate(const JSC::SourceCode& sourceCode)
m_frame->keepAlive();
m_windowShell->window()->startTimeoutCheck();
Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode, m_windowShell);
Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), jsSourceCode, m_windowShell);
m_windowShell->window()->stopTimeoutCheck();
if (comp.complType() == Normal || comp.complType() == ReturnValue) {
......
......@@ -40,7 +40,6 @@ struct NPObject;
namespace JSC {
class JSGlobalObject;
class SourceCode;
namespace Bindings {
class Instance;
......@@ -55,6 +54,7 @@ class EventListener;
class HTMLPlugInElement;
class Frame;
class Node;
class ScriptSourceCode;
class ScriptValue;
class String;
class Widget;
......@@ -79,7 +79,7 @@ public:
return m_windowShell->window();
}
ScriptValue evaluate(const JSC::SourceCode&);
ScriptValue evaluate(const ScriptSourceCode&);
PassRefPtr<EventListener> createInlineEventListener(const String& functionName, const String& code, Node*);
#if ENABLE(SVG)
......
/*
* Copyright (c) 2008, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ScriptSourceCode_h
#define ScriptSourceCode_h
#include "CachedScriptSourceProvider.h"
#include "StringSourceProvider.h"
#include "KURL.h"
namespace WebCore {
class ScriptSourceCode {
public:
ScriptSourceCode(const String& source, const KURL& url = KURL(), int startLine = 1)
: m_code(makeSource(source, url.isNull() ? String() : url.string(), startLine))
{
}
ScriptSourceCode(CachedScript* cs)
: m_code(makeSource(cs))
{
}
bool isEmpty() const { return m_code.length() == 0; }
const JSC::SourceCode& jsSourceCode() const { return m_code; }
private:
JSC::SourceCode m_code;
};
} // namespace WebCore
#endif // ScriptSourceCode_h
/*
* Copyright (c) 2008, Google Inc.
* All rights reserved.
* Copyright (c) 2008, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
......
/*
* Copyright (c) 2008, Google Inc.
* All rights reserved.
* Copyright (c) 2008, Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
......
......@@ -32,11 +32,12 @@
#include "JSDOMBinding.h"
#include "JSWorkerContext.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "WorkerContext.h"
#include "WorkerMessagingProxy.h"
#include "WorkerThread.h"
#include <interpreter/Interpreter.h>
#include <parser/SourceCode.h>
#include <runtime/Completion.h>
#include <runtime/Completion.h>
#include <runtime/JSLock.h>
......@@ -70,7 +71,7 @@ void WorkerScriptController::initScript()
m_workerContextWrapper = new (m_globalData.get()) JSWorkerContext(m_workerContext);
}
JSValue* WorkerScriptController::evaluate(const JSC::SourceCode& sourceCode)
ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode)
{
{
MutexLocker lock(m_sharedDataMutex);
......@@ -83,7 +84,7 @@ JSValue* WorkerScriptController::evaluate(const JSC::SourceCode& sourceCode)
ExecState* exec = m_workerContextWrapper->globalExec();
m_workerContextWrapper->startTimeoutCheck();
Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode, m_workerContextWrapper);
Completion comp = JSC::evaluate(exec, exec->dynamicGlobalObject()->globalScopeChain(), sourceCode.jsSourceCode(), m_workerContextWrapper);
m_workerContextWrapper->stopTimeoutCheck();
m_workerContext->thread()->messagingProxy()->reportWorkerThreadActivity(m_workerContext->hasPendingActivity());
......
......@@ -35,13 +35,13 @@
namespace JSC {
class JSGlobalData;
class JSValue;
class SourceCode;
}
namespace WebCore {
class JSWorkerContext;
class ScriptSourceCode;
class ScriptValue;
class String;
class WorkerContext;
......@@ -56,7 +56,7 @@ namespace WebCore {
return m_workerContextWrapper;
}
JSC::JSValue* evaluate(const JSC::SourceCode&);
ScriptValue evaluate(const ScriptSourceCode&);
void forbidExecution();
......
......@@ -25,21 +25,18 @@
#include "ScriptElement.h"
#include "CachedScript.h"
#include "CachedScriptSourceProvider.h"
#include "DocLoader.h"
#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "MIMETypeRegistry.h"
#include "ScriptController.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "StringHash.h"
#include "StringSourceProvider.h"
#include "Text.h"
#include <wtf/StdLibExtras.h>
using namespace JSC;
namespace WebCore {
void ScriptElement::insertedIntoDocument(ScriptElementData& data, const String& sourceUrl)
......@@ -55,7 +52,7 @@ void ScriptElement::insertedIntoDocument(ScriptElementData& data, const String&
// If there's an empty script node, we shouldn't evaluate the script
// because if a script is inserted afterwards (by setting text or innerText)
// it should be evaluated, and evaluateScript only evaluates a script once.
data.evaluateScript(makeSource(data.scriptContent(), data.element()->document()->url().string())); // FIXME: Provide a real starting line number here.
data.evaluateScript(ScriptSourceCode(data.scriptContent(), data.element()->document()->url())); // FIXME: Provide a real starting line number here.
}
void ScriptElement::removedFromDocument(ScriptElementData& data)
......@@ -75,7 +72,7 @@ void ScriptElement::childrenChanged(ScriptElementData& data)
// and the script element has been inserted in the document
// we evaluate the script.
if (element->inDocument() && element->firstChild())
data.evaluateScript(makeSource(data.scriptContent(), element->document()->url().string())); // FIXME: Provide a real starting line number here
data.evaluateScript(ScriptSourceCode(data.scriptContent(), element->document()->url())); // FIXME: Provide a real starting line number here
}
void ScriptElement::finishParsingChildren(ScriptElementData& data, const String& sourceUrl)
......@@ -162,9 +159,9 @@ void ScriptElementData::requestScript(const String& sourceUrl)
m_scriptElement->dispatchErrorEvent();
}
void ScriptElementData::evaluateScript(const SourceCode& sourceCode)
void ScriptElementData::evaluateScript(const ScriptSourceCode& sourceCode)
{
if (m_evaluated || !sourceCode.length() || !shouldExecuteAsJavaScript())
if (m_evaluated || sourceCode.isEmpty() || !shouldExecuteAsJavaScript())
return;
if (Frame* frame = m_element->document()->frame()) {
......@@ -198,7 +195,7 @@ void ScriptElementData::notifyFinished(CachedResource* o)
if (cs->errorOccurred())
m_scriptElement->dispatchErrorEvent();
else {
evaluateScript(makeSource(cs));
evaluateScript(ScriptSourceCode(cs));
m_scriptElement->dispatchLoadEvent();
}
......
......@@ -24,15 +24,12 @@
#include "CachedResourceClient.h"
#include "CachedResourceHandle.h"
namespace JSC {
class SourceCode;
}
namespace WebCore {
class CachedScript;
class Element;
class ScriptElementData;
class ScriptSourceCode;
class ScriptElement {
public:
......@@ -81,7 +78,7 @@ public:
void setHaveFiredLoadEvent(bool firedLoad) { m_firedLoad = firedLoad; }
void requestScript(const String& sourceUrl);
void evaluateScript(const JSC::SourceCode&);
void evaluateScript(const ScriptSourceCode&);
void stopLoadRequest();
private:
......
......@@ -31,14 +31,13 @@
#include "WorkerThread.h"
#include "JSWorkerContext.h"
#include "StringSourceProvider.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "Worker.h"
#include "WorkerContext.h"
#include "WorkerMessagingProxy.h"
#include "WorkerTask.h"
using namespace JSC;
namespace WebCore {
PassRefPtr<WorkerThread> WorkerThread::create(const KURL& scriptURL, const String& sourceCode, WorkerMessagingProxy* messagingProxy)
......@@ -78,11 +77,11 @@ void* WorkerThread::workerThread()
{
// Mutex protection is necessary because stop() can be called before the context is fully created.
MutexLocker lock(m_workerContextMutex);
m_workerContext = WorkerContext::create(KURL(m_scriptURL), this);
m_workerContext = WorkerContext::create(m_scriptURL, this);
}
WorkerScriptController* script = m_workerContext->script();
script->evaluate(makeSource(m_sourceCode, m_scriptURL));
script->evaluate(ScriptSourceCode(m_sourceCode, m_scriptURL));
m_messagingProxy->confirmWorkerThreadMessage(m_workerContext->hasPendingActivity()); // This wasn't really a message, but it counts as one for GC.
while (true) {
......
......@@ -29,13 +29,12 @@
#if ENABLE(WORKERS)
#include "PlatformString.h"
#include "KURL.h"
#include <wtf/MessageQueue.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
class KURL;
class WorkerContext;
class WorkerMessagingProxy;
class WorkerTask;
......@@ -61,7 +60,7 @@ namespace WebCore {
ThreadIdentifier m_threadID;
String m_scriptURL;
KURL m_scriptURL;
String m_sourceCode;
WorkerMessagingProxy* m_messagingProxy;
......
......@@ -29,7 +29,6 @@
#include "CDATASection.h"
#include "CString.h"
#include "CachedScript.h"
#include "CachedScriptSourceProvider.h"
#include "Comment.h"
#include "DocLoader.h"
#include "Document.h"
......@@ -48,6 +47,7 @@
#include "ResourceRequest.h"
#include "ResourceResponse.h"
#include "ScriptController.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "StringSourceProvider.h"
#include "TextResourceDecoder.h"
......@@ -326,7 +326,7 @@ void XMLTokenizer::notifyFinished(CachedResource* finishedObj)
ASSERT(m_pendingScript == finishedObj);
ASSERT(m_pendingScript->accessCount() > 0);
JSC::SourceCode sourceCode = makeSource(m_pendingScript.get());
ScriptSourceCode sourceCode(m_pendingScript.get());
bool errorOccurred = m_pendingScript->errorOccurred();
m_pendingScript->removeClient(this);
......
......@@ -47,8 +47,8 @@
#include "ResourceResponse.h"
#include "ScriptController.h"
#include "ScriptElement.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "StringSourceProvider.h"
#include "TextResourceDecoder.h"
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
......@@ -807,7 +807,7 @@ void XMLTokenizer::endElementNs()
} else
m_scriptElement = 0;
} else
m_view->frame()->loader()->executeScript(makeSource(scriptElement->scriptContent(), m_doc->url().string(), m_scriptStartLine));
m_view->frame()->loader()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine));
m_requestingScript = false;
}
......
......@@ -47,8 +47,8 @@
#include "ResourceResponse.h"
#include "ScriptController.h"
#include "ScriptElement.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "StringSourceProvider.h"
#include "TextResourceDecoder.h"
#include <QDebug>
#include <wtf/Platform.h>
......@@ -585,7 +585,7 @@ void XMLTokenizer::parseEndElement()
} else
m_scriptElement = 0;
} else
m_view->frame()->loader()->executeScript(makeSource(scriptElement->scriptContent(), m_doc->url().string(), m_scriptStartLine));
m_view->frame()->loader()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine));
m_requestingScript = false;
}
......
......@@ -30,7 +30,6 @@
#include "CSSHelper.h"
#include "Cache.h"
#include "CachedScript.h"
#include "CachedScriptSourceProvider.h"
#include "DocLoader.h"
#include "DocumentFragment.h"
#include "EventNames.h"
......@@ -45,8 +44,8 @@
#include "Page.h"
#include "PreloadScanner.h"
#include "ScriptController.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "StringSourceProvider.h"
#include "SystemTime.h"
#include <wtf/ASCIICType.h>
......@@ -55,7 +54,6 @@
#define PRELOAD_SCANNER_ENABLED 1
// #define INSTRUMENT_LAYOUT_SCHEDULING 1
using namespace JSC;
using namespace WTF;
using namespace std;
......@@ -503,7 +501,7 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state)
else
prependingSrc = m_src;
setSrc(SegmentedString());
state = scriptExecution(makeSource(scriptString, m_doc->frame() ? m_doc->frame()->document()->url().string() : String(), startLine), state);
state = scriptExecution(ScriptSourceCode(scriptString, m_doc->frame() ? m_doc->frame()->document()->url() : KURL(), startLine), state);
}
}
......@@ -545,7 +543,7 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state)
return state;
}
HTMLTokenizer::State HTMLTokenizer::scriptExecution(const SourceCode& sourceCode, State state)
HTMLTokenizer::State HTMLTokenizer::scriptExecution(const ScriptSourceCode& sourceCode, State state)
{
if (m_fragment || !m_doc->frame())
return state;
......@@ -1969,7 +1967,7 @@ void HTMLTokenizer::notifyFinished(CachedResource*)
// make sure we forget about the script before we execute the new one
// infinite recursion might happen otherwise
JSC::SourceCode sourceCode = makeSource(cs);
ScriptSourceCode sourceCode(cs);
bool errorOccurred = cs->errorOccurred();
cs->removeClient(this);
......
......@@ -34,10 +34,6 @@
#include <wtf/OwnPtr.h>
#include <wtf/Vector.h>
namespace JSC {
class SourceCode;
}
namespace WebCore {
class CachedScript;
......@@ -50,6 +46,7 @@ class FrameView;
class HTMLParser;
class Node;
class PreloadScanner;
class ScriptSourceCode;
/**
* @internal
......@@ -181,7 +178,7 @@ private:
State parseEntity(SegmentedString&, UChar*& dest, State, unsigned& cBufferPos, bool start, bool parsingTag);
State parseProcessingInstruction(SegmentedString&, State);
State scriptHandler(State);
State scriptExecution(const JSC::SourceCode&, State);
State scriptExecution(const ScriptSourceCode&, State);
void setSrc(const SegmentedString&);
// check if we have enough space in the buffer.
......
......@@ -80,18 +80,16 @@
#include "ResourceHandle.h"
#include "ResourceRequest.h"
#include "ScriptController.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "SecurityOrigin.h"
#include "SegmentedString.h"
#include "Settings.h"
#include "StringSourceProvider.h"
#include "SystemTime.h"
#include "TextResourceDecoder.h"
#include "WindowFeatures.h"
#include "XMLHttpRequest.h"
#include "XMLTokenizer.h"
#include <runtime/JSLock.h>
#include <runtime/JSObject.h>
#include <wtf/StdLibExtras.h>
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
......@@ -109,8 +107,6 @@
#include "SVGViewSpec.h"
#endif
using namespace JSC;
namespace WebCore {
#if ENABLE(SVG)
......@@ -776,10 +772,10 @@ bool FrameLoader::executeIfJavaScriptURL(const KURL& url, bool userGesture, bool
ScriptValue FrameLoader::executeScript(const String& script, bool forceUserGesture)
{
return executeScript(makeSource(script, forceUserGesture ? String() : m_URL.string()));
return executeScript(ScriptSourceCode(script, forceUserGesture ? KURL() : m_URL));
}
ScriptValue FrameLoader::executeScript(const SourceCode& sourceCode)
ScriptValue FrameLoader::executeScript(const ScriptSourceCode& sourceCode)
{
if (!m_frame->script()->isEnabled() || m_frame->script()->isPaused())
return ScriptValue();
......
......@@ -49,10 +49,6 @@
#include "CachedResourceClient.h"
#endif
namespace JSC {
class SourceCode;
}
namespace WebCore {
class Archive;
......@@ -79,6 +75,7 @@ namespace WebCore {
class ResourceLoader;
class ResourceRequest;
class ResourceResponse;
class ScriptSourceCode;
class ScriptValue;
class SecurityOrigin;
class SharedBuffer;
......@@ -339,7 +336,7 @@ namespace WebCore {
// Returns true if url is a JavaScript URL.
bool executeIfJavaScriptURL(const KURL& url, <