[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 16:05:17 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit d3ff3ea8f9403c345a85ee1be6c6fa63ae01ba22
Author: tony at chromium.org <tony at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Nov 18 17:54:25 2010 +0000
2010-11-18 Tony Chang <tony at chromium.org>
Reviewed by Adam Barth.
run platform/chromium/plugins/refcount-leaks.html on all platforms
https://bugs.webkit.org/show_bug.cgi?id=49485
Moving the test into the top level plugins dir.
* platform/chromium/drt_expectations.txt:
* platform/chromium/plugins/refcount-leaks-expected.txt: Removed.
* platform/chromium/plugins/refcount-leaks.html: Removed.
* plugins/refcount-leaks-expected.txt: Copied from LayoutTests/platform/chromium/plugins/refcount-leaks-expected.txt.
* plugins/refcount-leaks.html: Copied from LayoutTests/platform/chromium/plugins/refcount-leaks.html.
2010-11-18 Tony Chang <tony at chromium.org>
Reviewed by Adam Barth.
run platform/chromium/plugins/refcount-leaks.html on all platforms
https://bugs.webkit.org/show_bug.cgi?id=49485
Add PluginObject.testObjectCount which returns the number of allocated
TestObjects. Add PluginObject.testCreateTestObject which allocates
and returns a TestObject.
Add TestObject.refCount which returns the number of refs on the
TestObject.
* DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
(pluginGetProperty):
(pluginInvoke):
* DumpRenderTree/TestNetscapePlugIn/TestObject.cpp:
(getTestObjectCount):
(testAllocate):
(testDeallocate):
(testGetProperty):
(testScriptObjectInvoke): Release a ref to a plugin object that was
previously leaked.
* DumpRenderTree/TestNetscapePlugIn/TestObject.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72302 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f478d4e..0a56bd2 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-11-18 Tony Chang <tony at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ run platform/chromium/plugins/refcount-leaks.html on all platforms
+ https://bugs.webkit.org/show_bug.cgi?id=49485
+
+ Moving the test into the top level plugins dir.
+
+ * platform/chromium/drt_expectations.txt:
+ * platform/chromium/plugins/refcount-leaks-expected.txt: Removed.
+ * platform/chromium/plugins/refcount-leaks.html: Removed.
+ * plugins/refcount-leaks-expected.txt: Copied from LayoutTests/platform/chromium/plugins/refcount-leaks-expected.txt.
+ * plugins/refcount-leaks.html: Copied from LayoutTests/platform/chromium/plugins/refcount-leaks.html.
+
2010-11-18 Alexey Proskuryakov <ap at apple.com>
Reviewed by Darin Adler.
diff --git a/LayoutTests/platform/chromium/drt_expectations.txt b/LayoutTests/platform/chromium/drt_expectations.txt
index 4b7f13b..5627913 100644
--- a/LayoutTests/platform/chromium/drt_expectations.txt
+++ b/LayoutTests/platform/chromium/drt_expectations.txt
@@ -85,7 +85,6 @@ BUG_DRT MAC : plugins/override-node-method.html = PASS
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
// 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/refcount-leaks-expected.txt b/LayoutTests/platform/chromium/plugins/refcount-leaks-expected.txt
deleted file mode 100644
index 3f76868..0000000
--- a/LayoutTests/platform/chromium/plugins/refcount-leaks-expected.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Test that we can get an NPObject returned through a method on an NPAPI Object.
-Prints "SUCCESS" on success, "FAILURE" on failure.
-
---- num test objects:
-originally: 1
-after creation: 4
-after GC: 1
-
---- refcount on plug.testObject:
-originally: 2
-after get: 2
-after GC: 2
-after passing: 2
-SUCCESS
diff --git a/LayoutTests/platform/chromium/plugins/refcount-leaks.html b/LayoutTests/platform/chromium/plugins/refcount-leaks.html
deleted file mode 100644
index 97665aa..0000000
--- a/LayoutTests/platform/chromium/plugins/refcount-leaks.html
+++ /dev/null
@@ -1,81 +0,0 @@
-<script>
- function noop(x) {
- }
-
- function doGC() {
- if (window.gc) {
- // GC twice to make sure everything is cleaned up.
- for (var i = 0; i < 2; i++) {
- window.gc();
- }
- }
- }
-
- function runtest() {
- if (window.layoutTestController)
- layoutTestController.dumpAsText();
-
-
- var output = document.getElementById("output");
- output.innerHTML = "";
-
- // Test that objects are deleted after their JS references are released.
- var countOrig = plug.testObjectCount;
- o1 = plug.testCreateTestObject();
- o2 = plug.testCreateTestObject();
- o3 = plug.testCreateTestObject();
- var countAfterCreate = plug.testObjectCount;
- o1 = o2 = o3 = null;
- doGC();
- var countAfterGC = plug.testObjectCount;
-
- output.innerHTML += "--- num test objects:<br>";
- output.innerHTML += "originally: " + countOrig + "<br>";
- output.innerHTML += "after creation: " + countAfterCreate + "<br>";
- output.innerHTML += "after GC: " + countAfterGC + "<br>";
- output.innerHTML += "<br>";
-
- // Test that the object refcount returns to normal after JS references
- // are released.
- var testObj = plug.testObject;
- var refOrig = testObj.refCount;
- var o1 = plug.testObject;
- var o2 = plug.testObject;
- var o3 = plug.testObject;
- var refAfterGet = testObj.refCount;
- o1 = o2 = o3 = null;
- doGC();
- var refAfterGetGC = testObj.refCount;
-
- // Test that calling NPN_Invoke with our object as a parameter returns
- // our refcount to normal (may require a GC).
- plug.testPassTestObject("noop", testObj);
- plug.testPassTestObject("noop", testObj);
- plug.testPassTestObject("noop", testObj);
- doGC();
- var refAfterPass = testObj.refCount;
-
- output.innerHTML += "--- refcount on plug.testObject:<br>";
- output.innerHTML += "originally: " + refOrig + "<br>";
- output.innerHTML += "after get: " + refAfterGet + "<br>";
- output.innerHTML += "after GC: " + refAfterGetGC + "<br>";
- output.innerHTML += "after passing: " + refAfterPass + "<br>";
-
- var success = (countAfterGC == countOrig) && (refAfterPass == refOrig);
- output.innerHTML += (success ? "SUCCESS" : "FAILURE");
- }
-</script>
-
-<body onload="runtest()">
-
-Test that we can get an NPObject returned through a method on
-an NPAPI Object.<P>
-
-Prints "SUCCESS" on success, "FAILURE" on failure.
-
-<embed name="plug" type="application/x-webkit-test-netscape">
-
-<div id=output>FAILURE</div>
-
-</body>
-
diff --git a/LayoutTests/plugins/refcount-leaks-expected.txt b/LayoutTests/plugins/refcount-leaks-expected.txt
new file mode 100644
index 0000000..d51a342
--- /dev/null
+++ b/LayoutTests/plugins/refcount-leaks-expected.txt
@@ -0,0 +1,12 @@
+Test that we can get an NPObject returned through a method on an NPAPI Object.
+Prints "SUCCESS" on success, "FAILURE" on failure.
+
+--- num test objects:
+countAfterCreate == countOrig + 3? PASS
+countOrig == countAfterGC? PASS
+
+--- refcount on plug.testObject:
+originally: 2
+after GC: 2
+after passing: 2
+SUCCESS
diff --git a/LayoutTests/plugins/refcount-leaks.html b/LayoutTests/plugins/refcount-leaks.html
new file mode 100644
index 0000000..ab4d417
--- /dev/null
+++ b/LayoutTests/plugins/refcount-leaks.html
@@ -0,0 +1,83 @@
+<script>
+ function noop(x) {
+ }
+
+ function doGC() {
+ if (window.GCController) {
+ // GC twice to make sure everything is cleaned up.
+ for (var i = 0; i < 2; i++) {
+ window.GCController.collect();
+ }
+ }
+ }
+
+ function runtest() {
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+
+ var output = document.getElementById("output");
+ output.innerHTML = "";
+
+ // Test that objects are deleted after their JS references are released.
+ var countOrig = plug.testObjectCount;
+ o1 = plug.testCreateTestObject();
+ o2 = plug.testCreateTestObject();
+ o3 = plug.testCreateTestObject();
+ var countAfterCreate = plug.testObjectCount;
+ o1 = o2 = o3 = null;
+ doGC();
+ var countAfterGC = plug.testObjectCount;
+
+ output.innerHTML += "--- num test objects:<br>";
+ output.innerHTML += "countAfterCreate == countOrig + 3? "
+ + ((countAfterCreate == countOrig + 3) ? "PASS" : "FAIL")
+ + "<br>";
+ output.innerHTML += "countOrig == countAfterGC? "
+ + ((countOrig == countAfterGC) ? "PASS" : "FAIL")
+ + "<br>";
+ output.innerHTML += "<br>";
+
+ // Test that the object refcount returns to normal after JS references
+ // are released.
+ var testObj = plug.testObject;
+ var refOrig = testObj.refCount;
+ var o1 = plug.testObject;
+ var o2 = plug.testObject;
+ var o3 = plug.testObject;
+ var refAfterGet = testObj.refCount;
+ o1 = o2 = o3 = null;
+ doGC();
+ var refAfterGetGC = testObj.refCount;
+
+ // Test that calling NPN_Invoke with our object as a parameter returns
+ // our refcount to normal (may require a GC).
+ plug.testPassTestObject("noop", testObj);
+ plug.testPassTestObject("noop", testObj);
+ plug.testPassTestObject("noop", testObj);
+ doGC();
+ var refAfterPass = testObj.refCount;
+
+ output.innerHTML += "--- refcount on plug.testObject:<br>";
+ output.innerHTML += "originally: " + refOrig + "<br>";
+ output.innerHTML += "after GC: " + refAfterGetGC + "<br>";
+ output.innerHTML += "after passing: " + refAfterPass + "<br>";
+
+ var success = (countAfterGC == countOrig) && (refAfterPass == refOrig);
+ output.innerHTML += (success ? "SUCCESS" : "FAILURE");
+ }
+</script>
+
+<body onload="runtest()">
+
+Test that we can get an NPObject returned through a method on
+an NPAPI Object.<P>
+
+Prints "SUCCESS" on success, "FAILURE" on failure.
+
+<embed name="plug" type="application/x-webkit-test-netscape">
+
+<div id=output>FAILURE</div>
+
+</body>
+
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 213c9ba..46f0116 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,29 @@
+2010-11-18 Tony Chang <tony at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ run platform/chromium/plugins/refcount-leaks.html on all platforms
+ https://bugs.webkit.org/show_bug.cgi?id=49485
+
+ Add PluginObject.testObjectCount which returns the number of allocated
+ TestObjects. Add PluginObject.testCreateTestObject which allocates
+ and returns a TestObject.
+
+ Add TestObject.refCount which returns the number of refs on the
+ TestObject.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
+ (pluginGetProperty):
+ (pluginInvoke):
+ * DumpRenderTree/TestNetscapePlugIn/TestObject.cpp:
+ (getTestObjectCount):
+ (testAllocate):
+ (testDeallocate):
+ (testGetProperty):
+ (testScriptObjectInvoke): Release a ref to a plugin object that was
+ previously leaked.
+ * DumpRenderTree/TestNetscapePlugIn/TestObject.h:
+
2010-11-17 Steve Falkenburg <sfalken at apple.com>
Reviewed by Adam Roben.
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
index 966ed2f..198d3c5 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
@@ -141,6 +141,7 @@ enum {
ID_PROPERTY_THROW_EXCEPTION_PROPERTY,
ID_LAST_SET_WINDOW_ARGUMENTS,
ID_PROPERTY_WINDOWED_PLUGIN,
+ ID_PROPERTY_TEST_OBJECT_COUNT,
NUM_PROPERTY_IDENTIFIERS
};
@@ -157,7 +158,8 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
"cachedPrivateBrowsingEnabled",
"testThrowExceptionProperty",
"lastSetWindowArguments",
- "windowedPlugin"
+ "windowedPlugin",
+ "testObjectCount",
};
enum {
@@ -184,6 +186,7 @@ enum {
ID_TEST_FAIL_METHOD,
ID_TEST_CLONE_OBJECT,
ID_TEST_SCRIPT_OBJECT_INVOKE,
+ ID_TEST_CREATE_TEST_OBJECT,
ID_DESTROY_NULL_STREAM,
ID_TEST_RELOAD_PLUGINS_NO_PAGES,
ID_TEST_RELOAD_PLUGINS_AND_PAGES,
@@ -224,6 +227,7 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testFail",
"testCloneObject",
"testScriptObjectInvoke",
+ "testCreateTestObject",
"destroyNullStream",
"reloadPluginsNoPages",
"reloadPluginsAndPages",
@@ -327,6 +331,10 @@ static bool pluginGetProperty(NPObject* obj, NPIdentifier name, NPVariant* resul
STRINGZ_TO_NPVARIANT(buf, *result);
return true;
}
+ if (name == pluginPropertyIdentifiers[ID_PROPERTY_TEST_OBJECT_COUNT]) {
+ INT32_TO_NPVARIANT(getTestObjectCount(), *result);
+ return true;
+ }
return false;
}
@@ -836,6 +844,9 @@ static bool testScriptObjectInvoke(PluginObject* obj, const NPVariant* args, uin
browser->releasevariantvalue(&object_method_result);
VOID_TO_NPVARIANT(*result);
}
+
+ browser->releaseobject(object_arg);
+
return true;
}
@@ -1035,6 +1046,12 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
OBJECT_TO_NPVARIANT(new_object, *result);
return true;
}
+ if (name == pluginMethodIdentifiers[ID_TEST_CREATE_TEST_OBJECT]) {
+ NPObject* testObject = browser->createobject(plugin->npp, getTestClass());
+ assert(testObject->referenceCount == 1);
+ OBJECT_TO_NPVARIANT(testObject, *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]) {
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp
index 8946c0e..9e65f11 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp
@@ -59,6 +59,13 @@ NPClass *getTestClass(void)
return &testClass;
}
+static int testObjectCount = 0;
+
+int getTestObjectCount()
+{
+ return testObjectCount;
+}
+
typedef struct {
NPObject header;
NPObject* testObject;
@@ -73,6 +80,7 @@ enum {
ID_PROPERTY_BAR,
ID_PROPERTY_OBJECT_POINTER,
ID_PROPERTY_TEST_OBJECT,
+ ID_PROPERTY_REF_COUNT,
NUM_TEST_IDENTIFIERS,
};
@@ -82,6 +90,7 @@ static const NPUTF8 *testIdentifierNames[NUM_TEST_IDENTIFIERS] = {
"bar",
"objectPointer",
"testObject",
+ "refCount",
};
#define ID_THROW_EXCEPTION_METHOD 0
@@ -102,6 +111,7 @@ static NPObject* testAllocate(NPP /*npp*/, NPClass* /*theClass*/)
{
TestObject* newInstance = static_cast<TestObject*>(malloc(sizeof(TestObject)));
newInstance->testObject = 0;
+ ++testObjectCount;
if (!identifiersInitialized) {
identifiersInitialized = true;
@@ -116,6 +126,8 @@ static void testDeallocate(NPObject *obj)
TestObject* testObject = reinterpret_cast<TestObject*>(obj);
if (testObject->testObject)
browser->releaseobject(testObject->testObject);
+
+ --testObjectCount;
free(obj);
}
@@ -169,6 +181,10 @@ static bool testGetProperty(NPObject* npobj, NPIdentifier name, NPVariant* resul
OBJECT_TO_NPVARIANT(testObject->testObject, *result);
return true;
}
+ if (name == testIdentifiers[ID_PROPERTY_REF_COUNT]) {
+ INT32_TO_NPVARIANT(npobj->referenceCount, *result);
+ return true;
+ }
return false;
}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.h
index 1295fb7..73748e0 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/TestObject.h
@@ -26,4 +26,5 @@
#include <WebKit/npapi.h>
#include <WebKit/npruntime.h>
-NPClass *getTestClass(void);
+NPClass* getTestClass(void);
+int getTestObjectCount();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list