JavaScriptCore:
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2008 23:16:37 +0000 (23:16 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 Jan 2008 23:16:37 +0000 (23:16 +0000)
        Reviewed by Darin and Adam.

        <rdar://problem/5688975>
        div element on microsoft site has wrong left offset.

        Return true even if NPN_GetProperty returns null or undefined. This matches Firefox
        (and is what the Silverlight plug-in expects).

        * bindings/NP_jsobject.cpp:
        (_NPN_GetProperty):

WebKitTools:

        Reviewed by Darin and Adam.

        <rdar://problem/5688975>
        div element on microsoft site has wrong left offset.

        Add new method for testing the return vale of NPN_GetProperty.

        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
        (pluginInvoke):

LayoutTests:

        Reviewed by Darin and Adam.

        <rdar://problem/5688975>
        div element on microsoft site has wrong left offset.

        Add test.

        * plugins/netscape-get-property-return-value-expected.txt: Added.
        * plugins/netscape-get-property-return-value.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29726 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/bindings/NP_jsobject.cpp
LayoutTests/ChangeLog
LayoutTests/plugins/netscape-get-property-return-value-expected.txt [new file with mode: 0644]
LayoutTests/plugins/netscape-get-property-return-value.html [new file with mode: 0644]
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp

index 0979377..ab9f72b 100644 (file)
@@ -1,3 +1,16 @@
+2008-01-22  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Darin and Adam.
+
+        <rdar://problem/5688975>
+        div element on microsoft site has wrong left offset.
+        
+        Return true even if NPN_GetProperty returns null or undefined. This matches Firefox 
+        (and is what the Silverlight plug-in expects).
+        
+        * bindings/NP_jsobject.cpp:
+        (_NPN_GetProperty):
+
 2008-01-21  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Maciej Stachowiak.
index 4eef8f6..059b5df 100644 (file)
@@ -239,14 +239,6 @@ bool _NPN_GetProperty(NPP, NPObject* o, NPIdentifier propertyName, NPVariant* va
         else
             result = obj->imp->get(exec, i->value.number);
 
-        if (result->isNull()) {
-            NULL_TO_NPVARIANT(*variant);
-            return false;
-        }
-        if (result->isUndefined()) {
-            VOID_TO_NPVARIANT(*variant);
-            return false;
-        }
         convertValueToNPVariant(exec, result, variant);
         return true;
     }
index bea8a68..1c87445 100644 (file)
@@ -1,3 +1,15 @@
+2008-01-22  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Darin and Adam.
+
+        <rdar://problem/5688975>
+        div element on microsoft site has wrong left offset.
+        
+        Add test.
+        
+        * plugins/netscape-get-property-return-value-expected.txt: Added.
+        * plugins/netscape-get-property-return-value.html: Added.
+
 2008-01-22  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Adam Roben.
diff --git a/LayoutTests/plugins/netscape-get-property-return-value-expected.txt b/LayoutTests/plugins/netscape-get-property-return-value-expected.txt
new file mode 100644 (file)
index 0000000..30a0c68
--- /dev/null
@@ -0,0 +1,2 @@
+ This tests that we return the correct return value when a plug-in calls NPN_GetProperty.
+SUCCESS
diff --git a/LayoutTests/plugins/netscape-get-property-return-value.html b/LayoutTests/plugins/netscape-get-property-return-value.html
new file mode 100644 (file)
index 0000000..1db1fa6
--- /dev/null
@@ -0,0 +1,42 @@
+<html>
+<script>
+function runTest()
+{
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+        
+    var plugin = document.getElementById("testPlugin");
+    var result = document.getElementById('result');
+    var o = { stringProperty : 'foo', nullProperty : null, undefinedProperty : undefined };
+    
+    if (!plugin.testGetPropertyReturnValue(o, 'stringProperty')) {
+        result.innerHTML = "FAILURE: getting stringProperty returned false";
+        return;
+    }    
+    
+    if (!plugin.testGetPropertyReturnValue(o, 'nullProperty')) {
+        result.innerHTML = "FAILURE: getting nullProperty returned false";
+        return;
+    }
+    
+    if (!plugin.testGetPropertyReturnValue(o, 'undefinedProperty')) {
+        result.innerHTML = "FAILURE: getting undefinedProperty returned false";
+        return;
+    }
+    
+    if (!plugin.testGetPropertyReturnValue(o, 'nonExistentProperty')) {
+        result.innerHTML = "FAILURE: getting undefinedProperty returned false";
+        return;
+    }
+
+    result.innerHTML = 'SUCCESS';
+}
+</script>
+
+<body onload="runTest();">
+<embed id="testPlugin" type="application/x-webkit-test-netscape" width="200" height="200"></embed>
+This tests that we return the correct return value when a plug-in calls NPN_GetProperty.
+<div id="result">FAILURE</div>
+</body>
+</html>
index 5ff7749..b804ed1 100644 (file)
@@ -1,3 +1,15 @@
+2008-01-22  Anders Carlsson  <andersca@apple.com>
+
+        Reviewed by Darin and Adam.
+
+        <rdar://problem/5688975>
+        div element on microsoft site has wrong left offset.
+        
+        Add new method for testing the return vale of NPN_GetProperty.
+        
+        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
+        (pluginInvoke):
+
 2008-01-22  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Adam Roben.
index 36799ff..4cd4c04 100644 (file)
@@ -96,7 +96,8 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
 #define ID_TEST_GETINTIDENTIFIER    8
 #define ID_TEST_GET_PROPERTY        9
 #define ID_TEST_EVALUATE            10
-#define NUM_METHOD_IDENTIFIERS      11
+#define ID_TEST_GET_PROPERTY_RETURN_VALUE 11
+#define NUM_METHOD_IDENTIFIERS      12
 
 static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
 static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
@@ -111,6 +112,7 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
     "testGetIntIdentifier",
     "testGetProperty",
     "testEvaluate",
+    "testGetPropertyReturnValue",
 };
 
 static NPUTF8* createCStringFromNPVariant(const NPVariant *variant)
@@ -358,8 +360,20 @@ static bool pluginInvoke(NPObject *header, NPIdentifier name, const NPVariant *a
         
         VOID_TO_NPVARIANT(*result);
         return false;
+    } else if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY_RETURN_VALUE] &&
+        argCount == 2 && NPVARIANT_IS_OBJECT(args[0]) && NPVARIANT_IS_STRING(args[1])) {
+        NPUTF8* propertyString = createCStringFromNPVariant(&args[1]);
+        NPIdentifier propertyIdentifier = browser->getstringidentifier(propertyString);
+        free(propertyString);
+
+        NPVariant variant;
+        bool retval = browser->getproperty(obj->npp, NPVARIANT_TO_OBJECT(args[0]), propertyIdentifier, &variant);
+        if (retval)
+            browser->releasevariantvalue(&variant);
+
+        BOOLEAN_TO_NPVARIANT(retval, *result);
+        return true;
     }
-        
     return false;
 }