diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index f2181ddc9d80..31fa7aa1484f 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -163,7 +163,7 @@ static NPNetscapeFuncs sBrowserFuncs = { _construct, _getvalueforurl, _setvalueforurl, - _getauthenticationinfo, + nullptr, //NPN GetAuthenticationInfo, not supported _scheduletimer, _unscheduletimer, _popupcontextmenu, @@ -2486,70 +2486,6 @@ _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url, 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 authManager = - do_GetService("@mozilla.org/network/http-auth-manager;1"); - if (!authManager) - return NPERR_GENERIC_ERROR; - - nsNPAPIPluginInstance *inst = static_cast(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) { diff --git a/dom/plugins/base/nsNPAPIPlugin.h b/dom/plugins/base/nsNPAPIPlugin.h index 96e630b629cc..780a7d812742 100644 --- a/dom/plugins/base/nsNPAPIPlugin.h +++ b/dom/plugins/base/nsNPAPIPlugin.h @@ -233,12 +233,6 @@ 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 diff --git a/dom/plugins/ipc/PPluginInstance.ipdl b/dom/plugins/ipc/PPluginInstance.ipdl index 0f1227c369ad..2587d1393fdc 100644 --- a/dom/plugins/ipc/PPluginInstance.ipdl +++ b/dom/plugins/ipc/PPluginInstance.ipdl @@ -247,11 +247,6 @@ parent: 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); diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index 5c8a00f9d31c..0d35fcf333f0 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -2011,32 +2011,6 @@ PluginInstanceParent::AnswerNPN_SetValueForURL(const NPNURLVariable& variable, 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, diff --git a/dom/plugins/ipc/PluginInstanceParent.h b/dom/plugins/ipc/PluginInstanceParent.h index 03b67856ec2f..f0646af28736 100644 --- a/dom/plugins/ipc/PluginInstanceParent.h +++ b/dom/plugins/ipc/PluginInstanceParent.h @@ -227,16 +227,6 @@ public: 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, diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 66378f7cd8a3..1660d45812da 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -923,13 +923,6 @@ 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)); @@ -1013,7 +1006,7 @@ const NPNetscapeFuncs PluginModuleChild::sBrowserFuncs = { 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, @@ -1646,38 +1639,6 @@ _setvalueforurl(NPP npp, NPNURLVariable variable, const char *url, 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, diff --git a/dom/plugins/test/mochitest/mochitest.ini b/dom/plugins/test/mochitest/mochitest.ini index 8fa20a6fb5e7..710978b39623 100644 --- a/dom/plugins/test/mochitest/mochitest.ini +++ b/dom/plugins/test/mochitest/mochitest.ini @@ -87,7 +87,6 @@ skip-if = !crashreporter || e10s [test_enumerate.html] [test_fullpage.html] [test_GCrace.html] -[test_getauthenticationinfo.html] [test_hanging.html] skip-if = !crashreporter || e10s [test_hidden_plugin.html] diff --git a/dom/plugins/test/mochitest/test_getauthenticationinfo.html b/dom/plugins/test/mochitest/test_getauthenticationinfo.html deleted file mode 100644 index f249386c7c96..000000000000 --- a/dom/plugins/test/mochitest/test_getauthenticationinfo.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - Test for Login Manager - - - - - -Test for NPN_GetAuthenticationInfo -

- -
- -
- - - - diff --git a/dom/plugins/test/testplugin/nptest.cpp b/dom/plugins/test/testplugin/nptest.cpp index 94648f2a2129..b8a17f6c4bf0 100644 --- a/dom/plugins/test/testplugin/nptest.cpp +++ b/dom/plugins/test/testplugin/nptest.cpp @@ -140,7 +140,6 @@ static bool getObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argC 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); @@ -214,7 +213,6 @@ static const NPUTF8* sPluginMethodIdentifierNames[] = { "getJavaCodebase", "checkObjectValue", "enableFPExceptions", - "getAuthInfo", "asyncCallbackTest", "checkGCRace", "hang", @@ -289,7 +287,6 @@ static const ScriptableFunction sPluginMethodFunctions[] = { getJavaCodebase, checkObjectValue, enableFPExceptions, - getAuthInfo, asyncCallbackTest, checkGCRace, hangPlugin, @@ -1982,20 +1979,6 @@ NPN_GetValueForURL(NPP instance, NPNURLVariable variable, const char *url, char 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) { @@ -3012,58 +2995,6 @@ static bool enableFPExceptions(NPObject* npobj, const NPVariant* args, uint32_t #endif } -static bool -getAuthInfo(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result) -{ - if (argCount != 5) - return false; - - NPP npp = static_cast(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(npp->pdata); diff --git a/ipc/ipdl/sync-messages.ini b/ipc/ipdl/sync-messages.ini index c34253dc3040..cf8e6a4652d7 100644 --- a/ipc/ipdl/sync-messages.ini +++ b/ipc/ipdl/sync-messages.ini @@ -734,8 +734,6 @@ description = description = [PPluginInstance::NPN_SetValueForURL] description = -[PPluginInstance::NPN_GetAuthenticationInfo] -description = [PPluginInstance::NPN_ConvertPoint] description = [PPluginInstance::GetCompositionString]