зеркало из https://github.com/mozilla/pjs.git
Bug 598851 - HUDService's ResponseListener eats all my memory r=dietrich a=betaN+
This commit is contained in:
Родитель
122f49db5f
Коммит
f3d2f54329
|
@ -116,6 +116,9 @@ const SEARCH_DELAY = 200;
|
|||
// "devtools.hud.loglimit" preference.
|
||||
const DEFAULT_LOG_LIMIT = 200;
|
||||
|
||||
// The maximum number of bytes a Network ResponseListener can hold.
|
||||
const RESPONSE_BODY_LIMIT = 1048576; // 1 MB
|
||||
|
||||
const ERRORS = { LOG_MESSAGE_MISSING_ARGS:
|
||||
"Missing arguments: aMessage, aConsoleNode and aMessageNode are required.",
|
||||
CANNOT_GET_HUD: "Cannot getHeads Up Display with provided ID",
|
||||
|
@ -218,7 +221,12 @@ ResponseListener.prototype =
|
|||
binaryOutputStream = new BinaryOutputStream(storageStream.getOutputStream(0));
|
||||
|
||||
let data = NetUtil.readInputStreamToString(aInputStream, aCount);
|
||||
|
||||
if (HUDService.saveRequestAndResponseBodies &&
|
||||
this.receivedData.length < RESPONSE_BODY_LIMIT) {
|
||||
this.receivedData += data;
|
||||
}
|
||||
|
||||
binaryOutputStream.writeBytes(data, aCount);
|
||||
|
||||
let newInputStream = storageStream.newInputStream(0);
|
||||
|
@ -289,7 +297,9 @@ ResponseListener.prototype =
|
|||
}
|
||||
});
|
||||
this.httpActivity.response.isDone = true;
|
||||
this.httpActivity.response.listener = null;
|
||||
this.httpActivity = null;
|
||||
this.receivedData = "";
|
||||
},
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([
|
||||
|
|
|
@ -70,6 +70,7 @@ function testNetworkLogging()
|
|||
is(httpActivity.method, "GET", "Method is correct");
|
||||
ok(!("body" in httpActivity.request), "No request body was stored");
|
||||
ok(!("body" in httpActivity.response), "No response body was stored");
|
||||
ok(!httpActivity.response.listener, "No response listener is stored");
|
||||
|
||||
// Turn on logging of request bodies and check again.
|
||||
// HUDService.saveRequestAndResponseBodies = true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче