This commit is contained in:
jst%netscape.com 2001-11-21 13:06:18 +00:00
Родитель 41ad8500aa
Коммит 280b9574e1
1 изменённых файлов: 0 добавлений и 96 удалений

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

@ -3183,102 +3183,6 @@ nsDocument::CreateEvent(const nsAReadableString& aEventType,
return NS_ERROR_FAILURE;
}
#if 0
PRBool nsDocument::AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp)
{
return PR_TRUE;
}
PRBool nsDocument::DeleteProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp)
{
return PR_TRUE;
}
PRBool nsDocument::GetProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp)
{
return PR_TRUE;
}
PRBool nsDocument::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp)
{
return InternalRegisterCompileEventHandler(aContext, aID, aVp, PR_FALSE);
}
PRBool nsDocument::EnumerateProperty(JSContext *aContext, JSObject *aObj)
{
return PR_TRUE;
}
PRBool nsDocument::Resolve(JSContext *aContext, JSObject *aObj, jsval aID,
PRBool *aDidDefineProperty)
{
*aDidDefineProperty = PR_FALSE;
return InternalRegisterCompileEventHandler(aContext, aID, nsnull, PR_TRUE);
}
PRBool nsDocument::Convert(JSContext *aContext, JSObject *aObj, jsval aID)
{
return PR_TRUE;
}
void nsDocument::Finalize(JSContext *aContext, JSObject *aObj)
{
}
PRBool nsDocument::InternalRegisterCompileEventHandler(JSContext* aContext, jsval aPropName,
jsval *aVp, PRBool aCompile)
{
//If called from resolve there is no aVp arg to check against. Else check for function value.
//In both cases check for string type starting with 'on' before continuing with handler checking.
if ((!aVp || JS_TypeOfValue(aContext, *aVp) == JSTYPE_FUNCTION) && JSVAL_IS_STRING(aPropName)) {
const PRUnichar* str = NS_REINTERPRET_CAST(const PRUnichar *, JS_GetStringChars(JS_ValueToString(aContext, aPropName)));
if (str && str[0] == 'o' && str[1] == 'n' && str[2]) {
nsCOMPtr<nsIAtom> atom(dont_AddRef(NS_NewAtom(str)));
if (atom.get() == nsLayoutAtoms::onmousedown || atom.get() == nsLayoutAtoms::onmouseup ||
atom.get() == nsLayoutAtoms::onclick || atom.get() == nsLayoutAtoms::onmouseover ||
atom.get() == nsLayoutAtoms::onmouseout ||atom.get() == nsLayoutAtoms::onkeydown ||
atom.get() == nsLayoutAtoms::onkeyup || atom.get() == nsLayoutAtoms::onkeypress ||
atom.get() == nsLayoutAtoms::onmousemove || atom.get() == nsLayoutAtoms::onfocus ||
atom.get() == nsLayoutAtoms::onblur || atom.get() == nsLayoutAtoms::onsubmit ||
atom.get() == nsLayoutAtoms::onreset || atom.get() == nsLayoutAtoms::onchange ||
atom.get() == nsLayoutAtoms::onselect || atom.get() == nsLayoutAtoms::onload ||
atom.get() == nsLayoutAtoms::onunload || atom.get() == nsLayoutAtoms::onabort ||
atom.get() == nsLayoutAtoms::onerror || atom.get() == nsLayoutAtoms::onpaint ||
atom.get() == nsLayoutAtoms::onresize || atom.get() == nsLayoutAtoms::onscroll ||
atom.get() == nsLayoutAtoms::oncontextmenu || atom.get() == nsLayoutAtoms::onDOMAttrModified ||
atom.get() == nsLayoutAtoms::onDOMCharacterDataModified || atom.get() == nsLayoutAtoms::onDOMSubtreeModified ||
atom.get() == nsLayoutAtoms::onDOMNodeInsertedIntoDocument || atom.get() == nsLayoutAtoms::onDOMNodeRemovedFromDocument ||
atom.get() == nsLayoutAtoms::onDOMNodeInserted || atom.get() == nsLayoutAtoms::onDOMNodeRemoved
) {
nsCOMPtr<nsIEventListenerManager> manager;
GetListenerManager(getter_AddRefs(manager));
if (manager) {
nsCOMPtr<nsIScriptContext> scriptContext;
nsresult rv = nsContentUtils::GetStaticScriptContext(aContext, NS_REINTERPRET_CAST(JSObject*, mScriptObject),
getter_AddRefs(scriptContext));
if (NS_SUCCEEDED(rv) && scriptContext) {
if (aCompile) {
rv = manager->CompileScriptEventListener(scriptContext, this, atom);
}
else {
rv = manager->RegisterScriptEventListener(scriptContext, this, atom);
}
}
if (NS_FAILED(rv))
return PR_FALSE;
}
}
}
}
return PR_TRUE;
}
#endif
NS_IMETHODIMP
nsDocument::SaveFile( nsIURI* aLocation,
PRBool aReplaceExisting, // only used for local file locations