mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-18 07:34:54 +00:00
params: Fix regression
The first parameter to Object.assign() is the same target object that
will be returned. That is, since commit 46874eed0 Params.parse() modifies
the @defaults object. Usually we pass that parameter as an object literal
and this isn't an issue, but the change breaks spectacularly in the few
cases where we use a re-usable variable.
Restore the previous behavior by copying the object first.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/615
This commit is contained in:
parent
1778adae0d
commit
8a5de327bb
1 changed files with 5 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
|||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||
|
||||
const Lang = imports.lang;
|
||||
|
||||
// parse:
|
||||
// @params: caller-provided parameter object, or %null
|
||||
// @defaults-provided defaults object
|
||||
|
|
@ -21,5 +23,7 @@ function parse(params = {}, defaults, allowExtras) {
|
|||
throw new Error(`Unrecognized parameter "${prop}"`);
|
||||
}
|
||||
|
||||
return Object.assign(defaults, params);
|
||||
let defaultsCopy = {};
|
||||
Lang.copyProperties(defaults, defaultsCopy);
|
||||
return Object.assign(defaultsCopy, params);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue