[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

yurys at chromium.org yurys at chromium.org
Thu Feb 4 21:31:20 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit fe91ad5b40db58f65ce74c0e0e31d1fc182ce5c8
Author: yurys at chromium.org <yurys at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 28 21:05:51 2010 +0000

    2010-01-28  Yury Semikhatsky  <yurys at chromium.org>
    
            Reviewed by Adam Barth.
    
            Remove ScriptState::frame which is only used for reporting exceptions
            in some cases in a way that diverges from the regular exception reporting in
            v8 bindings.
    
            Cache ScriptState directly on v8::Context instead of providing
            implementations specific for isolated worlds and ScriptController.
    
            https://bugs.webkit.org/show_bug.cgi?id=34266
    
            * bindings/js/ScriptController.cpp:
            * bindings/js/ScriptController.h:
            * bindings/js/ScriptState.cpp:
            (WebCore::mainWorldScriptState):
            * bindings/js/ScriptState.h:
            * bindings/v8/ScriptCallStack.cpp:
            (WebCore::ScriptCallStack::ScriptCallStack):
            * bindings/v8/ScriptController.cpp:
            (WebCore::ScriptController::clearWindowShell):
            * bindings/v8/ScriptController.h:
            * bindings/v8/ScriptScope.cpp:
            (WebCore::ScriptScope::ScriptScope):
            (WebCore::ScriptScope::success):
            * bindings/v8/ScriptScope.h:
            * bindings/v8/ScriptState.cpp:
            (WebCore::ScriptState::ScriptState):
            (WebCore::ScriptState::forContext):
            (WebCore::ScriptState::current):
            (WebCore::ScriptState::empty):
            (WebCore::ScriptState::weakReferenceCallback):
            (WebCore::mainWorldScriptState):
            (WebCore::scriptStateFromPage):
            * bindings/v8/ScriptState.h:
            * bindings/v8/V8HiddenPropertyName.h:
            * bindings/v8/V8IsolatedContext.cpp:
            * bindings/v8/V8IsolatedContext.h:
            * bindings/v8/V8Utilities.cpp:
            (WebCore::getScriptExecutionContext):
            (WebCore::reportException):
            * bindings/v8/custom/V8NodeIteratorCustom.cpp:
            (WebCore::V8NodeIterator::nextNodeCallback):
            (WebCore::V8NodeIterator::previousNodeCallback):
            * bindings/v8/custom/V8TreeWalkerCustom.cpp:
            (WebCore::V8TreeWalker::parentNodeCallback):
            (WebCore::V8TreeWalker::firstChildCallback):
            (WebCore::V8TreeWalker::lastChildCallback):
            (WebCore::V8TreeWalker::nextNodeCallback):
            (WebCore::V8TreeWalker::previousNodeCallback):
            (WebCore::V8TreeWalker::nextSiblingCallback):
            (WebCore::V8TreeWalker::previousSiblingCallback):
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::injectedScriptForNodeId):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54012 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 96b7470..2c38252 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,59 @@
+2010-01-28  Yury Semikhatsky  <yurys at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Remove ScriptState::frame which is only used for reporting exceptions
+        in some cases in a way that diverges from the regular exception reporting in
+        v8 bindings.
+        
+        Cache ScriptState directly on v8::Context instead of providing
+        implementations specific for isolated worlds and ScriptController.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34266
+
+        * bindings/js/ScriptController.cpp:
+        * bindings/js/ScriptController.h:
+        * bindings/js/ScriptState.cpp:
+        (WebCore::mainWorldScriptState):
+        * bindings/js/ScriptState.h:
+        * bindings/v8/ScriptCallStack.cpp:
+        (WebCore::ScriptCallStack::ScriptCallStack):
+        * bindings/v8/ScriptController.cpp:
+        (WebCore::ScriptController::clearWindowShell):
+        * bindings/v8/ScriptController.h:
+        * bindings/v8/ScriptScope.cpp:
+        (WebCore::ScriptScope::ScriptScope):
+        (WebCore::ScriptScope::success):
+        * bindings/v8/ScriptScope.h:
+        * bindings/v8/ScriptState.cpp:
+        (WebCore::ScriptState::ScriptState):
+        (WebCore::ScriptState::forContext):
+        (WebCore::ScriptState::current):
+        (WebCore::ScriptState::empty):
+        (WebCore::ScriptState::weakReferenceCallback):
+        (WebCore::mainWorldScriptState):
+        (WebCore::scriptStateFromPage):
+        * bindings/v8/ScriptState.h:
+        * bindings/v8/V8HiddenPropertyName.h:
+        * bindings/v8/V8IsolatedContext.cpp:
+        * bindings/v8/V8IsolatedContext.h:
+        * bindings/v8/V8Utilities.cpp:
+        (WebCore::getScriptExecutionContext):
+        (WebCore::reportException):
+        * bindings/v8/custom/V8NodeIteratorCustom.cpp:
+        (WebCore::V8NodeIterator::nextNodeCallback):
+        (WebCore::V8NodeIterator::previousNodeCallback):
+        * bindings/v8/custom/V8TreeWalkerCustom.cpp:
+        (WebCore::V8TreeWalker::parentNodeCallback):
+        (WebCore::V8TreeWalker::firstChildCallback):
+        (WebCore::V8TreeWalker::lastChildCallback):
+        (WebCore::V8TreeWalker::nextNodeCallback):
+        (WebCore::V8TreeWalker::previousNodeCallback):
+        (WebCore::V8TreeWalker::nextSiblingCallback):
+        (WebCore::V8TreeWalker::previousSiblingCallback):
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::injectedScriptForNodeId):
+
 2010-01-28  Adam Barth  <abarth at webkit.org>
 
         Reviewed by David Levin.
diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp
index ab1d3a6..083e931 100644
--- a/WebCore/bindings/js/ScriptController.cpp
+++ b/WebCore/bindings/js/ScriptController.cpp
@@ -380,12 +380,6 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement
 
 #endif
 
-ScriptState* ScriptController::mainWorldScriptState()
-{
-    JSDOMWindowShell* shell = windowShell(mainThreadNormalWorld());
-    return shell->window()->globalExec();
-}
-
 JSObject* ScriptController::jsObjectForPluginElement(HTMLPlugInElement* plugin)
 {
     // Can't create JSObjects when JavaScript is disabled
diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h
index f265ab5..f3e5adf 100644
--- a/WebCore/bindings/js/ScriptController.h
+++ b/WebCore/bindings/js/ScriptController.h
@@ -24,7 +24,6 @@
 
 #include "JSDOMWindowShell.h"
 #include "ScriptInstance.h"
-#include "ScriptState.h"
 #include <runtime/Protect.h>
 #include <wtf/RefPtr.h>
 
@@ -160,8 +159,6 @@ public:
     
     XSSAuditor* xssAuditor() { return m_XSSAuditor.get(); }
 
-    ScriptState* mainWorldScriptState();
-
 private:
     JSDOMWindowShell* initScript(DOMWrapperWorld* world);
 
diff --git a/WebCore/bindings/js/ScriptState.cpp b/WebCore/bindings/js/ScriptState.cpp
index 7a760ae..b9f334a 100644
--- a/WebCore/bindings/js/ScriptState.cpp
+++ b/WebCore/bindings/js/ScriptState.cpp
@@ -38,6 +38,12 @@
 
 namespace WebCore {
 
+ScriptState* mainWorldScriptState(Frame* frame)
+{
+    JSDOMWindowShell* shell = frame->script()->windowShell(mainThreadNormalWorld());
+    return shell->window()->globalExec();
+}
+
 ScriptState* scriptStateFromNode(DOMWrapperWorld* world, Node* node)
 {
     if (!node)
diff --git a/WebCore/bindings/js/ScriptState.h b/WebCore/bindings/js/ScriptState.h
index 6257929..0c7c575 100644
--- a/WebCore/bindings/js/ScriptState.h
+++ b/WebCore/bindings/js/ScriptState.h
@@ -36,6 +36,7 @@
 
 namespace WebCore {
     class DOMWrapperWorld;
+    class Frame;
     class Node;
     class Page;
 
@@ -45,6 +46,8 @@ namespace WebCore {
     // For now, the separation is purely by convention.
     typedef JSC::ExecState ScriptState;
 
+    ScriptState* mainWorldScriptState(Frame*);
+
     ScriptState* scriptStateFromNode(DOMWrapperWorld*, Node*);
     ScriptState* scriptStateFromPage(DOMWrapperWorld*, Page*);
 
diff --git a/WebCore/bindings/v8/ScriptCallStack.cpp b/WebCore/bindings/v8/ScriptCallStack.cpp
index a0eeccb..21063ed 100644
--- a/WebCore/bindings/v8/ScriptCallStack.cpp
+++ b/WebCore/bindings/v8/ScriptCallStack.cpp
@@ -55,7 +55,7 @@ ScriptCallStack* ScriptCallStack::create(const v8::Arguments& arguments, unsigne
 
 ScriptCallStack::ScriptCallStack(const v8::Arguments& arguments, unsigned skipArgumentCount, String sourceName, int sourceLineNumber)
     : m_lastCaller(String(), sourceName, sourceLineNumber, arguments, skipArgumentCount)
-    , m_scriptState(ScriptController::currentScriptState())
+    , m_scriptState(ScriptState::current())
 {
 }
 
diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp
index 5d3078d..86d54d6 100644
--- a/WebCore/bindings/v8/ScriptController.cpp
+++ b/WebCore/bindings/v8/ScriptController.cpp
@@ -47,7 +47,6 @@
 #include "npruntime_priv.h"
 #include "NPV8Object.h"
 #include "ScriptSourceCode.h"
-#include "ScriptState.h"
 #include "Settings.h"
 #include "V8Binding.h"
 #include "V8BindingState.h"
@@ -354,24 +353,6 @@ void ScriptController::getAllWorlds(Vector<DOMWrapperWorld*>& worlds)
     worlds.append(mainThreadNormalWorld());
 }
 
-ScriptState* ScriptController::mainWorldScriptState()
-{
-    if (!m_mainWorldScriptState) {
-        v8::HandleScope handleScope;
-        m_mainWorldScriptState.set(new ScriptState(m_frame, V8Proxy::mainWorldContext(m_frame)));
-    }
-    return m_mainWorldScriptState.get();
-}
-
-ScriptState* ScriptController::currentScriptState()
-{
-    if (V8IsolatedContext* context = V8IsolatedContext::getEntered())
-        return context->scriptState();
-    Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
-    ASSERT(frame);
-    return frame->script()->mainWorldScriptState();
-}
-
 static NPObject* createNoScriptObject()
 {
     notImplemented();
@@ -434,8 +415,6 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement
 
 void ScriptController::clearWindowShell()
 {
-    m_mainWorldScriptState.clear();
-
     // V8 binding expects ScriptController::clearWindowShell only be called
     // when a frame is loading a new page. V8Proxy::clearForNavigation
     // creates a new context for the new page.
diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h
index 5a9105f..9815c7a 100644
--- a/WebCore/bindings/v8/ScriptController.h
+++ b/WebCore/bindings/v8/ScriptController.h
@@ -49,7 +49,6 @@ class Event;
 class Frame;
 class HTMLPlugInElement;
 class ScriptSourceCode;
-class ScriptState;
 class String;
 class Widget;
 class XSSAuditor;
@@ -167,12 +166,6 @@ public:
     void evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*) { }
     static void getAllWorlds(Vector<DOMWrapperWorld*>& worlds);
 
-    // Script state for the main world context.
-    ScriptState* mainWorldScriptState();
-
-    // Returns ScriptState for current context.
-    static ScriptState* currentScriptState();
-
 private:
     Frame* m_frame;
     const String* m_sourceURL;
@@ -195,9 +188,6 @@ private:
 #endif
     // The XSSAuditor associated with this ScriptController.
     OwnPtr<XSSAuditor> m_XSSAuditor;
-
-    // Script state for the main world context.
-    OwnPtr<ScriptState> m_mainWorldScriptState;
 };
 
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/ScriptScope.cpp b/WebCore/bindings/v8/ScriptScope.cpp
index 727ab25..a1b13a1 100644
--- a/WebCore/bindings/v8/ScriptScope.cpp
+++ b/WebCore/bindings/v8/ScriptScope.cpp
@@ -33,10 +33,6 @@
 
 #include "ScriptState.h"
 
-#include "Document.h"
-#include "Frame.h"
-#include "V8Binding.h"
-
 #include <v8.h>
 
 namespace WebCore {
@@ -45,8 +41,8 @@ ScriptScope::ScriptScope(ScriptState* scriptState, bool reportExceptions)
     : m_context(scriptState->context())
     , m_scope(m_context)
     , m_scriptState(scriptState)
-    , m_reportExceptions(reportExceptions)
 {
+    m_exceptionCatcher.SetVerbose(reportExceptions);
     ASSERT(!m_context.IsEmpty());
 }
 
@@ -54,11 +50,6 @@ bool ScriptScope::success()
 {
     if (!m_exceptionCatcher.HasCaught())
         return true;
-
-    v8::Local<v8::Message> message = m_exceptionCatcher.Message();
-    if (m_reportExceptions)
-        m_scriptState->frame()->document()->reportException(toWebCoreString(message->Get()), message->GetLineNumber(), toWebCoreString(message->GetScriptResourceName()));
-
     m_exceptionCatcher.Reset();
     return false;
 }
diff --git a/WebCore/bindings/v8/ScriptScope.h b/WebCore/bindings/v8/ScriptScope.h
index 6fee458..3f9a332 100644
--- a/WebCore/bindings/v8/ScriptScope.h
+++ b/WebCore/bindings/v8/ScriptScope.h
@@ -49,7 +49,6 @@ namespace WebCore {
         v8::Context::Scope m_scope;
         v8::TryCatch m_exceptionCatcher;
         ScriptState* m_scriptState;
-        bool m_reportExceptions;
     };
 
 }
diff --git a/WebCore/bindings/v8/ScriptState.cpp b/WebCore/bindings/v8/ScriptState.cpp
index 085fd2b..b38087c 100644
--- a/WebCore/bindings/v8/ScriptState.cpp
+++ b/WebCore/bindings/v8/ScriptState.cpp
@@ -35,22 +35,23 @@
 #include "Node.h"
 #include "Page.h"
 #include "ScriptController.h"
+#include "V8HiddenPropertyName.h"
 
+#include <v8.h>
 #include <wtf/Assertions.h>
 #include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
-ScriptState::ScriptState(Frame* frame)
-    : m_frame(frame)
-    , m_context(v8::Persistent<v8::Context>::New(V8Proxy::mainWorldContext(frame)))
+ScriptState::ScriptState(Frame*, v8::Handle<v8::Context> context)
+    : m_context(v8::Persistent<v8::Context>::New(context))
 {
 }
 
-ScriptState::ScriptState(Frame* frame, v8::Handle<v8::Context> context)
-    : m_frame(frame)
-    , m_context(v8::Persistent<v8::Context>::New(context))
+ScriptState::ScriptState(v8::Handle<v8::Context> context)
+    : m_context(v8::Persistent<v8::Context>::New(context))
 {
+    m_context.MakeWeak(this, &ScriptState::weakReferenceCallback);
 }
 
 ScriptState::~ScriptState()
@@ -59,6 +60,55 @@ ScriptState::~ScriptState()
     m_context.Clear();
 }
 
+ScriptState* ScriptState::forContext(v8::Local<v8::Context> context)
+{
+    v8::Context::Scope contextScope(context);
+
+    v8::Local<v8::Object> global = context->Global();
+    // Skip proxy object. The proxy object will survive page navigation while we need
+    // an object whose lifetime consides with that of the inspected context.
+    global = v8::Local<v8::Object>::Cast(global->GetPrototype());
+
+    v8::Handle<v8::String> key = V8HiddenPropertyName::scriptState();
+    v8::Local<v8::Value> val = global->GetHiddenValue(key);
+    if (!val.IsEmpty() && val->IsExternal())
+        return static_cast<ScriptState*>(v8::External::Cast(*val)->Value());
+
+    ScriptState* state = new ScriptState(context);
+    global->SetHiddenValue(key, v8::External::New(state));
+    return state;
+}
+
+ScriptState* ScriptState::current()
+{
+    v8::HandleScope handleScope;
+    v8::Local<v8::Context> context = v8::Context::GetCurrent();
+    if (context.IsEmpty()) {
+        ASSERT_NOT_REACHED();
+        return 0;
+    }
+    return ScriptState::forContext(context);
+}
+
+ScriptState* ScriptState::empty()
+{
+    DEFINE_STATIC_LOCAL(ScriptState, emptyState, (v8::Handle<v8::Context>()));
+    return &emptyState;
+}
+
+void ScriptState::weakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter)
+{
+    ScriptState* scriptState = static_cast<ScriptState*>(parameter);
+    delete scriptState;
+}
+
+ScriptState* mainWorldScriptState(Frame* frame)
+{
+    v8::HandleScope handleScope;
+    V8Proxy* proxy = frame->script()->proxy();
+    return ScriptState::forContext(proxy->mainWorldContext());
+}
+
 ScriptState* scriptStateFromNode(DOMWrapperWorld*, Node* node)
 {
     // This should be never reached with V8 bindings (WebKit only uses it
@@ -70,7 +120,7 @@ ScriptState* scriptStateFromNode(DOMWrapperWorld*, Node* node)
 ScriptState* scriptStateFromPage(DOMWrapperWorld*, Page* page)
 {
     // This should be only reached with V8 bindings from single process layout tests.
-    return page->mainFrame()->script()->mainWorldScriptState();
+    return mainWorldScriptState(page->mainFrame());
 }
 
 }
diff --git a/WebCore/bindings/v8/ScriptState.h b/WebCore/bindings/v8/ScriptState.h
index 8130092..e7eb102 100644
--- a/WebCore/bindings/v8/ScriptState.h
+++ b/WebCore/bindings/v8/ScriptState.h
@@ -44,10 +44,10 @@ namespace WebCore {
 
     class ScriptState : public Noncopyable {
     public:
-        ScriptState() { }
-        ScriptState(Frame* frame);
-        ScriptState(Frame* frame, v8::Handle<v8::Context> context);
+        // FIXME: This destructor will become private shortly.
         ~ScriptState();
+        // FIXME: This constructor will go away shortly.
+        ScriptState(Frame*, v8::Handle<v8::Context>);
 
         bool hadException() { return !m_exception.IsEmpty(); }
         void setException(v8::Local<v8::Value> exception)
@@ -56,18 +56,27 @@ namespace WebCore {
         }
         v8::Local<v8::Value> exception() { return m_exception; }
 
-        Frame* frame() const { return m_frame; }
         v8::Local<v8::Context> context() const
         {
             return v8::Local<v8::Context>::New(m_context);
         }
 
+        static ScriptState* forContext(v8::Local<v8::Context>);
+        static ScriptState* current();
+        static ScriptState* empty();
+
     private:
+        friend ScriptState* mainWorldScriptState(Frame*);
+        explicit ScriptState(v8::Handle<v8::Context>);
+
+        static void weakReferenceCallback(v8::Persistent<v8::Value> object, void* parameter);
+
         v8::Local<v8::Value> m_exception;
-        Frame* m_frame;
         v8::Persistent<v8::Context> m_context;
     };
 
+    ScriptState* mainWorldScriptState(Frame*);
+
     ScriptState* scriptStateFromNode(DOMWrapperWorld*, Node*);
     ScriptState* scriptStateFromPage(DOMWrapperWorld*, Page*);
 
diff --git a/WebCore/bindings/v8/V8HiddenPropertyName.h b/WebCore/bindings/v8/V8HiddenPropertyName.h
index bb1ca4c..0bfadd9 100644
--- a/WebCore/bindings/v8/V8HiddenPropertyName.h
+++ b/WebCore/bindings/v8/V8HiddenPropertyName.h
@@ -39,6 +39,7 @@ namespace WebCore {
     V(objectPrototype) \
     V(listener) \
     V(attributeListener) \
+    V(scriptState) \
     V(sleepFunction) \
     V(toStringString)
 
diff --git a/WebCore/bindings/v8/V8IsolatedContext.cpp b/WebCore/bindings/v8/V8IsolatedContext.cpp
index 4db1efe..3237ede 100644
--- a/WebCore/bindings/v8/V8IsolatedContext.cpp
+++ b/WebCore/bindings/v8/V8IsolatedContext.cpp
@@ -89,14 +89,4 @@ V8IsolatedContext::~V8IsolatedContext()
     m_context->disposeHandle();
 }
 
-ScriptState* V8IsolatedContext::scriptState()
-{
-    if (!m_scriptState) {
-        v8::HandleScope scope;
-        v8::Handle<v8::Context> context = m_context.get()->get();
-        m_scriptState.set(new ScriptState(V8Proxy::retrieveFrame(context), context));
-    }
-    return m_scriptState.get();
-}
-
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/V8IsolatedContext.h b/WebCore/bindings/v8/V8IsolatedContext.h
index 3844b57..70ca270 100644
--- a/WebCore/bindings/v8/V8IsolatedContext.h
+++ b/WebCore/bindings/v8/V8IsolatedContext.h
@@ -94,8 +94,6 @@ public:
 
     IsolatedWorld* world() const { return m_world.get(); }
 
-    ScriptState* scriptState();
-
 private:
     static v8::Handle<v8::Object> getGlobalObject(v8::Handle<v8::Context> context)
     {
@@ -111,9 +109,6 @@ private:
     RefPtr<SharedPersistent<v8::Context> > m_context;
 
     RefPtr<IsolatedWorld> m_world;
-
-    // FIXME: get rid of redundant m_context field. The context can be retrieved from the ScriptState.
-    OwnPtr<ScriptState> m_scriptState;
 };
 
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/V8Utilities.cpp b/WebCore/bindings/v8/V8Utilities.cpp
index c547cc7..fb1ecaa 100644
--- a/WebCore/bindings/v8/V8Utilities.cpp
+++ b/WebCore/bindings/v8/V8Utilities.cpp
@@ -134,13 +134,15 @@ ScriptExecutionContext* getScriptExecutionContext(ScriptState* scriptState)
         return proxy->workerContext()->scriptExecutionContext();
 #endif
 
-    if (scriptState)
-        return scriptState->frame()->document()->scriptExecutionContext();
-    else {
-        Frame* frame = V8Proxy::retrieveFrameForCurrentContext();
-        if (frame)
-            return frame->document()->scriptExecutionContext();
-    }
+    Frame* frame;
+    if (scriptState) {
+        v8::HandleScope handleScope;
+        frame = V8Proxy::retrieveFrame(scriptState->context());
+    } else
+        frame = V8Proxy::retrieveFrameForCurrentContext();
+
+    if (frame)
+        return frame->document()->scriptExecutionContext();
 
     return 0;
 }
@@ -170,7 +172,7 @@ void reportException(ScriptState* scriptState, v8::TryCatch& exceptionCatcher)
     ScriptExecutionContext* context = getScriptExecutionContext(scriptState);
     // During the frame teardown, there may not be a valid context.
     if (context && !context->isDocument())
-      context->reportException(errorMessage, lineNumber, sourceURL);
+        context->reportException(errorMessage, lineNumber, sourceURL);
     exceptionCatcher.Reset();
 }
 
diff --git a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
index 1c077f7..89143f1 100644
--- a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp
@@ -63,9 +63,8 @@ v8::Handle<v8::Value> V8NodeIterator::nextNodeCallback(const v8::Arguments& args
     NodeIterator* nodeIterator = V8NodeIterator::toNative(args.Holder());
 
     ExceptionCode ec = 0;
-    ScriptState state;
-    RefPtr<Node> result = nodeIterator->nextNode(&state, ec);
-    return toV8(result.release(), ec, &state);
+    RefPtr<Node> result = nodeIterator->nextNode(ScriptState::empty(), ec);
+    return toV8(result.release(), ec, ScriptState::empty());
 }
 
 v8::Handle<v8::Value> V8NodeIterator::previousNodeCallback(const v8::Arguments& args)
@@ -74,9 +73,8 @@ v8::Handle<v8::Value> V8NodeIterator::previousNodeCallback(const v8::Arguments&
     NodeIterator* nodeIterator = V8NodeIterator::toNative(args.Holder());
 
     ExceptionCode ec = 0;
-    ScriptState state;
-    RefPtr<Node> result = nodeIterator->previousNode(&state, ec);
-    return toV8(result.release(), ec, &state);
+    RefPtr<Node> result = nodeIterator->previousNode(ScriptState::empty(), ec);
+    return toV8(result.release(), ec, ScriptState::empty());
 }
 
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
index ecf217c..80182f5 100644
--- a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp
@@ -60,9 +60,8 @@ v8::Handle<v8::Value> V8TreeWalker::parentNodeCallback(const v8::Arguments& args
     INC_STATS("DOM.TreeWalker.parentNode()");
     TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
 
-    ScriptState state;
-    RefPtr<Node> result = treeWalker->parentNode(&state);
-    return toV8(result.release(), &state);
+    RefPtr<Node> result = treeWalker->parentNode(ScriptState::empty());
+    return toV8(result.release(), ScriptState::empty());
 }
 
 v8::Handle<v8::Value> V8TreeWalker::firstChildCallback(const v8::Arguments& args)
@@ -70,9 +69,8 @@ v8::Handle<v8::Value> V8TreeWalker::firstChildCallback(const v8::Arguments& args
     INC_STATS("DOM.TreeWalker.firstChild()");
     TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
 
-    ScriptState state;
-    RefPtr<Node> result = treeWalker->firstChild(&state);
-    return toV8(result.release(), &state);
+    RefPtr<Node> result = treeWalker->firstChild(ScriptState::empty());
+    return toV8(result.release(), ScriptState::empty());
 }
 
 v8::Handle<v8::Value> V8TreeWalker::lastChildCallback(const v8::Arguments& args)
@@ -80,9 +78,8 @@ v8::Handle<v8::Value> V8TreeWalker::lastChildCallback(const v8::Arguments& args)
     INC_STATS("DOM.TreeWalker.lastChild()");
     TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
 
-    ScriptState state;
-    RefPtr<Node> result = treeWalker->lastChild(&state);
-    return toV8(result.release(), &state);
+    RefPtr<Node> result = treeWalker->lastChild(ScriptState::empty());
+    return toV8(result.release(), ScriptState::empty());
 }
 
 v8::Handle<v8::Value> V8TreeWalker::nextNodeCallback(const v8::Arguments& args)
@@ -90,9 +87,8 @@ v8::Handle<v8::Value> V8TreeWalker::nextNodeCallback(const v8::Arguments& args)
     INC_STATS("DOM.TreeWalker.nextNode()");
     TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
 
-    ScriptState state;
-    RefPtr<Node> result = treeWalker->nextNode(&state);
-    return toV8(result.release(), &state);
+    RefPtr<Node> result = treeWalker->nextNode(ScriptState::empty());
+    return toV8(result.release(), ScriptState::empty());
 }
 
 v8::Handle<v8::Value> V8TreeWalker::previousNodeCallback(const v8::Arguments& args)
@@ -100,9 +96,8 @@ v8::Handle<v8::Value> V8TreeWalker::previousNodeCallback(const v8::Arguments& ar
     INC_STATS("DOM.TreeWalker.previousNode()");
     TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
 
-    ScriptState state;
-    RefPtr<Node> result = treeWalker->previousNode(&state);
-    return toV8(result.release(), &state);
+    RefPtr<Node> result = treeWalker->previousNode(ScriptState::empty());
+    return toV8(result.release(), ScriptState::empty());
 }
 
 v8::Handle<v8::Value> V8TreeWalker::nextSiblingCallback(const v8::Arguments& args)
@@ -110,9 +105,8 @@ v8::Handle<v8::Value> V8TreeWalker::nextSiblingCallback(const v8::Arguments& arg
     INC_STATS("DOM.TreeWalker.nextSibling()");
     TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
 
-    ScriptState state;
-    RefPtr<Node> result = treeWalker->nextSibling(&state);
-    return toV8(result.release(), &state);
+    RefPtr<Node> result = treeWalker->nextSibling(ScriptState::empty());
+    return toV8(result.release(), ScriptState::empty());
 }
 
 v8::Handle<v8::Value> V8TreeWalker::previousSiblingCallback(const v8::Arguments& args)
@@ -120,9 +114,8 @@ v8::Handle<v8::Value> V8TreeWalker::previousSiblingCallback(const v8::Arguments&
     INC_STATS("DOM.TreeWalker.previousSibling()");
     TreeWalker* treeWalker = V8TreeWalker::toNative(args.Holder());
 
-    ScriptState state;
-    RefPtr<Node> result = treeWalker->previousSibling(&state);
-    return toV8(result.release(), &state);
+    RefPtr<Node> result = treeWalker->previousSibling(ScriptState::empty());
+    return toV8(result.release(), ScriptState::empty());
 }
 
 } // namespace WebCore
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 0c947f7..5ab1354 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -1845,7 +1845,7 @@ ScriptObject InspectorController::injectedScriptForNodeId(long id)
         frame = m_inspectedPage->mainFrame();
 
     if (frame)
-        return m_injectedScriptHost->injectedScriptFor(frame->script()->mainWorldScriptState());
+        return m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame));
 
     return ScriptObject();
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list