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

tony at chromium.org tony at chromium.org
Wed Dec 22 15:49:14 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 713ba0c0e7cb86f94e58c83894df1af4ddff422a
Author: tony at chromium.org <tony at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Nov 13 00:34:19 2010 +0000

    2010-11-12  Tony Chang  <tony at chromium.org>
    
            Reviewed by Adam Barth.
    
            run platform/chromium/plugins/script-object-invoke.html on all platforms
            https://bugs.webkit.org/show_bug.cgi?id=49280
    
            * platform/chromium/drt_expectations.txt:
            * plugins/script-object-invoke-expected.txt: Renamed from LayoutTests/platform/chromium/plugins/script-object-invoke-expected.txt.
            * plugins/script-object-invoke.html: Renamed from LayoutTests/platform/chromium/plugins/script-object-invoke.html.
    2010-11-12  Tony Chang  <tony at chromium.org>
    
            Reviewed by Adam Barth.
    
            run platform/chromium/plugins/script-object-invoke.html on all platforms
            https://bugs.webkit.org/show_bug.cgi?id=49280
    
            * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
            (testScriptObjectInvoke):
            (pluginInvoke):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71955 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2795ab5..720d861 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-12  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        run platform/chromium/plugins/script-object-invoke.html on all platforms
+        https://bugs.webkit.org/show_bug.cgi?id=49280
+
+        * platform/chromium/drt_expectations.txt:
+        * plugins/script-object-invoke-expected.txt: Renamed from LayoutTests/platform/chromium/plugins/script-object-invoke-expected.txt.
+        * plugins/script-object-invoke.html: Renamed from LayoutTests/platform/chromium/plugins/script-object-invoke.html.
+
 2010-11-12  Mihai Parparita  <mihaip at chromium.org>
 
         Unreviewed Chromium expectations update.
diff --git a/LayoutTests/platform/chromium/drt_expectations.txt b/LayoutTests/platform/chromium/drt_expectations.txt
index a1039b5..612c8df 100644
--- a/LayoutTests/platform/chromium/drt_expectations.txt
+++ b/LayoutTests/platform/chromium/drt_expectations.txt
@@ -81,7 +81,6 @@ BUG_DRT MAC : plugins/reloadplugins-no-pages.html = PASS
 BUG_DRT MAC : plugins/reloadplugins-and-pages.html = PASS
 BUG_DRT MAC : plugins/update-widgets-crash.html = PASS
 BUG_DRT MAC : platform/chromium/plugins/refcount-leaks.html = TEXT
-BUG_DRT MAC : platform/chromium/plugins/script-object-invoke.html = TEXT
 
 // This test is failing because the plugin is currently named
 // WebKitTestNetscapePlugin because the fork in the Chromium repo is named
