JSDOMWindowCustom.cpp [plain text]
#include "config.h"
#include "JSDOMWindow.h"
#include "kjs_window.h"
#include "DOMWindow.h"
namespace WebCore {
bool JSDOMWindow::customGetOwnPropertySlot(KJS::ExecState* exec, const KJS::Identifier& propertyName, KJS::PropertySlot& slot)
{
if (!impl()->frame()) {
if (propertyName == "closed") {
const KJS::HashEntry* entry = KJS::Lookup::findEntry(classInfo()->propHashTable, propertyName);
ASSERT(entry);
if (entry) {
slot.setStaticEntry(this, entry, KJS::staticValueGetter<JSDOMWindow>);
return true;
}
}
if (propertyName == "close") {
KJS::JSValue* proto = prototype();
if (proto->isObject()) {
const KJS::HashEntry* entry = KJS::Lookup::findEntry(static_cast<KJS::JSObject*>(proto)->classInfo()->propHashTable, propertyName);
ASSERT(entry);
if (entry) {
slot.setStaticEntry(this, entry, KJS::staticFunctionGetter<JSDOMWindowPrototypeFunction>);
return true;
}
}
}
slot.setUndefined(this);
return true;
}
KJS::JSValue** val = getDirectLocation(propertyName);
if (val) {
if (!isSafeScript(exec)) {
slot.setUndefined(this);
return true;
}
if (_prop.hasGetterSetterProperties() && val[0]->type() == KJS::GetterSetterType)
fillGetterPropertySlot(slot, val);
else
slot.setValueSlot(this, val);
return true;
}
KJS::JSValue* proto = prototype();
if (proto->isObject()) {
const KJS::HashEntry* entry = KJS::Lookup::findEntry(static_cast<KJS::JSObject*>(proto)->classInfo()->propHashTable, propertyName);
if (entry) {
if (entry->attr & KJS::Function) {
switch (entry->value) {
case FocusFuncNum:
case BlurFuncNum:
case CloseFuncNum:
slot.setStaticEntry(this, entry, KJS::staticFunctionGetter<JSDOMWindowPrototypeFunction>);
return true;
default:
if (!isSafeScript(exec))
slot.setUndefined(this);
else
slot.setStaticEntry(this, entry, KJS::staticFunctionGetter<JSDOMWindowPrototypeFunction>);
return true;
}
}
}
}
return false;
}
bool JSDOMWindow::customPut(KJS::ExecState* exec, const KJS::Identifier& propertyName, KJS::JSValue* value, int attr)
{
if (!impl()->frame())
return true;
if (attr != KJS::None && attr != KJS::DontDelete) {
KJS::JSObject::put(exec, propertyName, value, attr);
return true;
}
if (KJS::JSObject::getDirect(propertyName)) {
if (isSafeScript(exec))
KJS::JSObject::put(exec, propertyName, value, attr);
return true;
}
return false;
}
}