mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 454728 - DOMOperationCallback OOM checks should not prevent chrome script from running
This commit is contained in:
parent
106aaaae97
commit
b6fe550327
@ -906,37 +906,39 @@ nsJSContext::DOMOperationCallback(JSContext *cx)
|
||||
// try to clean up:
|
||||
nsJSContext::CC();
|
||||
|
||||
// if that didn't work, warn the user
|
||||
mem->IsLowMemory(&lowMemory);
|
||||
if (lowMemory) {
|
||||
// never prevent system scripts from running
|
||||
if (! ::JS_IsSystemObject(cx, ::JS_GetGlobalObject(cx))) {
|
||||
|
||||
PRBool preventDialog = nsContentUtils::GetBoolPref("dom.prevent_oom_dialog", PR_FALSE);
|
||||
if (preventDialog)
|
||||
return JS_FALSE;
|
||||
// lets see if CC() did anything, if not, cancel the script.
|
||||
mem->IsLowMemory(&lowMemory);
|
||||
if (lowMemory) {
|
||||
|
||||
nsCOMPtr<nsIPrompt> prompt = GetPromptFromContext(ctx);
|
||||
|
||||
nsXPIDLString title, msg;
|
||||
rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"LowMemoryTitle",
|
||||
title);
|
||||
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"LowMemoryMessage",
|
||||
msg);
|
||||
|
||||
//GetStringFromName can return NS_OK and still give NULL string
|
||||
if (NS_FAILED(rv) || !title || !msg) {
|
||||
NS_ERROR("Failed to get localized strings.");
|
||||
if (nsContentUtils::GetBoolPref("dom.prevent_oom_dialog", PR_FALSE))
|
||||
return JS_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPrompt> prompt = GetPromptFromContext(ctx);
|
||||
|
||||
nsXPIDLString title, msg;
|
||||
rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"LowMemoryTitle",
|
||||
title);
|
||||
|
||||
rv |= nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
|
||||
"LowMemoryMessage",
|
||||
msg);
|
||||
|
||||
//GetStringFromName can return NS_OK and still give NULL string
|
||||
if (NS_FAILED(rv) || !title || !msg) {
|
||||
NS_ERROR("Failed to get localized strings.");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
prompt->Alert(title, msg);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
prompt->Alert(title, msg);
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PRTime now = PR_Now();
|
||||
|
||||
if (LL_IS_ZERO(callbackTime)) {
|
||||
|
Loading…
Reference in New Issue
Block a user