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

oliver at apple.com oliver at apple.com
Thu Feb 4 21:26:46 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 03f44f882c408c3a1ac4dcc437bb82ba4cce6e75
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Jan 24 22:54:18 2010 +0000

    2010-01-24  Oliver Hunt  <oliver at apple.com>
    
            Reviewed by Darin Adler.
    
            Object Serialization assumes deserialization will always occur in the context of a webpage
            https://bugs.webkit.org/show_bug.cgi?id=34056
            rdar://7573833
    
            Added ClassInfo to JSDOMGlobalObject and make the window and worker class info
            inherit from it.  With this in place we're able to determine whether a given
            global object is a DOMGlobalObject, and then use that information to avoid
            attempting to deserialize types that require the presence of the DOM.
    
            No test as all global objects in webkit inherit from JSDOMGlobalObject.
    
            * bindings/js/JSDOMGlobalObject.cpp:
            (WebCore::):
            * bindings/js/JSDOMGlobalObject.h:
            (WebCore::JSDOMGlobalObject::classInfo):
            * bindings/js/JSDOMWindowBase.cpp:
            (WebCore::):
            * bindings/js/JSWorkerContextBase.cpp:
            (WebCore::):
            * bindings/js/SerializedScriptValue.cpp:
            (WebCore::DeserializingTreeWalker::DeserializingTreeWalker):
            (WebCore::DeserializingTreeWalker::convertIfTerminal):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53785 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 630f61e..b9e05fd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-01-24  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Object Serialization assumes deserialization will always occur in the context of a webpage
+        https://bugs.webkit.org/show_bug.cgi?id=34056
+        rdar://7573833
+
+        Added ClassInfo to JSDOMGlobalObject and make the window and worker class info
+        inherit from it.  With this in place we're able to determine whether a given
+        global object is a DOMGlobalObject, and then use that information to avoid
+        attempting to deserialize types that require the presence of the DOM.
+
+        No test as all global objects in webkit inherit from JSDOMGlobalObject.
+
+        * bindings/js/JSDOMGlobalObject.cpp:
+        (WebCore::):
+        * bindings/js/JSDOMGlobalObject.h:
+        (WebCore::JSDOMGlobalObject::classInfo):
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::):
+        * bindings/js/JSWorkerContextBase.cpp:
+        (WebCore::):
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::DeserializingTreeWalker::DeserializingTreeWalker):
+        (WebCore::DeserializingTreeWalker::convertIfTerminal):
+
 2010-01-24  Eric Carlson  <eric.carlson at apple.com>
 
         Reviewed by Simon Fraser.
diff --git a/WebCore/bindings/js/JSDOMGlobalObject.cpp b/WebCore/bindings/js/JSDOMGlobalObject.cpp
index 8310fd1..e0b5b89 100644
--- a/WebCore/bindings/js/JSDOMGlobalObject.cpp
+++ b/WebCore/bindings/js/JSDOMGlobalObject.cpp
@@ -40,6 +40,8 @@ using namespace JSC;
 
 namespace WebCore {
 
+const ClassInfo JSDOMGlobalObject::s_info = { "DOMGlobalObject", 0, 0, 0 };
+
 JSDOMGlobalObject::JSDOMGlobalObject(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject::JSDOMGlobalObjectData* data, JSObject* thisValue)
     : JSGlobalObject(structure, data, thisValue)
 {
diff --git a/WebCore/bindings/js/JSDOMGlobalObject.h b/WebCore/bindings/js/JSDOMGlobalObject.h
index a5d410e..8eb55c1 100644
--- a/WebCore/bindings/js/JSDOMGlobalObject.h
+++ b/WebCore/bindings/js/JSDOMGlobalObject.h
@@ -67,6 +67,9 @@ namespace WebCore {
 
         DOMWrapperWorld* world() { return d()->m_world.get(); }
 
+        virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
+        static const JSC::ClassInfo s_info;
+
     protected:
         struct JSDOMGlobalObjectData : public JSC::JSGlobalObject::JSGlobalObjectData {
             JSDOMGlobalObjectData(DOMWrapperWorld* world, Destructor destructor = destroyJSDOMGlobalObjectData)
diff --git a/WebCore/bindings/js/JSDOMWindowBase.cpp b/WebCore/bindings/js/JSDOMWindowBase.cpp
index 176066e..5b3b6df 100644
--- a/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -41,7 +41,7 @@ using namespace JSC;
 
 namespace WebCore {
 
-const ClassInfo JSDOMWindowBase::s_info = { "Window", 0, 0, 0 };
+const ClassInfo JSDOMWindowBase::s_info = { "Window", &JSDOMGlobalObject::s_info, 0, 0 };
 
 JSDOMWindowBase::JSDOMWindowBaseData::JSDOMWindowBaseData(PassRefPtr<DOMWindow> window, JSDOMWindowShell* shell)
     : JSDOMGlobalObjectData(shell->world(), destroyJSDOMWindowBaseData)
diff --git a/WebCore/bindings/js/JSWorkerContextBase.cpp b/WebCore/bindings/js/JSWorkerContextBase.cpp
index f0c4efa..2491f4d 100644
--- a/WebCore/bindings/js/JSWorkerContextBase.cpp
+++ b/WebCore/bindings/js/JSWorkerContextBase.cpp
@@ -42,7 +42,7 @@ namespace WebCore {
 
 ASSERT_CLASS_FITS_IN_CELL(JSWorkerContextBase);
 
-const ClassInfo JSWorkerContextBase::s_info = { "WorkerContext", 0, 0, 0 };
+const ClassInfo JSWorkerContextBase::s_info = { "WorkerContext", &JSDOMGlobalObject::s_info, 0, 0 };
 
 JSWorkerContextBase::JSWorkerContextBase(NonNullPassRefPtr<JSC::Structure> structure, PassRefPtr<WorkerContext> impl)
     : JSDOMGlobalObject(structure, new JSDOMGlobalObjectData(normalWorld(*impl->script()->globalData())), this)
diff --git a/WebCore/bindings/js/SerializedScriptValue.cpp b/WebCore/bindings/js/SerializedScriptValue.cpp
index b38a009..23a3772 100644
--- a/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -614,6 +614,8 @@ struct DeserializingTreeWalker : public BaseWalker {
 
     DeserializingTreeWalker(ExecState* exec, bool mustCopy)
         : BaseWalker(exec)
+        , m_globalObject(exec->lexicalGlobalObject())
+        , m_isDOMGlobalObject(m_globalObject->inherits(&JSDOMGlobalObject::s_info))
         , m_mustCopy(mustCopy)
     {
     }
@@ -694,8 +696,12 @@ struct DeserializingTreeWalker : public BaseWalker {
             case SerializedScriptValueData::DateType:
                 return new (m_exec) DateInstance(m_exec, value.asDouble());
             case SerializedScriptValueData::FileType:
+                if (!m_isDOMGlobalObject)
+                    return jsNull();
                 return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject()), File::create(value.asString().crossThreadString()));
             case SerializedScriptValueData::FileListType: {
+                if (!m_isDOMGlobalObject)
+                    return jsNull();
                 RefPtr<FileList> result = FileList::create();
                 SerializedFileList* serializedFileList = value.asFileList();
                 unsigned length = serializedFileList->length();
@@ -746,6 +752,8 @@ struct DeserializingTreeWalker : public BaseWalker {
     }
 
 private:
+    JSGlobalObject* m_globalObject;
+    bool m_isDOMGlobalObject;
     bool m_mustCopy;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list