mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1437476 - Clone annotation objects before passing to back-end services to avoid leaks. r=mak
MozReview-Commit-ID: 1ke3FK4gQkL --HG-- extra : rebase_source : 6f89b803f8c5ea42bf9ec4c65538d9b293aa2d4e
This commit is contained in:
parent
e3ba763e10
commit
199e734a04
@ -737,8 +737,11 @@ DefineTransaction.annotationObjectValidate = function(obj) {
|
||||
checkProperty(obj, "value", false, isPrimitive) ) {
|
||||
// Nothing else should be set
|
||||
let validKeys = ["name", "value", "flags", "expires"];
|
||||
if (Object.keys(obj).every(k => validKeys.includes(k)))
|
||||
return obj;
|
||||
if (Object.keys(obj).every(k => validKeys.includes(k))) {
|
||||
// Annotations objects are passed through to the backend, to avoid memory
|
||||
// leaks, we must clone the object.
|
||||
return {...obj};
|
||||
}
|
||||
}
|
||||
throw new Error("Invalid annotation object");
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user