Backing out test for bug 533371 to try to fix leaks

This commit is contained in:
Robert O'Callahan 2009-12-16 12:54:59 +13:00
Родитель cc8f060f2b 80c9b59aca
Коммит e0905a7d9c
4 изменённых файлов: 0 добавлений и 116 удалений

Просмотреть файл

@ -65,7 +65,6 @@ _MOCHITEST_FILES = \
test_pluginstream_seek.html \
test_pluginstream_newstream.html \
test_streamNotify.html \
test_cookies.html \
$(NULL)
# test_npruntime_npnsetexception.html \ Disabled for e10s

Просмотреть файл

@ -1,20 +0,0 @@
<html>
<head>
<title>NPAPI Cookie Tests</title>
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body onload="runTests()">
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
function runTests() {
var pluginElement = document.getElementById("plugin1");
pluginElement.setCookie("foo");
ok(pluginElement.getCookie() == "foo", "Cookie was set and retrieved correctly via NPAPI.");
SimpleTest.finish();
}
</script>
</body>
</html>

Просмотреть файл

@ -301,11 +301,3 @@ overridden windowproc.
* WM_MOUSEACTIVATE events are handled by calling SetFocus on the plugin's
widget, if the plugin is windowed. If it's not windowed they're passed to
the overriden windowproc (but hopefully never sent by the browser anyway).
== Getting and Setting Cookies ==
* setCookie(string)
Sets the given string as the cookie for window's URL.
* getCookie()
Returns the cookie string for the window's URL, the cookie set by setCookie.

Просмотреть файл

@ -103,8 +103,6 @@ static bool convertPointX(NPObject* npobj, const NPVariant* args, uint32_t argCo
static bool convertPointY(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool crashPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool setCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool getCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static const NPUTF8* sPluginMethodIdentifierNames[] = {
"npnEvaluateTest",
@ -134,8 +132,6 @@ static const NPUTF8* sPluginMethodIdentifierNames[] = {
"convertPointY",
"streamTest",
"crash",
"setCookie",
"getCookie",
};
static NPIdentifier sPluginMethodIdentifiers[ARRAY_LENGTH(sPluginMethodIdentifierNames)];
static const ScriptableFunction sPluginMethodFunctions[ARRAY_LENGTH(sPluginMethodIdentifierNames)] = {
@ -166,8 +162,6 @@ static const ScriptableFunction sPluginMethodFunctions[ARRAY_LENGTH(sPluginMetho
convertPointY,
streamTest,
crashPlugin,
setCookie,
getCookie,
};
struct URLNotifyData
@ -1269,18 +1263,6 @@ NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace
return sBrowserFuncs->convertpoint(instance, sourceX, sourceY, sourceSpace, destX, destY, destSpace);
}
NPError
NPN_SetValueForURL(NPP instance, NPNURLVariable variable, const char *url, const char *value, uint32_t len)
{
return sBrowserFuncs->setvalueforurl(instance, variable, url, value, len);
}
NPError
NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char *url, char **value, uint32_t *len)
{
return sBrowserFuncs->getvalueforurl(instance, variable, url, value, len);
}
//
// npruntime object functions
//
@ -2066,75 +2048,6 @@ crashPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant
return true;
}
// caller is responsible for freeing return buffer
static char* URLForInstanceWindow(NPP instance) {
char *outString = NULL;
NPObject* windowObject = NULL;
NPN_GetValue(instance, NPNVWindowNPObject, &windowObject);
NPIdentifier locationIdentifier = NPN_GetStringIdentifier("location");
NPVariant locationVariant;
if (NPN_GetProperty(instance, windowObject, locationIdentifier, &locationVariant)) {
NPObject *locationObject = locationVariant.value.objectValue;
if (locationObject) {
NPIdentifier hrefIdentifier = NPN_GetStringIdentifier("href");
NPVariant hrefVariant;
if (NPN_GetProperty(instance, locationObject, hrefIdentifier, &hrefVariant)) {
const NPString* hrefString = &NPVARIANT_TO_STRING(hrefVariant);
if (hrefString) {
outString = (char *)malloc(hrefString->UTF8Length + 1);
if (outString) {
strcpy(outString, hrefString->UTF8Characters);
outString[hrefString->UTF8Length] = '\0';
}
}
NPN_ReleaseVariantValue(&hrefVariant);
}
}
NPN_ReleaseVariantValue(&locationVariant);
}
return outString;
}
static bool
setCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount != 1)
return false;
if (!NPVARIANT_IS_STRING(args[0]))
return false;
const NPString* cookie = &NPVARIANT_TO_STRING(args[0]);
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
char* url = URLForInstanceWindow(npp);
NPError err = NPN_SetValueForURL(npp, NPNURLVCookie, url, cookie->UTF8Characters, cookie->UTF8Length);
free(url);
return (err == NPERR_NO_ERROR);
}
static bool
getCookie(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount != 0)
return false;
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
char* cookie = NULL;
unsigned int length = 0;
char* url = URLForInstanceWindow(npp);
NPError err = NPN_GetValueForURL(npp, NPNURLVCookie, url, &cookie, &length);
free(url);
if (err != NPERR_NO_ERROR || !cookie)
return false;
STRINGZ_TO_NPVARIANT(cookie, *result);
return true;
}
static bool
setColor(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{