--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -158,17 +158,17 @@ static NPNetscapeFuncs sBrowserFuncs = {
_setexception,
_pushpopupsenabledstate,
_poppopupsenabledstate,
_enumerate,
_pluginthreadasynccall,
_construct,
_getvalueforurl,
_setvalueforurl,
- _getauthenticationinfo,
+ nullptr, //NPN GetAuthenticationInfo, not supported
_scheduletimer,
_unscheduletimer,
_popupcontextmenu,
_convertpoint,
nullptr, // handleevent, unimplemented
nullptr, // unfocusinstance, unimplemented
_urlredirectresponse,
_initasyncsurface,
@@ -2481,80 +2481,16 @@ NPError
default:
// Fall through and return an error...
;
}
return NPERR_GENERIC_ERROR;
}
-NPError
-_getauthenticationinfo(NPP instance, const char *protocol, const char *host,
- int32_t port, const char *scheme, const char *realm,
- char **username, uint32_t *ulen, char **password,
- uint32_t *plen)
-{
- if (!NS_IsMainThread()) {
- NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_getauthenticationinfo called from the wrong thread\n"));
- return NPERR_GENERIC_ERROR;
- }
-
- if (!instance || !protocol || !host || !scheme || !realm || !username ||
- !ulen || !password || !plen)
- return NPERR_INVALID_PARAM;
-
- *username = nullptr;
- *password = nullptr;
- *ulen = 0;
- *plen = 0;
-
- nsDependentCString proto(protocol);
-
- if (!proto.LowerCaseEqualsLiteral("http") &&
- !proto.LowerCaseEqualsLiteral("https"))
- return NPERR_GENERIC_ERROR;
-
- nsCOMPtr<nsIHttpAuthManager> authManager =
- do_GetService("@mozilla.org/network/http-auth-manager;1");
- if (!authManager)
- return NPERR_GENERIC_ERROR;
-
- nsNPAPIPluginInstance *inst = static_cast<nsNPAPIPluginInstance*>(instance->ndata);
- if (!inst)
- return NPERR_GENERIC_ERROR;
-
- bool authPrivate = false;
- if (NS_FAILED(inst->IsPrivateBrowsing(&authPrivate)))
- return NPERR_GENERIC_ERROR;
-
- nsIDocument *doc = GetDocumentFromNPP(instance);
- NS_ENSURE_TRUE(doc, NPERR_GENERIC_ERROR);
- nsIPrincipal *principal = doc->NodePrincipal();
-
- nsAutoString unused, uname16, pwd16;
- if (NS_FAILED(authManager->GetAuthIdentity(proto, nsDependentCString(host),
- port, nsDependentCString(scheme),
- nsDependentCString(realm),
- EmptyCString(), unused, uname16,
- pwd16, authPrivate, principal))) {
- return NPERR_GENERIC_ERROR;
- }
-
- NS_ConvertUTF16toUTF8 uname8(uname16);
- NS_ConvertUTF16toUTF8 pwd8(pwd16);
-
- *username = ToNewCString(uname8);
- *ulen = *username ? uname8.Length() : 0;
-
- *password = ToNewCString(pwd8);
- *plen = *password ? pwd8.Length() : 0;
-
- return NPERR_NO_ERROR;
-}
-
uint32_t
_scheduletimer(NPP instance, uint32_t interval, NPBool repeat, PluginTimerFunc timerFunc)
{
if (!NS_IsMainThread()) {
NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_scheduletimer called from the wrong thread\n"));
return 0;
}
--- a/dom/plugins/base/nsNPAPIPlugin.h
+++ b/dom/plugins/base/nsNPAPIPlugin.h
@@ -228,22 +228,16 @@ void
NPError
_getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
char **value, uint32_t *len);
NPError
_setvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
const char *value, uint32_t len);
-NPError
-_getauthenticationinfo(NPP instance, const char *protocol, const char *host,
- int32_t port, const char *scheme, const char *realm,
- char **username, uint32_t *ulen, char **password,
- uint32_t *plen);
-
typedef void(*PluginTimerFunc)(NPP npp, uint32_t timerID);
uint32_t
_scheduletimer(NPP instance, uint32_t interval, NPBool repeat, PluginTimerFunc timerFunc);
void
_unscheduletimer(NPP instance, uint32_t timerID);
--- a/dom/plugins/ipc/PPluginInstance.ipdl
+++ b/dom/plugins/ipc/PPluginInstance.ipdl
@@ -242,21 +242,16 @@ parent:
intr NPN_GetValueForURL(NPNURLVariable variable, nsCString url)
returns (nsCString value, NPError result);
intr NPN_SetValueForURL(NPNURLVariable variable, nsCString url,
nsCString value)
returns (NPError result);
- intr NPN_GetAuthenticationInfo(nsCString protocol_, nsCString host,
- int32_t port, nsCString scheme,
- nsCString realm)
- returns (nsCString username, nsCString password, NPError result);
-
intr NPN_ConvertPoint(double sourceX, bool ignoreDestX, double sourceY, bool ignoreDestY, NPCoordinateSpace sourceSpace,
NPCoordinateSpace destSpace)
returns (double destX, double destY, bool result);
async RedrawPlugin();
// Notifies the parent of its NPP_New result code.
async AsyncNPP_NewResult(NPError aResult);
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -2007,42 +2007,16 @@ PluginInstanceParent::AnswerNPN_SetValue
{
*result = mNPNIface->setvalueforurl(mNPP, (NPNURLVariable) variable,
url.get(), value.get(),
value.Length());
return IPC_OK();
}
mozilla::ipc::IPCResult
-PluginInstanceParent::AnswerNPN_GetAuthenticationInfo(const nsCString& protocol,
- const nsCString& host,
- const int32_t& port,
- const nsCString& scheme,
- const nsCString& realm,
- nsCString* username,
- nsCString* password,
- NPError* result)
-{
- char* u;
- uint32_t ulen;
- char* p;
- uint32_t plen;
-
- *result = mNPNIface->getauthenticationinfo(mNPP, protocol.get(),
- host.get(), port,
- scheme.get(), realm.get(),
- &u, &ulen, &p, &plen);
- if (NPERR_NO_ERROR == *result) {
- username->Adopt(u, ulen);
- password->Adopt(p, plen);
- }
- return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
PluginInstanceParent::AnswerNPN_ConvertPoint(const double& sourceX,
const bool& ignoreDestX,
const double& sourceY,
const bool& ignoreDestY,
const NPCoordinateSpace& sourceSpace,
const NPCoordinateSpace& destSpace,
double *destX,
double *destY,
--- a/dom/plugins/ipc/PluginInstanceParent.h
+++ b/dom/plugins/ipc/PluginInstanceParent.h
@@ -223,26 +223,16 @@ public:
nsCString* value, NPError* result) override;
virtual mozilla::ipc::IPCResult
AnswerNPN_SetValueForURL(const NPNURLVariable& variable,
const nsCString& url,
const nsCString& value, NPError* result) override;
virtual mozilla::ipc::IPCResult
- AnswerNPN_GetAuthenticationInfo(const nsCString& protocol,
- const nsCString& host,
- const int32_t& port,
- const nsCString& scheme,
- const nsCString& realm,
- nsCString* username,
- nsCString* password,
- NPError* result) override;
-
- virtual mozilla::ipc::IPCResult
AnswerNPN_ConvertPoint(const double& sourceX,
const bool& ignoreDestX,
const double& sourceY,
const bool& ignoreDestY,
const NPCoordinateSpace& sourceSpace,
const NPCoordinateSpace& destSpace,
double *destX,
double *destY,
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -918,23 +918,16 @@ static void
static NPError
_getvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
char **value, uint32_t *len);
static NPError
_setvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
const char *value, uint32_t len);
-static NPError
-_getauthenticationinfo(NPP npp, const char *protocol,
- const char *host, int32_t port,
- const char *scheme, const char *realm,
- char **username, uint32_t *ulen,
- char **password, uint32_t *plen);
-
static uint32_t
_scheduletimer(NPP instance, uint32_t interval, NPBool repeat,
void (*timerFunc)(NPP npp, uint32_t timerID));
static void
_unscheduletimer(NPP instance, uint32_t timerID);
static NPError
@@ -1008,17 +1001,17 @@ const NPNetscapeFuncs PluginModuleChild:
mozilla::plugins::child::_setexception,
mozilla::plugins::child::_pushpopupsenabledstate,
mozilla::plugins::child::_poppopupsenabledstate,
mozilla::plugins::child::_enumerate,
mozilla::plugins::child::_pluginthreadasynccall,
mozilla::plugins::child::_construct,
mozilla::plugins::child::_getvalueforurl,
mozilla::plugins::child::_setvalueforurl,
- mozilla::plugins::child::_getauthenticationinfo,
+ nullptr, //NPN GetAuthenticationInfo, not supported
mozilla::plugins::child::_scheduletimer,
mozilla::plugins::child::_unscheduletimer,
mozilla::plugins::child::_popupcontextmenu,
mozilla::plugins::child::_convertpoint,
nullptr, // handleevent, unimplemented
nullptr, // unfocusinstance, unimplemented
mozilla::plugins::child::_urlredirectresponse,
mozilla::plugins::child::_initasyncsurface,
@@ -1641,48 +1634,16 @@ NPError
nsDependentCString(value, len),
&result);
return result;
}
return NPERR_INVALID_PARAM;
}
-NPError
-_getauthenticationinfo(NPP npp, const char *protocol,
- const char *host, int32_t port,
- const char *scheme, const char *realm,
- char **username, uint32_t *ulen,
- char **password, uint32_t *plen)
-{
- PLUGIN_LOG_DEBUG_FUNCTION;
- AssertPluginThread();
-
- if (!protocol || !host || !scheme || !realm || !username || !ulen ||
- !password || !plen)
- return NPERR_INVALID_PARAM;
-
- nsCString u;
- nsCString p;
- NPError result;
- InstCast(npp)->
- CallNPN_GetAuthenticationInfo(nsDependentCString(protocol),
- nsDependentCString(host),
- port,
- nsDependentCString(scheme),
- nsDependentCString(realm),
- &u, &p, &result);
- if (NPERR_NO_ERROR == result) {
- *username = ToNewCString(u);
- *ulen = u.Length();
- *password = ToNewCString(p);
- *plen = p.Length();
- }
- return result;
-}
uint32_t
_scheduletimer(NPP npp, uint32_t interval, NPBool repeat,
void (*timerFunc)(NPP npp, uint32_t timerID))
{
PLUGIN_LOG_DEBUG_FUNCTION;
AssertPluginThread();
return InstCast(npp)->ScheduleTimer(interval, repeat, timerFunc);
--- a/dom/plugins/test/mochitest/mochitest.ini
+++ b/dom/plugins/test/mochitest/mochitest.ini
@@ -83,17 +83,16 @@ skip-if = (!crashreporter) || true # Bug
[test_CrashService_crash.html]
skip-if = !crashreporter || e10s
[test_CrashService_hang.html]
skip-if = !crashreporter || e10s
[test_defaultValue.html]
[test_enumerate.html]
[test_fullpage.html]
[test_GCrace.html]
-[test_getauthenticationinfo.html]
[test_hanging.html]
skip-if = !crashreporter || e10s
[test_hidden_plugin.html]
[test_instance_re-parent.html]
skip-if = release_or_beta # Bug 1172627
[test_instance_unparent1.html]
[test_instance_unparent2.html]
[test_instance_unparent3.html]
deleted file mode 100644
--- a/dom/plugins/test/mochitest/test_getauthenticationinfo.html
+++ /dev/null
@@ -1,81 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test for Login Manager</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <script type="text/javascript" src="plugin-utils.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-Test for NPN_GetAuthenticationInfo
-<p id="display"></p>
-
-<div id="content">
- <iframe id="iframe"></iframe>
-</div>
-
-<script class="testbody" type="text/javascript">
-
-const Ci = SpecialPowers.Ci;
-const Cc = SpecialPowers.Cc;
-
-function iframeLoad() {
- var plugin = iframe.contentDocument.getElementById("embedtest");
- // valid request
- is(plugin.getAuthInfo("http", "mochi.test", 8888, "basic", "testrealm"),
- "user1|password1",
- "correct user/pass retrieved");
- try {
- // invalid request -- wrong host
- is(plugin.getAuthInfo("http", "example.com", 8888, "basic", "testrealm"),
- "user1|password1",
- "correct user/pass retrieved");
- ok(false, "no exception was thrown");
- }
- catch (err) {
- ok(true, "expected exception caught");
- }
- try {
- // invalid request -- wrong port
- is(plugin.getAuthInfo("http", "mochi.test", 90, "basic", "testrealm"),
- "user1|password1",
- "correct user/pass retrieved");
- ok(false, "no exception was thrown");
- }
- catch (err) {
- ok(true, "expected exception caught");
- }
- try {
- // invalid request -- wrong realm
- is(plugin.getAuthInfo("http", "mochi.test", 8888, "basic", "wrongrealm"),
- "user1|password1",
- "correct user/pass retrieved");
- ok(false, "no exception was thrown");
- }
- catch (err) {
- ok(true, "expected exception caught");
- }
- SimpleTest.finish();
-}
-
-SimpleTest.waitForExplicitFinish();
-setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
-
-// Authentication info is added twice here. In the non-e10s case, this does
-// nothing. In the e10s case, we need to add auth info in both the child process,
-// which the plugin checks for auth validity, and the parent process, which the
-// http network objects use.
-// TODO: Clean this up once HTTPAuthManager is made e10s compliant in bug 1249172
-var iframe = document.getElementById("iframe");
-var am = Cc["@mozilla.org/network/http-auth-manager;1"].
- getService(Ci.nsIHttpAuthManager);
-am.setAuthIdentity("http", "mochi.test", 8888, "basic", "testrealm", "",
- "mochi.test", "user1", "password1");
-SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL("file_authident.js"));
-iframe.onload = iframeLoad;
-iframe.src = "http://mochi.test:8888/tests/toolkit/components/passwordmgr/" +
- "test/authenticate.sjs?user=user1&pass=password1&realm=testrealm&plugin=1";
-
-</script>
-</body>
-</html>
--- a/dom/plugins/test/testplugin/nptest.cpp
+++ b/dom/plugins/test/testplugin/nptest.cpp
@@ -135,17 +135,16 @@ static bool convertPointY(NPObject* npob
static bool streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool setPluginWantsAllStreams(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 crashOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool getObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool getJavaCodebase(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool checkObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool enableFPExceptions(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
-static bool getAuthInfo(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool asyncCallbackTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool checkGCRace(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool hangPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool stallPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool getClipboardText(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool callOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool reinitWidget(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool crashPluginInNestedLoop(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
@@ -209,17 +208,16 @@ static const NPUTF8* sPluginMethodIdenti
"streamTest",
"setPluginWantsAllStreams",
"crash",
"crashOnDestroy",
"getObjectValue",
"getJavaCodebase",
"checkObjectValue",
"enableFPExceptions",
- "getAuthInfo",
"asyncCallbackTest",
"checkGCRace",
"hang",
"stall",
"getClipboardText",
"callOnDestroy",
"reinitWidget",
"crashInNestedLoop",
@@ -284,17 +282,16 @@ static const ScriptableFunction sPluginM
streamTest,
setPluginWantsAllStreams,
crashPlugin,
crashOnDestroy,
getObjectValue,
getJavaCodebase,
checkObjectValue,
enableFPExceptions,
- getAuthInfo,
asyncCallbackTest,
checkGCRace,
hangPlugin,
stallPlugin,
getClipboardText,
callOnDestroy,
reinitWidget,
crashPluginInNestedLoop,
@@ -1977,30 +1974,16 @@ NPN_SetValueForURL(NPP instance, NPNURLV
}
NPError
NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char *url, char **value, uint32_t *len)
{
return sBrowserFuncs->getvalueforurl(instance, variable, url, value, len);
}
-NPError
-NPN_GetAuthenticationInfo(NPP instance,
- const char *protocol,
- const char *host, int32_t port,
- const char *scheme,
- const char *realm,
- char **username, uint32_t *ulen,
- char **password,
- uint32_t *plen)
-{
- return sBrowserFuncs->getauthenticationinfo(instance, protocol, host, port, scheme, realm,
- username, ulen, password, plen);
-}
-
void
NPN_PluginThreadAsyncCall(NPP plugin, void (*func)(void*), void* userdata)
{
return sBrowserFuncs->pluginthreadasynccall(plugin, func, userdata);
}
void
NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow)
@@ -3007,68 +2990,16 @@ static bool enableFPExceptions(NPObject*
#if defined(XP_WIN) && defined(_M_IX86)
_control87(0, _MCW_EM);
return true;
#else
return false;
#endif
}
-static bool
-getAuthInfo(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- if (argCount != 5)
- return false;
-
- NPP npp = static_cast<TestNPObject*>(npobj)->npp;
-
- if (!NPVARIANT_IS_STRING(args[0]) || !NPVARIANT_IS_STRING(args[1]) ||
- !NPVARIANT_IS_INT32(args[2]) || !NPVARIANT_IS_STRING(args[3]) ||
- !NPVARIANT_IS_STRING(args[4]))
- return false;
-
- const NPString* protocol = &NPVARIANT_TO_STRING(args[0]);
- const NPString* host = &NPVARIANT_TO_STRING(args[1]);
- uint32_t port = NPVARIANT_TO_INT32(args[2]);
- const NPString* scheme = &NPVARIANT_TO_STRING(args[3]);
- const NPString* realm = &NPVARIANT_TO_STRING(args[4]);
-
- char* username = nullptr;
- char* password = nullptr;
- uint32_t ulen = 0, plen = 0;
-
- NPError err = NPN_GetAuthenticationInfo(npp,
- protocol->UTF8Characters,
- host->UTF8Characters,
- port,
- scheme->UTF8Characters,
- realm->UTF8Characters,
- &username,
- &ulen,
- &password,
- &plen);
-
- if (err != NPERR_NO_ERROR) {
- return false;
- }
-
- char* outstring = (char*)NPN_MemAlloc(ulen + plen + 2);
- memset(outstring, 0, ulen + plen + 2);
- strncpy(outstring, username, ulen);
- strcat(outstring, "|");
- strncat(outstring, password, plen);
-
- STRINGZ_TO_NPVARIANT(outstring, *result);
-
- NPN_MemFree(username);
- NPN_MemFree(password);
-
- return true;
-}
-
static void timerCallback(NPP npp, uint32_t timerID)
{
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
currentTimerEventCount++;
timerEvent event = timerEvents[currentTimerEventCount];
NPObject* windowObject;
NPN_GetValue(npp, NPNVWindowNPObject, &windowObject);
--- a/ipc/ipdl/sync-messages.ini
+++ b/ipc/ipdl/sync-messages.ini
@@ -729,18 +729,16 @@ description =
[PPluginInstance::NPN_PushPopupsEnabledState]
description =
[PPluginInstance::NPN_PopPopupsEnabledState]
description =
[PPluginInstance::NPN_GetValueForURL]
description =
[PPluginInstance::NPN_SetValueForURL]
description =
-[PPluginInstance::NPN_GetAuthenticationInfo]
-description =
[PPluginInstance::NPN_ConvertPoint]
description =
[PPluginInstance::GetCompositionString]
description =
[PPluginInstance::NPP_NewStream]
description =
[PPluginInstance::PPluginStream]
description =