mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 11:27:49 +00:00
Bug 976777: Truncate long source lines in script errors before sending them to the parent process. r=bent
This fixes an out-of-memory foreground-tab crash that I could reliably reproduce on a 256MB Firefox OS phone, and I think also significantly reduces the number of background tabs I'm seeing killed due to low memory.
This commit is contained in:
parent
f5edb56a68
commit
449dc2dfe0
@ -268,6 +268,16 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = scriptError->GetSourceLine(sourceLine);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Before we send the error to the parent process (which
|
||||
// involves copying the memory), truncate any long lines. CSS
|
||||
// errors in particular share the memory for long lines with
|
||||
// repeated errors, but the IPC communication we're about to do
|
||||
// will break that sharing, so we better truncate now.
|
||||
if (sourceLine.Length() > 1000) {
|
||||
sourceLine.Truncate(1000);
|
||||
}
|
||||
|
||||
rv = scriptError->GetCategory(getter_Copies(category));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = scriptError->GetLineNumber(&lineNum);
|
||||
|
Loading…
x
Reference in New Issue
Block a user