[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 11:32:37 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e40007e07e8573a4c55c02d71c8885fb20561e23
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 28 22:09:08 2010 +0000

    Implement JSNPObject::put
    https://bugs.webkit.org/show_bug.cgi?id=43149
    
    Reviewed by Sam Weinig.
    
    WebKit2:
    
    * WebProcess/Plugins/JSNPObject.cpp:
    (WebKit::JSNPObject::getOwnPropertySlot):
    Fix a typo.
    
    (WebKit::JSNPObject::getOwnPropertyDescriptor):
    Implement this in the same way as it's implemented in RuntimeObject.
    
    (WebKit::JSNPObject::put):
    Implement this, call NPClass::setProperty.
    
    * WebProcess/Plugins/JSNPObject.h:
    
    LayoutTests:
    
    * platform/mac-wk2/Skipped:
    Remove now passing tests.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64235 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9ed9c3e..859f939 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -26,6 +26,16 @@
 
         Reviewed by Sam Weinig.
 
+        Implement JSNPObject::put
+        https://bugs.webkit.org/show_bug.cgi?id=43149
+
+        * platform/mac-wk2/Skipped:
+        Remove now passing tests.
+    
+2010-07-28  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
         Add support for calling NPObject methods
         https://bugs.webkit.org/show_bug.cgi?id=43145
 
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index f5447e3..b472955 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -1414,13 +1414,11 @@ plugins/netscape-plugin-setwindow-size.html
 plugins/npruntime/bindings-test.html
 plugins/npruntime/enumerate.html
 plugins/npruntime/get-property-return-value.html
-plugins/npruntime/identifier-conversion.html
 plugins/npruntime/invoke-browserfuncs.html
 plugins/npruntime/invoke-default.html
 plugins/npruntime/invoke.html
 plugins/npruntime/npruntime.html
 plugins/npruntime/round-trip-npobject.html
-plugins/npruntime/set-property.html
 plugins/override-node-method.html
 plugins/plugin-javascript-access.html
 plugins/plugin-remove-subframe.html
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index c5bb70f..e641ea1 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -129,6 +129,25 @@
 
         Reviewed by Sam Weinig.
 
+        Implement JSNPObject::put
+        https://bugs.webkit.org/show_bug.cgi?id=43149
+
+        * WebProcess/Plugins/JSNPObject.cpp:
+        (WebKit::JSNPObject::getOwnPropertySlot):
+        Fix a typo.
+
+        (WebKit::JSNPObject::getOwnPropertyDescriptor):
+        Implement this in the same way as it's implemented in RuntimeObject.
+
+        (WebKit::JSNPObject::put):
+        Implement this, call NPClass::setProperty.
+
+        * WebProcess/Plugins/JSNPObject.h:
+
+2010-07-28  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
         Add support for calling NPObject methods
         https://bugs.webkit.org/show_bug.cgi?id=43145
 
diff --git a/WebKit2/WebProcess/Plugins/JSNPObject.cpp b/WebKit2/WebProcess/Plugins/JSNPObject.cpp
index 4a93636..2296607 100644
--- a/WebKit2/WebProcess/Plugins/JSNPObject.cpp
+++ b/WebKit2/WebProcess/Plugins/JSNPObject.cpp
@@ -110,7 +110,7 @@ bool JSNPObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyN
         return true;
     }
 
-    // Second, check is the NPObject has a method with this name.
+    // Second, check if the NPObject has a method with this name.
     if (m_npObject->_class->hasMethod && m_npObject->_class->hasMethod(m_npObject, npIdentifier)) {
         slot.setCustom(this, methodGetter);
         return true;
@@ -119,6 +119,65 @@ bool JSNPObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyN
     return false;
 }
 
+bool JSNPObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
+{
+    if (!m_npObject) {
+        throwInvalidAccessError(exec);
+        return false;
+    }
+
+    NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName);
+
+    // First, check if the NPObject has a property with this name.
+    if (m_npObject->_class->hasProperty && m_npObject->_class->hasProperty(m_npObject, npIdentifier)) {
+        PropertySlot slot;
+        slot.setCustom(this, propertyGetter);
+        descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete);
+        return true;
+    }
+
+    // Second, check if the NPObject has a method with this name.
+    if (m_npObject->_class->hasMethod && m_npObject->_class->hasMethod(m_npObject, npIdentifier)) {
+        PropertySlot slot;
+        slot.setCustom(this, methodGetter);
+        descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
+        return true;
+    }
+
+    return false;
+}
+
+void JSNPObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot&)
+{
+    if (!m_npObject) {
+        throwInvalidAccessError(exec);
+        return;
+    }
+
+    NPIdentifier npIdentifier = npIdentifierFromIdentifier(propertyName);
+    
+    if (!m_npObject->_class->hasProperty || !m_npObject->_class->hasProperty(m_npObject, npIdentifier)) {
+        // FIXME: Should we throw an exception here?
+        return;
+    }
+
+    if (!m_npObject->_class->setProperty)
+        return;
+
+    NPVariant variant;
+    m_objectMap->convertJSValueToNPVariant(exec, value, variant);
+    {
+        JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
+        m_npObject->_class->setProperty(m_npObject, npIdentifier, &variant);
+
+        // FIXME: Handle setProperty setting an exception.
+        // FIXME: Find out what happens if calling setProperty causes the plug-in to go away.
+        // FIXME: Should we throw an exception if setProperty returns false?
+    }
+
+    releaseNPVariantValue(&variant);
+}
+
 JSValue JSNPObject::propertyGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
     JSNPObject* thisObj = static_cast<JSNPObject*>(asObject(slotBase));
diff --git a/WebKit2/WebProcess/Plugins/JSNPObject.h b/WebKit2/WebProcess/Plugins/JSNPObject.h
index 7419ad1..1345abb 100644
--- a/WebKit2/WebProcess/Plugins/JSNPObject.h
+++ b/WebKit2/WebProcess/Plugins/JSNPObject.h
@@ -55,6 +55,8 @@ private:
     }
 
     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);
+    virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);
+    virtual void put(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);
 
     static JSC::JSValue propertyGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
     static JSC::JSValue methodGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list