-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContentParent.cpp-patch
96 lines (90 loc) · 2.97 KB
/
ContentParent.cpp-patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -186,16 +186,19 @@
#include "nsPluginHost.h"
#include "nsPluginTags.h"
#include "nsIBlocklistService.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "nsIBidiKeyboard.h"
+#include "nsILoginInfo.h"
+#include "nsILoginManager.h"
+
#ifdef MOZ_WEBRTC
#include "signaling/src/peerconnection/WebrtcGlobalParent.h"
#endif
#if defined(ANDROID) || defined(LINUX)
#include "nsSystemInfo.h"
#endif
@@ -2951,16 +2954,72 @@ ContentParent::RecvAudioChannelServiceSt
MOZ_ASSERT(service);
service->ChildStatusReceived(mChildID, aTelephonyChannel,
aContentOrNormalChannel, aAnyChannel);
return true;
}
bool
+ContentParent::RecvStoreLogin(const uintptr_t& aGetterId,
+ const nsString& aHostname,
+ const nsString& aUsername,
+ const nsString& aPassword,
+ const nsString& aUsernameField,
+ const nsString& aPasswordField)
+{
+ nsCOMPtr<nsILoginManager> loginmanager = do_GetService("@mozilla.org/login-manager;1");
+
+ nsAutoString formSubmitURL;
+ formSubmitURL.AssignLiteral("");
+ nsAutoString httpRealm;
+ httpRealm.AssignLiteral("");
+
+ enum nsresult rv;
+ nsCOMPtr<nsILoginInfo> loginInfoInstance = do_CreateInstance("@mozilla.org/login-manager/loginInfo;1", &rv);
+ // FIXME find macro to throw if rv is error
+ loginInfoInstance->Init(aHostname, formSubmitURL, httpRealm, aUsername, aPassword, aUsernameField, aPasswordField);
+ loginmanager->AddLogin(loginInfoInstance);
+ return true;
+}
+
+bool
+ContentParent::RecvFindLogins(const uint64_t& aGetterId, const nsString& aPrepath)
+{
+ nsCOMPtr<nsILoginManager> loginmanager = do_GetService("@mozilla.org/login-manager;1");
+ nsILoginInfo** loginInfos;
+
+ nsAutoString httpRealm;
+ httpRealm.AssignLiteral("");
+ nsAutoString actionUrl;
+ actionUrl.AssignLiteral("");
+ unsigned int count;
+
+ nsAutoString password;
+ nsAutoString username;
+
+ loginmanager->FindLogins(&count, aPrepath, actionUrl, httpRealm, &loginInfos);
+ if ((count > 0) && (loginInfos != nullptr)) {
+ nsILoginInfo* loginInfo = loginInfos[0];
+ if (loginInfo) {
+ loginInfo->GetUsername(username);
+ loginInfo->GetPassword(password);
+ } else {
+ username.AssignLiteral("u3");
+ password.AssignLiteral("p3");
+ }
+ } else {
+ username.AssignLiteral("");
+ password.AssignLiteral("");
+ }
+ Unused << SendLoginsForPath(aGetterId, aPrepath, username, password);
+ return true;
+}
+
+bool
ContentParent::RecvDataStoreGetStores(
const nsString& aName,
const nsString& aOwner,
const IPC::Principal& aPrincipal,
InfallibleTArray<DataStoreSetting>* aValue)
{
RefPtr<DataStoreService> service = DataStoreService::GetOrCreate();
if (NS_WARN_IF(!service)) {