void JSGlobalObject::addFunction(ExecState* exec, const Identifier& propertyName, JSValue value) { removeDirect(exec->vm(), propertyName); // Newly declared functions overwrite existing properties. NewGlobalVar var = addGlobalVar(propertyName, IsVariable); registerAt(var.registerNumber).set(exec->vm(), this, value); if (var.set) var.set->notifyWrite(value); }
// ECMA 8.6.2.5 bool JSObject::deleteProperty(ExecState* exec, const Identifier& propertyName) { unsigned attributes; if (m_structureID->get(propertyName, attributes) != WTF::notFound) { if ((attributes & DontDelete)) return false; removeDirect(propertyName); return true; } // Look in the static hashtable of properties const HashEntry* entry = findPropertyHashEntry(exec, propertyName); if (entry && entry->attributes() & DontDelete) return false; // this builtin property can't be deleted // FIXME: Should the code here actually do some deletion? return true; }