Bug 1449162 - Type everything to json and manually manage and marshall. r=jryans

MozReview-Commit-ID: JOM60IW9g6e

--HG--
extra : rebase_source : 235490d6340ad6cee2b523086a356351500276d6
This commit is contained in:
Alexandre Poirot 2018-05-09 07:20:51 -07:00
Родитель c0b5dc9f10
Коммит dabb99acfc
3 изменённых файлов: 45 добавлений и 14 удалений

Просмотреть файл

@ -275,6 +275,10 @@ const NetworkEventActor = protocol.ActorClassWithSpec(networkEventSpec, {
if (rawHeaders) {
rawHeaders = new LongStringActor(this.conn, rawHeaders);
// bug 1462561 - Use "json" type and manually manage/marshall actors to woraround
// protocol.js performance issue
this.manage(rawHeaders);
rawHeaders = rawHeaders.form();
}
this._request.rawHeaders = rawHeaders;
@ -308,9 +312,14 @@ const NetworkEventActor = protocol.ActorClassWithSpec(networkEventSpec, {
addRequestPostData(postData) {
this._request.postData = postData;
postData.text = new LongStringActor(this.conn, postData.text);
// bug 1462561 - Use "json" type and manually manage/marshall actors to woraround
// protocol.js performance issue
this.manage(postData.text);
let dataSize = postData.text.str.length;
postData.text = postData.text.form();
this.emit("network-event-update:post-data", "requestPostData", {
dataSize: postData.text.str.length,
dataSize,
discardRequestBody: this._discardRequestBody,
});
},
@ -325,7 +334,10 @@ const NetworkEventActor = protocol.ActorClassWithSpec(networkEventSpec, {
*/
addResponseStart(info, rawHeaders) {
rawHeaders = new LongStringActor(this.conn, rawHeaders);
this._response.rawHeaders = rawHeaders;
// bug 1462561 - Use "json" type and manually manage/marshall actors to woraround
// protocol.js performance issue
this.manage(rawHeaders);
this._response.rawHeaders = rawHeaders.form();
this._response.httpVersion = info.httpVersion;
this._response.status = info.status;
@ -399,6 +411,10 @@ const NetworkEventActor = protocol.ActorClassWithSpec(networkEventSpec, {
this._truncated = truncated;
this._response.content = content;
content.text = new LongStringActor(this.conn, content.text);
// bug 1462561 - Use "json" type and manually manage/marshall actors to woraround
// protocol.js performance issue
this.manage(content.text);
content.text = content.text.form();
this.emit("network-event-update:response-content", "responseContent", {
mimeType: content.mimeType,
@ -442,6 +458,10 @@ const NetworkEventActor = protocol.ActorClassWithSpec(networkEventSpec, {
_prepareHeaders(headers) {
for (let header of headers) {
header.value = new LongStringActor(this.conn, header.value);
// bug 1462561 - Use "json" type and manually manage/marshall actors to woraround
// protocol.js performance issue
this.manage(header.value);
header.value = header.value.form();
}
},
});

Просмотреть файл

@ -161,10 +161,21 @@ function fetchStylesheetFromNetworkMonitor(href, consoleActor) {
if (request._discardResponseBody || request._truncated || !content) {
return null;
}
// `content.text` is a LongStringActor instance
// Get a reference to the raw string via `str` property
if (content.text.type != "longString") {
// For short strings, the text is available directly.
return {
content: content.text,
contentType: content.mimeType,
};
}
// For long strings, look up the actor that holds the full text.
let longStringActor = consoleActor.conn._getOrCreateActor(content.text.actor);
if (!longStringActor) {
return null;
}
return {
content: content.text.str,
content: longStringActor.str,
contentType: content.mimeType,
};
}

Просмотреть файл

@ -163,39 +163,39 @@ const networkEventSpec = generateActorSpec({
},
getRequestHeaders: {
request: {},
response: RetVal("netevent.headers")
response: RetVal("json")
},
getRequestCookies: {
request: {},
response: RetVal("netevent.cookies")
response: RetVal("json")
},
getRequestPostData: {
request: {},
response: RetVal("netevent.postdata")
response: RetVal("json")
},
getResponseHeaders: {
request: {},
response: RetVal("netevent.headers")
response: RetVal("json")
},
getResponseCookies: {
request: {},
response: RetVal("netevent.cookies")
response: RetVal("json")
},
getResponseCache: {
request: {},
response: RetVal("netevent.cache")
response: RetVal("json")
},
getResponseContent: {
request: {},
response: RetVal("netevent.content")
response: RetVal("json")
},
getEventTimings: {
request: {},
response: RetVal("netevent.timings")
response: RetVal("json")
},
getSecurityInfo: {
request: {},
response: RetVal("netevent.secinfo")
response: RetVal("json")
},
getStackTrace: {
request: {},