diff --git a/lib/browser/guest-view-manager.js b/lib/browser/guest-view-manager.js index de11b03206bb..2f8ffefebc1c 100644 --- a/lib/browser/guest-view-manager.js +++ b/lib/browser/guest-view-manager.js @@ -193,7 +193,7 @@ const attachGuest = function (embedder, elementInstanceId, guestInstanceId, para // no value was specified, default it to true value = true } - webPreferences[name] = value + webPreferences[key] = value }) } diff --git a/lib/common/parse-features-string.js b/lib/common/parse-features-string.js index da0381bbcf12..2c74c3463dc9 100644 --- a/lib/common/parse-features-string.js +++ b/lib/common/parse-features-string.js @@ -1,24 +1,19 @@ // parses a feature string that has the format used in window.open() // - `str` input string // - `emit` function(key, value) - called for each parsed KV -module.exports = function parseFeaturesString (str, emit) { +module.exports = function parseFeaturesString (features, emit) { // split the string by ',' - let i, len - let strTokens = params.str.split(/,\s*/) - for (i = 0, len = strTokens.length; i < len; i++) { + features.split(/,\s*/).forEach((feature) => { // expected form is either a key by itself (true boolean flag) // or a key/value, in the form of 'key=value' // split the tokens by '=' - let kv = strTokens[i] - let kvTokens = kv.split(/\s*=/) - let key = kvTokens[0] - let value = kvTokens[1] - if (!key) continue + let [key, value] = feature.split(/\s*=/) + if (!key) return - // interpret the value as a boolean, if possible + // interpret the value as a boolean, if possible value = (value === 'yes' || value === '1') ? true : (value === 'no' || value === '0') ? false : value // emit the parsed pair emit(key, value) - } + }) }