void JSProxy::setTarget(JSGlobalData& globalData, JSGlobalObject* globalObject) { ASSERT_ARG(globalObject, globalObject); m_target.set(globalData, this, globalObject); setPrototype(globalData, globalObject->prototype()); resetInheritorID(globalData); }
void DataSourceView::createDirectory() { QFileInfo fi = currentFileInfo(); CreateDirectoryDialog dlg(fi.absoluteFilePath()); if (dlg.exec() != QDialog::Accepted) return; if (QFile::exists(fi.absoluteFilePath() + "/" + dlg.name())) { QMessageBox::warning( this, tr("Directory exists"), tr("Directory %1 already exists.").arg(dlg.name()) ); return; } auto creator = new DirectoryCreator(fi.absoluteFilePath(), dlg.name(), this); if (dlg.hasPrototype()) creator->setPrototype(dlg.prototype()); creator->work(); }
// Set prototype, and also insert the object prototype at the end of the chain. void JSGlobalObject::resetPrototype(VM& vm, JSValue prototype) { setPrototype(vm, prototype); JSObject* oldLastInPrototypeChain = lastInPrototypeChain(this); JSObject* objectPrototype = m_objectPrototype.get(); if (oldLastInPrototypeChain != objectPrototype) oldLastInPrototypeChain->setPrototype(vm, objectPrototype); }
// Set prototype, and also insert the object prototype at the end of the chain. void JSGlobalObject::resetPrototype(JSValue prototype) { setPrototype(prototype); JSObject* oldLastInPrototypeChain = lastInPrototypeChain(this); JSObject* objectPrototype = d()->objectPrototype; if (oldLastInPrototypeChain != objectPrototype) oldLastInPrototypeChain->setPrototype(objectPrototype); }
JSSVGPathSegClosePath::JSSVGPathSegClosePath(ExecState* exec, SVGPathSegClosePath* impl) : JSSVGPathSeg(exec, impl) { setPrototype(JSSVGPathSegClosePathPrototype::self(exec)); }
JSSVGUnitTypesConstructor(ExecState* exec) { setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); putDirect(exec->propertyNames().prototype, JSSVGUnitTypesPrototype::self(exec), None); }
JSHTMLScriptElement::JSHTMLScriptElement(ExecState* exec, HTMLScriptElement* impl) : JSHTMLElement(exec, impl) { setPrototype(JSHTMLScriptElementPrototype::self(exec)); }
JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* d) : m_doc(d) { setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); put(exec, lengthPropertyName, jsNumber(4), ReadOnly|DontDelete|DontEnum); }
JSSVGPathSegCurvetoQuadraticSmoothRel::JSSVGPathSegCurvetoQuadraticSmoothRel(ExecState* exec, SVGPathSegCurvetoQuadraticSmoothRel* impl) : JSSVGPathSeg(exec, impl) { setPrototype(JSSVGPathSegCurvetoQuadraticSmoothRelPrototype::self(exec)); }
JSSVGFEPointLightElement::JSSVGFEPointLightElement(ExecState* exec, SVGFEPointLightElement* impl) : JSSVGElement(exec, impl) { setPrototype(JSSVGFEPointLightElementPrototype::self(exec)); }
JSClipboard::JSClipboard(ExecState* exec, Clipboard* clipboard) : m_impl(clipboard) { setPrototype(JSClipboardPrototype::self(exec)); }
JSSVGTRefElement::JSSVGTRefElement(ExecState* exec, SVGTRefElement* impl) : JSSVGTextPositioningElement(exec, impl) { setPrototype(JSSVGTRefElementPrototype::self(exec)); }
JSNodeIterator::JSNodeIterator(ExecState* exec, NodeIterator* impl) : m_impl(impl) { setPrototype(JSNodeIteratorPrototype::self(exec)); }
JSSVGAnimatedRect::JSSVGAnimatedRect(ExecState* exec, SVGAnimatedRect* impl) : m_impl(impl) { setPrototype(JSSVGAnimatedRectPrototype::self(exec)); }
JSNode::JSNode(ExecState* exec, Node* impl) : m_impl(impl) { setPrototype(JSNodePrototype::self(exec)); }
JSXPathEvaluatorConstructor(ExecState* exec) { setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); putDirect(exec->propertyNames().prototype, JSXPathEvaluatorPrototype::self(exec), None); }
JSRange::JSRange(ExecState* exec, Range* impl) : m_impl(impl) { setPrototype(JSRangePrototype::self(exec)); }
JSMouseEvent::JSMouseEvent(ExecState* exec, MouseEvent* impl) : JSUIEvent(exec, impl) { setPrototype(JSMouseEventPrototype::self(exec)); }
JSSVGColor::JSSVGColor(ExecState* exec, SVGColor* impl) : JSCSSValue(exec, impl) { setPrototype(JSSVGColorPrototype::self(exec)); }
JSSVGAnimateElement::JSSVGAnimateElement(ExecState* exec, SVGAnimateElement* impl) : JSSVGAnimationElement(exec, impl) { setPrototype(JSSVGAnimateElementPrototype::self(exec)); }
JSCSSStyleSheet::JSCSSStyleSheet(ExecState* exec, CSSStyleSheet* impl) : JSStyleSheet(exec, impl) { setPrototype(JSCSSStyleSheetPrototype::self(exec)); }
JSSVGElementInstanceList::JSSVGElementInstanceList(ExecState* exec, SVGElementInstanceList* impl) : m_impl(impl) { setPrototype(JSSVGElementInstanceListPrototype::self(exec)); }
JSHTMLScriptElementConstructor(ExecState* exec) { setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); putDirect(exec->propertyNames().prototype, JSHTMLScriptElementPrototype::self(exec), None); }
// ECMA 8.6.2.2 void JSObject::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { ASSERT(value); ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); if (propertyName == exec->propertyNames().underscoreProto) { // Setting __proto__ to a non-object, non-null value is silently ignored to match Mozilla. if (!value.isObject() && !value.isNull()) return; JSValue nextPrototypeValue = value; while (nextPrototypeValue && nextPrototypeValue.isObject()) { JSObject* nextPrototype = asObject(nextPrototypeValue)->unwrappedObject(); if (nextPrototype == this) { throwError(exec, GeneralError, "cyclic __proto__ value"); return; } nextPrototypeValue = nextPrototype->prototype(); } setPrototype(value); return; } // Check if there are any setters or getters in the prototype chain JSValue prototype; for (JSObject* obj = this; !obj->structure()->hasGetterSetterProperties(); obj = asObject(prototype)) { prototype = obj->prototype(); if (prototype.isNull()) { putDirectInternal(exec->globalData(), propertyName, value, 0, true, slot); return; } } unsigned attributes; JSCell* specificValue; if ((m_structure->get(propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly) return; for (JSObject* obj = this; ; obj = asObject(prototype)) { if (JSValue gs = obj->getDirect(propertyName)) { if (gs.isGetterSetter()) { JSObject* setterFunc = asGetterSetter(gs)->setter(); if (!setterFunc) { throwSetterError(exec); return; } CallData callData; CallType callType = setterFunc->getCallData(callData); MarkedArgumentBuffer args; args.append(value); call(exec, setterFunc, callType, callData, this, args); return; } // If there's an existing property on the object or one of its // prototypes it should be replaced, so break here. break; } prototype = obj->prototype(); if (prototype.isNull()) break; } putDirectInternal(exec->globalData(), propertyName, value, 0, true, slot); return; }
JSSVGPathSegArcRel::JSSVGPathSegArcRel(ExecState* exec, SVGPathSegArcRel* impl) : JSSVGPathSeg(exec, impl) { setPrototype(JSSVGPathSegArcRelPrototype::self(exec)); }
JSText::JSText(ExecState* exec, Text* impl) : JSCharacterData(exec, impl) { setPrototype(JSTextPrototype::self(exec)); }
JSSVGUnitTypes::JSSVGUnitTypes(ExecState* exec, SVGUnitTypes* impl, SVGElement* context) : m_context(context) , m_impl(impl) { setPrototype(JSSVGUnitTypesPrototype::self(exec)); }
JSSVGLength::JSSVGLength(ExecState* exec, JSSVGPODTypeWrapper<SVGLength>* impl, SVGElement* context) : m_context(context) , m_impl(impl) { setPrototype(JSSVGLengthPrototype::self(exec)); }
JSSVGPolygonElement::JSSVGPolygonElement(ExecState* exec, SVGPolygonElement* impl) : JSSVGElement(exec, impl) { setPrototype(JSSVGPolygonElementPrototype::self(exec)); }
JSXPathEvaluator::JSXPathEvaluator(ExecState* exec, XPathEvaluator* impl) : m_impl(impl) { setPrototype(JSXPathEvaluatorPrototype::self(exec)); }