From 255d73a2912a2acfb65df0f974204740ec33bbbe Mon Sep 17 00:00:00 2001 From: Matthew Noorenberghe Date: Tue, 10 Mar 2015 23:08:34 -0700 Subject: [PATCH] Bug 1140242 - Convert nsILoginInfo to vanilla JS objects before trying to send them in messages. r=dolske --- .../passwordmgr/LoginManagerParent.jsm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/toolkit/components/passwordmgr/LoginManagerParent.jsm b/toolkit/components/passwordmgr/LoginManagerParent.jsm index d60e11b436ca..817e738af997 100644 --- a/toolkit/components/passwordmgr/LoginManagerParent.jsm +++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm @@ -206,8 +206,13 @@ var LoginManagerParent = { } var logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null); - target.sendAsyncMessage("RemoteLogins:loginsFound", - { requestId: requestId, logins: logins }); + // Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo + // doesn't support structured cloning. + var jsLogins = JSON.parse(JSON.stringify(logins)); + target.sendAsyncMessage("RemoteLogins:loginsFound", { + requestId: requestId, + logins: jsLogins, + }); const PWMGR_FORM_ACTION_EFFECT = Services.telemetry.getHistogramById("PWMGR_FORM_ACTION_EFFECT"); if (logins.length == 0) { @@ -261,9 +266,13 @@ var LoginManagerParent = { AutoCompleteE10S.showPopupWithResults(target.ownerDocument.defaultView, rect, result); } - target.messageManager.sendAsyncMessage("RemoteLogins:loginsAutoCompleted", - { requestId: requestId, - logins: matchingLogins }); + // Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo + // doesn't support structured cloning. + var jsLogins = JSON.parse(JSON.stringify(matchingLogins)); + target.messageManager.sendAsyncMessage("RemoteLogins:loginsAutoCompleted", { + requestId: requestId, + logins: jsLogins, + }); }, onFormSubmit: function(hostname, formSubmitURL,