Skip to content

Commit

Permalink
Bug 1453385 - Prevent protocol.js from copying all response objects. …
Browse files Browse the repository at this point in the history
…r=jryans

MozReview-Commit-ID: 5suOD9UmIr

--HG--
extra : rebase_source : 549937e54581d9c5b69e05351b88805e244cb622
  • Loading branch information
ochameau committed Apr 9, 2018
1 parent d704329 commit b76a7cf
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions devtools/shared/protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,12 +718,21 @@ Response.prototype = {
* The object writing the response.
*/
write: function(ret, ctx) {
return JSON.parse(JSON.stringify(this.template, function(key, value) {
// Consider that `template` is either directly a `RetVal`,
// or a dictionary with may be one `RetVal`.
if (this.template instanceof RetVal) {
return this.template.write(ret, ctx);
}
let result = {};
for (let key in this.template) {
let value = this.template[key];
if (value instanceof RetVal) {
return value.write(ret, ctx);
result[key] = value.write(ret, ctx);
} else {
result[key] = value;
}
return value;
}));
}
return result;
},

/**
Expand Down

0 comments on commit b76a7cf

Please sign in to comment.