Bug 388665 Javascript interferes with STATE_EDITABLE

r=aaronleventhal sr=bzbarsky
This commit is contained in:
ginn.chen%sun.com 2007-07-25 06:24:00 +00:00
Родитель e103411cfc
Коммит 533388e4cf
2 изменённых файлов: 18 добавлений и 0 удалений

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

@ -54,6 +54,7 @@ REQUIRES = content \
gfx \
imglib2 \
intl \
js \
layout \
locale \
necko \
@ -61,6 +62,7 @@ REQUIRES = content \
webshell \
widget \
xpcom \
xpconnect \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)

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

@ -51,6 +51,9 @@
#include "nsIFrame.h"
#include "nsINameSpaceManager.h"
#include "nsISelectionController.h"
#include "jsapi.h"
#include "nsIJSContextStack.h"
#include "nsIServiceManager.h"
#include "nsITextControlFrame.h"
// --- checkbox -----
@ -556,11 +559,24 @@ void nsHTMLTextFieldAccessible::CheckForEditor()
return;
}
// nsGenericHTMLElement::GetEditor has a security check.
// Make sure we're not restricted by the permissions of
// whatever script is currently running.
nsCOMPtr<nsIJSContextStack> stack =
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
PRBool pushed = stack && NS_SUCCEEDED(stack->Push(nsnull));
nsCOMPtr<nsIEditor> editor;
nsresult rv = editableElt->GetEditor(getter_AddRefs(editor));
if (NS_SUCCEEDED(rv)) {
SetEditor(editor);
}
if (pushed) {
JSContext* cx;
stack->Pop(&cx);
NS_ASSERTION(!cx, "context should be null");
}
}
// --- groupbox -----