Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 70
View file
lightspark.spec
Changed
@@ -24,7 +24,7 @@ %endif Name: lightspark -Version: 0.7.2.99+git20150603.1702 +Version: 0.7.2.99+git20150607.1836 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/src/asobject.cpp
Changed
@@ -313,7 +313,7 @@ return ret; } - throw Class<TypeError>::getInstanceS(); + throwError<TypeError>(kConvertToPrimitiveError,this->getClassName()); return _MR((ASObject*)NULL); } @@ -566,6 +566,7 @@ // fixed properties cannot be deleted if (hasPropertyByMultiname(name,true,true)) return false; + //unknown variables must return true return true; } @@ -631,7 +632,7 @@ //looking for a settable even if a super class sets //has_getter to true. obj=cls->findBorrowedSettable(name,&has_getter); - if(obj && cls->isFinal && !obj->setter) + if(obj && (cls->isFinal || cls->isSealed) && !obj->setter) { throwError<ReferenceError>(kCannotAssignToMethodError, name.normalizedName(), cls ? cls->getQualifiedClassName() : ""); } @@ -851,6 +852,8 @@ const variable* variables_map::findObjVar(const multiname& mname, uint32_t traitKinds, NS_KIND &nskind) const { + if (mname.isEmpty()) + return NULL; uint32_t name=mname.normalizedNameId(); assert(!mname.ns.empty()); @@ -933,12 +936,13 @@ mainObj->as<Class_base>()->class_name.getQualifiedName() == typemname->qualifiedString()) { // avoid recursive construction - obj = getSys()->getNullRef(); + //obj = getSys()->getNullRef(); + obj = getSys()->getUndefinedRef(); } else if (type != Class_object::getClass() && dynamic_cast<const Class_base*>(type)) { - if (!((Class_base*)type)->super) + //if (!((Class_base*)type)->super) { // super type could not be found, so the class is stored as an uninitialized variable LOG(LOG_CALLS,"add uninitialized class var:"<<mname); @@ -952,8 +956,8 @@ obj = getSys()->getNullRef(); obj = type->coerce(obj); } - else - obj = ((Class_base*)type)->getInstance(false,NULL,0); + //else + // obj = ((Class_base*)type)->getInstance(false,NULL,0); } else { @@ -984,16 +988,16 @@ ASFUNCTIONBODY(ASObject,_toString) { tiny_string ret; - if(obj->getClass()) + if (obj->is<Class_base>()) { ret="[object "; - ret+=obj->getClass()->class_name.name; + ret+=static_cast<Class_base*>(obj)->class_name.name; ret+="]"; } - else if (obj->is<Class_base>()) + else if(obj->getClass()) { ret="[object "; - ret+=static_cast<Class_base*>(obj)->class_name.name; + ret+=obj->getClass()->class_name.name; ret+="]"; } else
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -261,13 +261,13 @@ builtin->registerBuiltin("print","",_MR(Class<IFunction>::getFunction(print))); builtin->registerBuiltin("trace","",_MR(Class<IFunction>::getFunction(trace))); builtin->registerBuiltin("parseInt","",_MR(Class<IFunction>::getFunction(parseInt,2))); - builtin->registerBuiltin("parseFloat","",_MR(Class<IFunction>::getFunction(parseFloat))); + builtin->registerBuiltin("parseFloat","",_MR(Class<IFunction>::getFunction(parseFloat,1))); builtin->registerBuiltin("encodeURI","",_MR(Class<IFunction>::getFunction(encodeURI))); builtin->registerBuiltin("decodeURI","",_MR(Class<IFunction>::getFunction(decodeURI))); builtin->registerBuiltin("encodeURIComponent","",_MR(Class<IFunction>::getFunction(encodeURIComponent))); builtin->registerBuiltin("decodeURIComponent","",_MR(Class<IFunction>::getFunction(decodeURIComponent))); - builtin->registerBuiltin("escape","",_MR(Class<IFunction>::getFunction(escape))); - builtin->registerBuiltin("unescape","",_MR(Class<IFunction>::getFunction(unescape))); + builtin->registerBuiltin("escape","",_MR(Class<IFunction>::getFunction(escape,1))); + builtin->registerBuiltin("unescape","",_MR(Class<IFunction>::getFunction(unescape,1))); builtin->registerBuiltin("toString","",_MR(Class<IFunction>::getFunction(ASObject::_toString))); builtin->registerBuiltin("AccessibilityProperties","flash.accessibility",Class<AccessibilityProperties>::getRef()); @@ -502,8 +502,8 @@ builtin->registerBuiltin("PrintJobOptions","flash.printing",Class<PrintJobOptions>::getRef()); builtin->registerBuiltin("PrintJobOrientation","flash.printing",Class<PrintJobOrientation>::getRef()); - builtin->registerBuiltin("isNaN","",_MR(Class<IFunction>::getFunction(isNaN))); - builtin->registerBuiltin("isFinite","",_MR(Class<IFunction>::getFunction(isFinite))); + builtin->registerBuiltin("isNaN","",_MR(Class<IFunction>::getFunction(isNaN,1))); + builtin->registerBuiltin("isFinite","",_MR(Class<IFunction>::getFunction(isFinite,1))); builtin->registerBuiltin("isXMLName","",_MR(Class<IFunction>::getFunction(_isXMLName))); @@ -724,9 +724,11 @@ case 0x0D: //QNameA { ret->ns.push_back(nsNameAndKind(this, m->ns)); - - ret->name_s_id=getSys()->getUniqueStringId(getString(m->name)); - ret->name_type=multiname::NAME_STRING; + if (m->name) + { + ret->name_s_id=getSys()->getUniqueStringId(getString(m->name)); + ret->name_type=multiname::NAME_STRING; + } break; } case 0x09: //Multiname @@ -740,8 +742,11 @@ } sort(ret->ns.begin(),ret->ns.end()); - ret->name_s_id=getSys()->getUniqueStringId(getString(m->name)); - ret->name_type=multiname::NAME_STRING; + if (m->name) + { + ret->name_s_id=getSys()->getUniqueStringId(getString(m->name)); + ret->name_type=multiname::NAME_STRING; + } break; } case 0x1b: //MultinameL @@ -1555,7 +1560,7 @@ method_info* m=get_method(scripts[i].init); SyntheticFunction* entry=Class<IFunction>::getSyntheticFunction(m); - + g->incRef(); entry->addToScope(scope_entry(_MR(g),false));
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -394,6 +394,10 @@ for(int i=0;i<m;i++) args[i]->decRef(); //LOG(LOG_NOT_IMPLEMENTED,"callProperty: " << name->qualifiedString() << " not found on " << obj->toDebugString()); + if (obj->hasPropertyByMultiname(*name,true,true)) + throwError<ReferenceError>(kWriteOnlyError, name->normalizedName(), obj->getClass()->getQualifiedClassName()); + if (obj->getClass() && obj->getClass()->isSealed) + throwError<ReferenceError>(kReadSealedError, name->normalizedName(), obj->getClass()->getQualifiedClassName()); throwError<TypeError>(kCallNotFoundError, name->qualifiedString(), obj->getClassName()); if(keepReturn) @@ -439,6 +443,10 @@ { if (obj->getClass() && obj->getClass()->isSealed) throwError<ReferenceError>(kReadSealedError, name->normalizedName(), obj->getClass()->getQualifiedClassName()); + if (name->isEmpty()) + throwError<ReferenceError>(kReadSealedErrorNs, name->normalizedName(), obj->getClassName()); + if (obj->is<Undefined>()) + throwError<TypeError>(kConvertUndefinedToObjectError); if (Log::getLevel() >= LOG_NOT_IMPLEMENTED && obj->getClassName() != "Object") LOG(LOG_NOT_IMPLEMENTED,"getProperty: " << name->normalizedName() << " not found on " << obj->toDebugString()); ret = getSys()->getUndefinedRef(); @@ -712,7 +720,7 @@ ret=o_class->getInstance(true,args,m); break; } - +/* case T_OBJECT: { Class_base* o_class=static_cast<Class_base*>(obj->getClass()); @@ -720,7 +728,7 @@ ret=o_class->getInstance(true,args,m); break; } - +*/ case T_FUNCTION: { ret = constructFunction(th, obj->as<IFunction>(), args, m); @@ -1326,19 +1334,30 @@ ASObject* obj=th->runtime_stack_pop(); - assert_and_throw(th->inClass); - assert_and_throw(th->inClass->super); - assert_and_throw(obj->getClass()); - assert_and_throw(obj->getClass()->isSubClass(th->inClass)); - - _NR<ASObject> ret = obj->getVariableByMultiname(*name,ASObject::NONE,th->inClass->super.getPtr()); - name->resetNameIfObject(); - if(ret.isNull()) + if(obj->is<Null>()) { - LOG(LOG_NOT_IMPLEMENTED,"getSuper: " << name->normalizedName() << " not found on " << obj->toDebugString()); - ret = _MNR(getSys()->getUndefinedRef()); + LOG(LOG_ERROR,"calling getSuper on null:" << *name << ' ' << obj->toDebugString()); + throwError<TypeError>(kConvertNullToObjectError); + } + if (obj->is<Undefined>()) + { + LOG(LOG_ERROR,"calling getSuper on undefined:" << *name << ' ' << obj->toDebugString()); + throwError<TypeError>(kConvertUndefinedToObjectError); } + Class_base* cls = NULL; + if (th->inClass && !th->inClass->super.isNull()) + cls = th->inClass->super.getPtr(); + else if (obj->getClass() && !obj->getClass()->super.isNull()) + cls = obj->getClass()->super.getPtr(); + assert_and_throw(cls); + + _NR<ASObject> ret = obj->getVariableByMultiname(*name,ASObject::NONE,cls); + if (ret.isNull()) + throwError<ReferenceError>(kCallOfNonFunctionError,name->normalizedName()); + + name->resetNameIfObject(); + obj->decRef(); ret->incRef(); th->runtime_stack_push(ret.getPtr()); @@ -1881,10 +1900,7 @@ multiname* name=th->context->getMultiname(n,th); ASObject* obj=th->runtime_stack_pop(); LOG(LOG_CALLS,"getDescendants " << *name << " " <<name->isAttribute<< " "<<obj->getClassName()); - //The name must be a QName - assert_and_throw(name->name_type==multiname::NAME_STRING); XML::XMLVector ret; - //TODO: support multiname and namespaces XMLList* targetobject = NULL; if(obj->getClass()==Class<XML>::getClass()) { @@ -1897,7 +1913,7 @@ if (ns_uri.empty() && name->ns.size() == 1) ns_uri="*"; } - xmlObj->getDescendantsByQName(getSys()->getStringFromUniqueId(name->name_s_id), ns_uri,name->isAttribute, ret); + xmlObj->getDescendantsByQName(name->normalizedName(), ns_uri,name->isAttribute, ret); } else if(obj->getClass()==Class<XMLList>::getClass()) { @@ -1910,7 +1926,7 @@ ns_uri="*"; } targetobject = xmlObj; - xmlObj->getDescendantsByQName(getSys()->getStringFromUniqueId(name->name_s_id), ns_uri,name->isAttribute, ret); + xmlObj->getDescendantsByQName(name->normalizedName(), ns_uri,name->isAttribute, ret); } else if(obj->getClass()->isSubClass(Class<Proxy>::getClass())) { @@ -1931,7 +1947,6 @@ ASObject* namearg = Class<ASString>::getInstanceS(name->normalizedName()); namearg->setProxyProperty(*name); proxyArgs[1]=namearg; - LOG(LOG_ERROR,"Proxy::getDescend:"<<namearg->toDebugString()<<*name); //We now suppress special handling LOG(LOG_CALLS,_("Proxy::callProperty")); @@ -2365,7 +2380,12 @@ bool ABCVm::deleteProperty(ASObject* obj, multiname* name) { - LOG(LOG_CALLS,_("deleteProperty ") << *name); + LOG(LOG_CALLS,_("deleteProperty ") << *name<<" "<<obj->toDebugString()); + if (name->name_type == multiname::NAME_OBJECT && name->name_o) + { + if (name->name_o->is<XMLList>()) + throwError<TypeError>(kDeleteTypeError,name->name_o->getClassName()); + } bool ret = obj->deleteVariableByMultiname(*name); obj->decRef();
View file
lightspark.tar.xz/src/scripting/toplevel/Array.cpp
Changed
@@ -345,17 +345,25 @@ return NULL; ASObject* params[3]; - std::map<uint32_t, data_slot>::iterator it=th->data.begin(); - for(;it != th->data.end();++it) + uint32_t s = th->size(); + for (uint32_t i=0; i < s; i++ ) { - if (it->second.type==DATA_OBJECT) + if (th->data.count(i)) { - params[0] = it->second.data; - it->second.data->incRef(); + const data_slot& slot=th->data[i]; + if(slot.type==DATA_INT) + params[0]=abstract_i(slot.data_i); + else if(slot.type==DATA_OBJECT && slot.data) + { + params[0]=slot.data; + params[0]->incRef(); + } + else + params[0]=getSys()->getUndefinedRef(); } else - params[0] =abstract_d(it->second.data_i); - params[1] = abstract_i(it->first); + continue; + params[1] = abstract_i(i); params[2] = th; th->incRef(); @@ -1279,6 +1287,8 @@ bool Array::isValidMultiname(const multiname& name, uint32_t& index) { + if(name.isEmpty()) + return false; //First of all the multiname has to contain the null namespace //As the namespace vector is sorted, we check only the first one assert_and_throw(name.ns.size()!=0); @@ -1315,7 +1325,11 @@ assert_and_throw(implEnable); uint32_t index=0; if(!isValidMultiname(name,index)) - return ASObject::setVariableByMultiname(name,o,allowConst); + { + ASObject::setVariableByMultiname(name,o,allowConst); +// setIsEnumerable(name,false); + return; + } // Derived classes may be sealed! if (getClass() && getClass()->isSealed) throwError<ReferenceError>(kWriteSealedError,
View file
lightspark.tar.xz/src/scripting/toplevel/Vector.cpp
Changed
@@ -848,21 +848,24 @@ Vector* th=static_cast<Vector*>(obj); if (th->fixed) throwError<RangeError>(kVectorFixedError); - th->vec.resize(th->size()+argslen, NULL); - for(uint32_t i=th->size();i> 0;i--) + if (argslen > 0) { - if (th->vec[i-1]) + th->vec.resize(th->size()+argslen, NULL); + for(uint32_t i=th->size();i> 0;i--) { - th->vec[(i-1)+argslen]=th->vec[i-1]; - th->vec[i-1] = NULL; + if (th->vec[i-1]) + { + th->vec[(i-1)+argslen]=th->vec[i-1]; + th->vec[i-1] = NULL; + } + } - } - - for(uint32_t i=0;i<argslen;i++) - { - args[i]->incRef(); - th->vec[i] = th->vec_type->coerce(args[i]); + for(uint32_t i=0;i<argslen;i++) + { + args[i]->incRef(); + th->vec[i] = th->vec_type->coerce(args[i]); + } } return abstract_i(th->size()); } @@ -1014,7 +1017,7 @@ } } -tiny_string Vector::toString(bool debugMsg) +tiny_string Vector::toString() { //TODO: test tiny_string t;
View file
lightspark.tar.xz/src/scripting/toplevel/Vector.h
Changed
@@ -63,7 +63,7 @@ bool sameType(const QName& classname) const; //Overloads - tiny_string toString(bool debugMsg=false); + tiny_string toString(); void setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst); bool hasPropertyByMultiname(const multiname& name, bool considerDynamic, bool considerPrototype); _NR<ASObject> getVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt);
View file
lightspark.tar.xz/src/scripting/toplevel/XML.cpp
Changed
@@ -69,7 +69,7 @@ void XML::sinit(Class_base* c) { - CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); + CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL); setDefaultXMLSettings(); c->setDeclaredMethodByQName("ignoreComments","",Class<IFunction>::getFunction(_getIgnoreComments),GETTER_METHOD,false); @@ -1226,7 +1226,7 @@ defns += getVm()->getDefaultXMLNamespace(); defns += "|"; tiny_string normalizedName= ""; - if (!name.isEmpty()) normalizedName= name.normalizedName(); + normalizedName= name.normalizedName(); if (normalizedName.startsWith("@")) normalizedName = normalizedName.substr(1,normalizedName.end()); tiny_string namespace_uri="|"; @@ -1328,12 +1328,26 @@ } else { - const XMLVector& ret=getValuesByMultiname(childrenlist,name); - if(ret.empty() && (opt & XML_STRICT)!=0) - return NullRef; - - _R<XMLList> ch =_MNR(Class<XMLList>::getInstanceS(ret,this->getChildrenlist(),name)); - return ch; + if (normalizedName == "*") + { + XMLVector ret; + childrenImpl(ret, "*"); + multiname mname(NULL); + mname.name_s_id=getSys()->getUniqueStringId("*"); + mname.name_type=multiname::NAME_STRING; + mname.ns.push_back(nsNameAndKind("",NAMESPACE)); + XMLList* retObj=Class<XMLList>::getInstanceS(ret,this->getChildrenlist(),mname); + return _MNR(retObj); + } + else + { + const XMLVector& ret=getValuesByMultiname(childrenlist,name); + if(ret.empty() && (opt & XML_STRICT)!=0) + return NullRef; + + _R<XMLList> ch =_MNR(Class<XMLList>::getInstanceS(ret,this->getChildrenlist(),name)); + return ch; + } } } @@ -1372,42 +1386,37 @@ if(isAttr) { - bool found = false; - for (XMLList::XMLListVector::iterator it = attributelist->nodes.begin(); it != attributelist->nodes.end(); it++) + tiny_string nodeval; + if(o->is<XMLList>()) + { + _NR<XMLList> x = _NR<XMLList>(o->as<XMLList>()); + for (auto it2 = x->nodes.begin(); it2 != x->nodes.end(); it2++) + { + if (nodeval != "") + nodeval += " "; + nodeval += (*it2)->toString(); + } + } + else + { + nodeval = o->toString(); + } + _NR<XML> a; + XMLList::XMLListVector::iterator it = attributelist->nodes.begin(); + while (it != attributelist->nodes.end()) { _R<XML> attr = *it; - if (attr->nodenamespace_uri == ns_uri && (attr->nodename == buf || (*buf==0))) + XMLList::XMLListVector::iterator ittmp = it; + it++; + if (attr->nodenamespace_uri == ns_uri && (attr->nodename == buf || (*buf=='*')|| (*buf==0))) { - if(o->is<XMLList>()) - { - _NR<XMLList> x = _NR<XMLList>(o->as<XMLList>()); - for (auto it = x->nodes.begin(); it != x->nodes.end(); it++) - { - if (!found) - attr->nodevalue = (*it)->toString(); - else - { - attr->nodevalue += " "; - attr->nodevalue += (*it)->toString(); - } - found = true; - } - } - else - { - if (!found) - attr->nodevalue = o->toString(); - else - { - attr->nodevalue += " "; - attr->nodevalue += o->toString(); - } - found = true; - } - + if (!a.isNull()) + it=attributelist->nodes.erase(ittmp); + a = *ittmp; + a->nodevalue = nodeval; } } - if (!found && !normalizedName.empty()) + if (a.isNull() && !((*buf=='*')|| (*buf==0))) { _NR<XML> tmp = _MR<XML>(Class<XML>::getInstanceS()); this->incRef(); @@ -1416,7 +1425,7 @@ tmp->nodename = buf; tmp->nodenamespace_uri = ns_uri; tmp->nodenamespace_prefix = ns_prefix; - tmp->nodevalue = o->toString(); + tmp->nodevalue = nodeval; tmp->constructed = true; attributelist->nodes.push_back(tmp); } @@ -1444,12 +1453,31 @@ } else if(o->is<XML>()) { - _NR<XML> tmp = _MR<XML>(o->as<XML>()); - tmp->parentNode = _MR<XML>(this); - tmp->incRef(); + if (o->as<XML>()->getNodeKind() == XML_TEXT_NODE) + { + _R<XML> tmp = _MR<XML>(Class<XML>::getInstanceS()); + tmp->parentNode = tmpnode; + tmp->incRef(); + tmp->nodetype = XML_TEXT_NODE; + tmp->nodename = "text"; + tmp->nodenamespace_uri = ""; + tmp->nodenamespace_prefix = ""; + tmp->nodevalue = o->toString(); + tmp->constructed = true; + tmpnode->childrenlist->clear(); + tmpnode->childrenlist->append(tmp); + if (!found) + tmpnodes.push_back(tmpnode); + } + else + { + _NR<XML> tmp = _MR<XML>(o->as<XML>()); + tmp->parentNode = _MR<XML>(this); + tmp->incRef(); + if (!found) + tmpnodes.push_back(tmp); + } - if (!found) - tmpnodes.push_back(tmp); } else { @@ -1545,6 +1573,7 @@ } bool isAttr=name.isAttribute; + unsigned int index=0; const tiny_string normalizedName=name.normalizedName(); const char *buf=normalizedName.raw_buf(); if(!normalizedName.empty() && normalizedName.charAt(0)=='@') @@ -1562,6 +1591,12 @@ return true; } } + else if(XML::isValidMultiname(name,index)) + { + // If the multiname is a valid array property, the XML + // object is treated as a single-item XMLList. + return(index==0); + } else { //Lookup children
View file
lightspark.tar.xz/src/scripting/toplevel/XMLList.cpp
Changed
@@ -93,7 +93,7 @@ void XMLList::sinit(Class_base* c) { - CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED | CLASS_FINAL); + CLASS_SETUP(c, ASObject, _constructor, CLASS_FINAL); c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(_getLength),NORMAL_METHOD,true); c->setDeclaredMethodByQName("attribute",AS3,Class<IFunction>::getFunction(attribute),NORMAL_METHOD,true); c->setDeclaredMethodByQName("attributes",AS3,Class<IFunction>::getFunction(attributes),NORMAL_METHOD,true); @@ -630,10 +630,10 @@ for (uint32_t i = 0; i < nodes.size(); i++) { _R<XML> child= nodes[i]; - bool nameMatches = (normalizedName=="" || normalizedName==child->nodename); + bool nameMatches = (normalizedName=="" || normalizedName==child->nodename || normalizedName=="*"); bool nsMatches = (namespace_uri=="" || (child->nodenamespace_uri == namespace_uri)); - + if(nameMatches && nsMatches) { retnodes.push_back(child); @@ -748,7 +748,7 @@ tmpprop = tmplist->targetproperty; tmplist = tmplist->targetobject; } - if (tmplist && !tmpprop.isEmpty()) + if (tmplist) { tmplist->getTargetVariables(tmpprop,retnodes); } @@ -770,6 +770,8 @@ { if (tmplist) { + if (tmplist->nodes.size() > 1) + throwError<TypeError>(kXMLAssigmentOneItemLists); if (!tmpprop.isEmpty()) { XML* tmp = Class<XML>::getInstanceS(); @@ -810,7 +812,7 @@ } else { - // do nothing, see ECMA-357, Section 9.2.1.2 + throwError<TypeError>(kXMLAssigmentOneItemLists); } } @@ -939,14 +941,19 @@ if (idx >= nodes.size()) return; - if (nodes[idx]->getNodeKind() == XML_ATTRIBUTE_NODE || nodes[idx]->getNodeKind() == XML_TEXT_NODE) + if (nodes[idx]->getNodeKind() == XML_ATTRIBUTE_NODE) { if (targetobject) targetobject->setVariableByMultiname(targetproperty,o,allowConst); nodes[idx]->setTextContent(o->toString()); } - else if (o->is<XMLList>()) + if (o->is<XMLList>()) { + if (o->as<XMLList>()->nodes.size() == 1) + { + replace(idx,o->as<XMLList>()->nodes[0].getPtr(),retnodes,allowConst); + return; + } if (targetobject) { for (uint32_t i = 0; i < targetobject->nodes.size(); i++) @@ -986,8 +993,25 @@ m.ns.push_back(nsNameAndKind("",NAMESPACE)); targetobject->setVariableByMultiname(m,o,allowConst); } - o->incRef(); - nodes[idx] = _MR(o->as<XML>()); + if (o->as<XML>()->getNodeKind() == XML_TEXT_NODE) + { + nodes[idx]->childrenlist->clear(); + _R<XML> tmp = _MR<XML>(Class<XML>::getInstanceS()); + nodes[idx]->incRef(); + tmp->parentNode = nodes[idx]; + tmp->nodetype = XML_TEXT_NODE; + tmp->nodename = "text"; + tmp->nodenamespace_uri = ""; + tmp->nodenamespace_prefix = ""; + tmp->nodevalue = o->toString(); + tmp->constructed = true; + nodes[idx]->childrenlist->append(tmp); + } + else + { + o->incRef(); + nodes[idx] = _MR(o->as<XML>()); + } } else {
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -1638,6 +1638,54 @@ return s + local_name; } +uint32_t ASQName::nextNameIndex(uint32_t cur_index) +{ + assert_and_throw(implEnable); + if(cur_index<2) + return cur_index+1; + else + { + //Fall back on object properties + uint32_t ret=ASObject::nextNameIndex(cur_index-2); + if(ret==0) + return 0; + else + return ret+2; + + } +} + +_R<ASObject> ASQName::nextName(uint32_t index) +{ + assert_and_throw(implEnable); + switch(index) + { + case 1: + return _MR(Class<ASString>::getInstanceS("uri")); + case 2: + return _MR(Class<ASString>::getInstanceS("localName")); + default: + return ASObject::nextName(index-2); + } +} + +_R<ASObject> ASQName::nextValue(uint32_t index) +{ + assert_and_throw(implEnable); + switch(index) + { + case 1: + if (uri_is_null) + return _MR(getSys()->getNullRef()); + else + return _MR(Class<ASString>::getInstanceS(this->uri)); + case 2: + return _MR(Class<ASString>::getInstanceS(this->local_name)); + default: + return ASObject::nextName(index-2); + } +} + Namespace::Namespace(Class_base* c):ASObject(c),nskind(NAMESPACE) { type=T_NAMESPACE; @@ -1911,6 +1959,53 @@ return ASObject::isEqual(o); } +uint32_t Namespace::nextNameIndex(uint32_t cur_index) +{ + assert_and_throw(implEnable); + if(cur_index<2) + return cur_index+1; + else + { + //Fall back on object properties + uint32_t ret=ASObject::nextNameIndex(cur_index-2); + if(ret==0) + return 0; + else + return ret+2; + + } +} + +_R<ASObject> Namespace::nextName(uint32_t index) +{ + assert_and_throw(implEnable); + switch(index) + { + case 1: + return _MR(Class<ASString>::getInstanceS("uri")); + case 2: + return _MR(Class<ASString>::getInstanceS("prefix")); + default: + return ASObject::nextName(index-2); + } +} + +_R<ASObject> Namespace::nextValue(uint32_t index) +{ + assert_and_throw(implEnable); + switch(index) + { + case 1: + return _MR(Class<ASString>::getInstanceS(this->uri)); + case 2: + if(prefix_is_undefined) + return _MR(getSys()->getUndefinedRef()); + else + return _MR(Class<ASString>::getInstanceS(this->prefix)); + default: + return ASObject::nextName(index-2); + } +} ASObject* ASNop(ASObject* obj, ASObject* const* args, const unsigned int argslen) { @@ -2120,6 +2215,8 @@ { tiny_string str; ARG_UNPACK (str, "undefined"); + if (argslen > 0 && args[0]->is<Undefined>()) + return Class<ASString>::getInstanceS("null"); return Class<ASString>::getInstanceS(URLInfo::encode(str, URLInfo::ENCODE_ESCAPE)); } @@ -2127,6 +2224,8 @@ { tiny_string str; ARG_UNPACK (str, "undefined"); + if (argslen > 0 && args[0]->is<Undefined>()) + return Class<ASString>::getInstanceS("null"); return Class<ASString>::getInstanceS(URLInfo::decode(str, URLInfo::ENCODE_ESCAPE)); } @@ -2439,6 +2538,8 @@ Function_object::Function_object(Class_base* c, _R<ASObject> p) : ASObject(c), functionPrototype(p) { + traitsInitialized = true; + constructIndicator = true; } void Function_object::finalize()
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.h
Changed
@@ -452,6 +452,8 @@ SyntheticFunction* sf=dynamic_cast<SyntheticFunction*>(r); if(sf==NULL) return false; + if (closure_this.isNull()) + return this == r; return (mi==sf->mi) && (closure_this==sf->closure_this); } void acquireScope(const std::vector<scope_entry>& scope) @@ -566,7 +568,12 @@ tiny_string getURI() const { return uri; } tiny_string getLocalName() const { return local_name; } bool isEqual(ASObject* o); + tiny_string toString(); + + uint32_t nextNameIndex(uint32_t cur_index); + _R<ASObject> nextName(uint32_t index); + _R<ASObject> nextValue(uint32_t index); }; class Namespace: public ASObject @@ -596,6 +603,10 @@ bool isEqual(ASObject* o); tiny_string getURI() { return uri; } tiny_string getPrefix(bool& is_undefined) { is_undefined=prefix_is_undefined; return prefix; } + + uint32_t nextNameIndex(uint32_t cur_index); + _R<ASObject> nextName(uint32_t index); + _R<ASObject> nextValue(uint32_t index); };
View file
lightspark.tar.xz/src/swftypes.cpp
Changed
@@ -69,7 +69,7 @@ case multiname::NAME_STRING: return getSys()->getStringFromUniqueId(name_s_id); case multiname::NAME_OBJECT: - return name_o->toString(); + return name_o ? name_o->toString() : "*"; default: assert("Unexpected name kind" && false); //Should never reach this
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.