Skip to content

Commit 64a8cdd

Browse files
committed
Refactoring
1 parent 9431e46 commit 64a8cdd

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/background.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -183,33 +183,33 @@ function saveRecent(settings, login, remove = false) {
183183
* Call injected code to fill the form
184184
*
185185
* @param object settings Settings object
186-
* @param object fillRequest Fill request details
186+
* @param object request Request details
187187
* @param boolean allFrames Dispatch to all frames
188188
* @param boolean allowForeign Allow foreign-origin iframes
189189
* @param boolean allowNoSecret Allow forms that don't contain a password field
190190
* @return array list of filled fields
191191
*/
192-
async function dispatchFill(settings, fillRequest, allFrames, allowForeign, allowNoSecret) {
193-
fillRequest = Object.assign(deepCopy(fillRequest), {
192+
async function dispatchFill(settings, request, allFrames, allowForeign, allowNoSecret) {
193+
request = Object.assign(deepCopy(request), {
194194
allowForeign: allowForeign,
195195
allowNoSecret: allowNoSecret,
196196
foreignFills: settings.foreignFills[settings.host] || {}
197197
});
198198

199-
var perFrameFillResults = await chrome.tabs.executeScript(settings.tab.id, {
199+
let perFrameResults = await chrome.tabs.executeScript(settings.tab.id, {
200200
allFrames: allFrames,
201-
code: `window.browserpass.fillLogin(${JSON.stringify(fillRequest)});`
201+
code: `window.browserpass.fillLogin(${JSON.stringify(request)});`
202202
});
203203

204204
// merge filled fields into a single array
205-
var filledFields = perFrameFillResults
205+
let filledFields = perFrameResults
206206
.reduce((merged, frameResult) => merged.concat(frameResult.filledFields), [])
207207
.filter((val, i, merged) => merged.indexOf(val) === i);
208208

209209
// if user answered a foreign-origin confirmation,
210210
// store the answers in the settings
211-
var foreignFillsChanged = false;
212-
for (var frame of perFrameFillResults) {
211+
let foreignFillsChanged = false;
212+
for (let frame of perFrameResults) {
213213
if (typeof frame.foreignFill !== "undefined") {
214214
if (typeof settings.foreignFills[settings.host] === "undefined") {
215215
settings.foreignFills[settings.host] = {};
@@ -228,21 +228,21 @@ async function dispatchFill(settings, fillRequest, allFrames, allowForeign, allo
228228
/**
229229
* Call injected code to focus or submit the form
230230
*
231-
* @param object settings Settings object
232-
* @param object focusOrSubmitRequest Focus or submit request details
233-
* @param boolean allFrames Dispatch to all frames
234-
* @param boolean allowForeign Allow foreign-origin iframes
231+
* @param object settings Settings object
232+
* @param object request Request details
233+
* @param boolean allFrames Dispatch to all frames
234+
* @param boolean allowForeign Allow foreign-origin iframes
235235
* @return void
236236
*/
237-
async function dispatchFocusOrSubmit(settings, focusOrSubmitRequest, allFrames, allowForeign) {
238-
focusOrSubmitRequest = Object.assign(deepCopy(focusOrSubmitRequest), {
237+
async function dispatchFocusOrSubmit(settings, request, allFrames, allowForeign) {
238+
request = Object.assign(deepCopy(request), {
239239
allowForeign: allowForeign,
240240
foreignFills: settings.foreignFills[settings.host] || {}
241241
});
242242

243243
await chrome.tabs.executeScript(settings.tab.id, {
244244
allFrames: allFrames,
245-
code: `window.browserpass.focusOrSubmit(${JSON.stringify(focusOrSubmitRequest)});`
245+
code: `window.browserpass.focusOrSubmit(${JSON.stringify(request)});`
246246
});
247247
}
248248

0 commit comments

Comments
 (0)