* @param {string} key the preference key. * @param {(string|number|boolean)} value the preference value. * @return {!Options} A self reference. * @throws {TypeError} if either the key or value has an invalid type.
(key, value)
| 235 | * @throws {TypeError} if either the key or value has an invalid type. |
| 236 | */ |
| 237 | setPreference(key, value) { |
| 238 | if (typeof key !== 'string') { |
| 239 | throw TypeError(`key must be a string, but got ${typeof key}`) |
| 240 | } |
| 241 | if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean') { |
| 242 | throw TypeError(`value must be a string, number, or boolean, but got ${typeof value}`) |
| 243 | } |
| 244 | let options = this.firefoxOptions_() |
| 245 | options.prefs = options.prefs || {} |
| 246 | options.prefs[key] = value |
| 247 | return this |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * Sets the path to an existing profile to use as a template for new browser |
no test coverage detected