diff --git a/LayoutTests/platform/chromium/plugins/script-object-invoke-expected.txt b/LayoutTests/platform/chromium/plugins/script-object-invoke-expected.txt
deleted file mode 100644
index 2ecbc63..0000000
--- a/LayoutTests/platform/chromium/plugins/script-object-invoke-expected.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Test proper tracking of script NPObjects
-
-Test 1: Ensure that script NPObjects are properly tracked (i.e. added to
-        the live objects map in V8). 
-
-Test 2: Test tracking of derived NPObjects by invoking a method on a
-        script object and passing it an internally created NPObject.
-
-SUCCESS
diff --git a/LayoutTests/platform/chromium/plugins/script-object-invoke.html b/LayoutTests/platform/chromium/plugins/script-object-invoke.html
deleted file mode 100644
index 50fd263..0000000
--- a/LayoutTests/platform/chromium/plugins/script-object-invoke.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<html>
-<script>
-// A simple script object with a member function that takes 
-// an NPObject as an argument
-FactoryFunction = function() {
-    var TestObject = function() {
-    };
-
-    TestObject.prototype.createObject = function(plugin) {
-        var new_object = plugin.testCloneObject();
-        return new_object;
-    };
-
-    var s = new TestObject();
-    return s;
-};
-
-function new_script_object() {
-    return FactoryFunction();
-}
-
-function runTest()
-{
-    if (window.layoutTestController)
-        layoutTestController.dumpAsText();
-
-    var plugin = document.getElementById("testPlugin");
-    var returned_object = plugin.testScriptObjectInvoke("new_script_object", "createObject", plugin);
-
-    /* Bug# 1175346 - This will crash in single process mode (or test shell)
-       TODO(joshia): Enable this and fix the NPObject cleanup so that
-                     it works in single process mode.
-    plugin.parentNode.removeChild(plugin);
-
-    try {
-        returned_object.property;
-    } catch (e) {
-        if (e instanceof ReferenceError)
-            document.getElementById("result").innerHTML = "SUCCESS";
-    }
-    */
-    
-    document.getElementById("result").innerHTML = "SUCCESS";
-}
-</script>
-
-<body onload="runTest();">
-<pre>
-Test proper tracking of script NPObjects
-
-Test 1: Ensure that script NPObjects are properly tracked (i.e. added to
-        the live objects map in V8). 
-
-Test 2: Test tracking of derived NPObjects by invoking a method on a
-        script object and passing it an internally created NPObject.
-
-<div id="result">FAILURE</div>
-<embed id="testPlugin" type="application/x-webkit-test-netscape" width="200" height="200"></embed>
-</body>
-</html>
diff --git a/LayoutTests/plugins/script-object-invoke-expected.txt b/LayoutTests/plugins/script-object-invoke-expected.txt
new file mode 100644
index 0000000..5aac8f6
--- /dev/null
+++ b/LayoutTests/plugins/script-object-invoke-expected.txt
@@ -0,0 +1,14 @@
+Test proper tracking of script NPObjects
+
+Test 1: Ensure that script NPObjects are properly tracked (i.e. added to
+        the live objects map in V8).
+
+Test 2: Test tracking of derived NPObjects by invoking a method on a
+        script object and passing it an internally created NPObject.
+
+SUCCESS
+
+
+
+
+
diff --git a/LayoutTests/plugins/script-object-invoke.html b/LayoutTests/plugins/script-object-invoke.html
new file mode 100644
index 0000000..16b45c1
--- /dev/null
+++ b/LayoutTests/plugins/script-object-invoke.html
@@ -0,0 +1,56 @@
+<html>
+<script>
+// A simple script object with a member function that takes
+// an NPObject as an argument
+FactoryFunction = function() {
+    var TestObject = function() {
+    };
+
+    TestObject.prototype.createObject = function(plugin) {
+        var new_object = plugin.testCloneObject();
+        return new_object;
+    };
+
+    var s = new TestObject();
+    return s;
+};
+
+function new_script_object() {
+    return FactoryFunction();
+}
+
+function runTest()
+{
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    var plugin = document.getElementById("testPlugin");
+    var returned_object = plugin.testScriptObjectInvoke("new_script_object", "createObject");
+
+    // Make sure the cloned object outlives the plugin.
+    plugin.parentNode.removeChild(plugin);
+    try {
+        returned_object.property;
+    } catch (e) {
+        if (e instanceof ReferenceError)
+            document.getElementById("result").innerHTML = "SUCCESS";
+    }
+
+    document.getElementById("result").innerHTML = "SUCCESS";
+}
+</script>
+
+<body onload="runTest();">
+<pre>
+Test proper tracking of script NPObjects
+
+Test 1: Ensure that script NPObjects are properly tracked (i.e. added to
+        the live objects map in V8).
+
+Test 2: Test tracking of derived NPObjects by invoking a method on a
+        script object and passing it an internally created NPObject.
+
+<div id="result">FAILURE</div>
+<embed id="testPlugin" type="application/x-webkit-test-netscape" width="200" height="200"></embed>
+</body>
+</html>
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 388592b..4d2507d 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,14 @@
+2010-11-12  Tony Chang  <tony at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        run platform/chromium/plugins/script-object-invoke.html on all platforms
+        https://bugs.webkit.org/show_bug.cgi?id=49280
+
+        * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
+        (testScriptObjectInvoke):
+        (pluginInvoke):
+
 2010-11-12  Mihai Parparita  <mihaip at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
index fdcf66c..966ed2f 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
@@ -182,6 +182,8 @@ enum {
     ID_TEST_CONSTRUCT,
     ID_TEST_THROW_EXCEPTION_METHOD,
     ID_TEST_FAIL_METHOD,
+    ID_TEST_CLONE_OBJECT,
+    ID_TEST_SCRIPT_OBJECT_INVOKE,
     ID_DESTROY_NULL_STREAM,
     ID_TEST_RELOAD_PLUGINS_NO_PAGES,
     ID_TEST_RELOAD_PLUGINS_AND_PAGES,
@@ -220,6 +222,8 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
     "testConstruct",
     "testThrowException",
     "testFail",
+    "testCloneObject",
+    "testScriptObjectInvoke",
     "destroyNullStream",
     "reloadPluginsNoPages",
     "reloadPluginsAndPages",
@@ -783,6 +787,58 @@ static bool testConstruct(PluginObject* obj, const NPVariant* args, uint32_t arg
     return browser->construct(obj->npp, NPVARIANT_TO_OBJECT(args[0]), args + 1, argCount - 1, result);
 }
 
+// Invoke a script callback to get a script NPObject. Then call a method on the
+// script NPObject passing it a freshly created NPObject.
+static bool testScriptObjectInvoke(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+    if (argCount != 2 || !NPVARIANT_IS_STRING(args[0]) || !NPVARIANT_IS_STRING(args[1]))
+        return false;
+    NPObject* windowScriptObject;
+    browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
+
+    // Arg1 is the name of the callback
+    NPUTF8* callbackString = createCStringFromNPVariant(&args[0]);
+    NPIdentifier callbackIdentifier = browser->getstringidentifier(callbackString);
+    free(callbackString);
+
+    // Invoke a callback that returns a script object
+    NPVariant object_result;
+    browser->invoke(obj->npp, windowScriptObject, callbackIdentifier, &args[1], 1, &object_result);
+
+    // Script object returned
+    NPObject* script_object = object_result.value.objectValue;
+
+    // Arg2 is the name of the method to be called on the script object
+    NPUTF8* object_mehod_string = createCStringFromNPVariant(&args[1]);
+    NPIdentifier object_method = browser->getstringidentifier(object_mehod_string);
+    free(object_mehod_string);
+
+    // Create a fresh NPObject to be passed as an argument
+    NPObject* object_arg = browser->createobject(obj->npp, &pluginClass);
+    NPVariant invoke_args[1];
+    OBJECT_TO_NPVARIANT(object_arg, invoke_args[0]);
+
+    // Invoke the script method
+    NPVariant object_method_result;
+    browser->invoke(obj->npp, script_object, object_method, invoke_args, 1, &object_method_result);
+
+    browser->releasevariantvalue(&object_result);
+    VOID_TO_NPVARIANT(*result);
+    if (NPVARIANT_IS_OBJECT(object_method_result)) {
+        // Now return the callbacks return value back to our caller.
+        // BUG 897451: This should be the same as the
+        // windowScriptObject, but its not (in Chrome) - or at least, it
+        // has a different refcount. This means Chrome will delete the
+        // object before returning it and the calling JS gets a garbage
+        // value.  Firefox handles it fine.
+        OBJECT_TO_NPVARIANT(NPVARIANT_TO_OBJECT(object_method_result), *result);
+    } else {
+        browser->releasevariantvalue(&object_method_result);
+        VOID_TO_NPVARIANT(*result);
+    }
+    return true;
+}
+
 // Helper function to notify the layout test controller that the test completed.
 void notifyTestCompletion(NPP npp, NPObject* object)
 {
@@ -961,6 +1017,8 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
         return testPostURLFile(plugin, args, argCount, result);
     if (name == pluginMethodIdentifiers[ID_TEST_CONSTRUCT])
         return testConstruct(plugin, args, argCount, result);
+    if (name == pluginMethodIdentifiers[ID_TEST_SCRIPT_OBJECT_INVOKE])
+        return testScriptObjectInvoke(plugin, args, argCount, result);
     if (name == pluginMethodIdentifiers[ID_TEST_THROW_EXCEPTION_METHOD]) {
         browser->setexception(header, "plugin object testThrowException SUCCESS");
         return true;
@@ -971,6 +1029,12 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
         browser->invoke(plugin->npp, windowScriptObject, name, args, argCount, result);
         return false;
     }
+    if (name == pluginMethodIdentifiers[ID_TEST_CLONE_OBJECT]) {
+        NPObject* new_object = browser->createobject(plugin->npp, &pluginClass);
+        assert(new_object->referenceCount == 1);
+        OBJECT_TO_NPVARIANT(new_object, *result);
+        return true;
+    }
     if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM])
         return destroyNullStream(plugin, args, argCount, result);
     if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_NO_PAGES]) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list