Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 68
View file
lightspark.spec
Changed
@@ -24,7 +24,7 @@ %endif Name: lightspark -Version: 0.7.2.99+git20150510.1846 +Version: 0.7.2.99+git20150603.1702 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/conf/FindLLVM.cmake
Changed
@@ -54,6 +54,9 @@ /usr/lib/llvm-3.1/bin /usr/lib/llvm-3.2/bin /usr/lib/llvm-3.3/bin + /usr/lib/llvm-3.4/bin + /usr/lib/llvm-3.5/bin + /usr/lib/llvm-3.6/bin ) find_program(LLVM_GCC_EXECUTABLE
View file
lightspark.tar.xz/src/asobject.cpp
Changed
@@ -92,6 +92,17 @@ name.ns.push_back(this->proxyMultiName->ns[i]); } } + +void ASObject::dumpVariables() +{ + LOG(LOG_INFO,"variables:"); + Variables.dumpVariables(); + if (this->is<Class_base>()) + { + LOG(LOG_INFO,"borrowed variables:"); + this->as<Class_base>()->borrowedVariables.dumpVariables(); + } +} tiny_string ASObject::toString() { check(); @@ -651,6 +662,9 @@ // Properties can not be added to a sealed class if (cls && cls->isSealed) { + const Type* type = Type::getTypeFromMultiname(&name,getVm()->currentCallContext->context); + if (type) + throwError<ReferenceError>(kConstWriteError, name.normalizedName(), cls ? cls->getQualifiedClassName() : ""); throwError<ReferenceError>(kWriteSealedError, name.normalizedName(), cls->getQualifiedClassName()); } @@ -706,7 +720,7 @@ if(obj) { //Initializing an already existing variable - LOG(LOG_NOT_IMPLEMENTED,"Variable " << name << " already initialized"); + LOG(LOG_NOT_IMPLEMENTED,"Variable " << name << " already initialized, type:"<<*typemname); if (o != NULL) o->decRef(); return; @@ -904,7 +918,7 @@ if (type == Type::anyType) { // type could not be found, so it's stored as an uninitialized variable - LOG(LOG_CALLS,"add uninitialized var:"<<mname); + LOG(LOG_CALLS,"add uninitialized var:"<<mname<<" "<<*typemname); uninitializedVar v; mainObj->incRef(); v.mainObj = mainObj; @@ -935,7 +949,7 @@ v.traitKind = traitKind; v.typemname = typemname; context->addUninitializedVar(v); - obj = getSys()->getUndefinedRef(); + obj = getSys()->getNullRef(); obj = type->coerce(obj); } else @@ -990,12 +1004,22 @@ ASFUNCTIONBODY(ASObject,_toLocaleString) { - if (!obj->has_toString()) - throwError<TypeError>(kCallNotFoundError, "toString", obj->getClassName()); - - _R<ASObject> res = obj->call_toString(); - res->incRef(); - return res.getPtr(); + multiname toStringName(NULL); + toStringName.name_type=multiname::NAME_STRING; + toStringName.name_s_id=getSys()->getUniqueStringId("toString"); + toStringName.ns.push_back(nsNameAndKind("",NAMESPACE)); + toStringName.isAttribute = false; + if (obj->hasPropertyByMultiname(toStringName, true, false)) + { + _NR<ASObject> o=obj->getVariableByMultiname(toStringName,SKIP_IMPL); + assert_and_throw(o->is<IFunction>()); + IFunction* f=o->as<IFunction>(); + + obj->incRef(); + ASObject *ret=f->call(obj,NULL,0); + return ret; + } + return _toString(obj,args,argslen); } ASFUNCTIONBODY(ASObject,hasOwnProperty) @@ -1055,6 +1079,9 @@ return abstract_b(index < (unsigned int)a->size()); } } + variable* v = obj->Variables.findObjVar(name, NO_CREATE_TRAIT,DYNAMIC_TRAIT); + if (v) + return abstract_b(v->isenumerable); if (obj->hasPropertyByMultiname(name,true,false)) return abstract_b(true); return abstract_b(false); @@ -1069,10 +1096,14 @@ name.name_s_id=getSys()->getUniqueStringId(args[0]->toString()); name.ns.push_back(nsNameAndKind("",NAMESPACE)); name.isAttribute=false; - variable* v =obj->Variables.findObjVar(name, NO_CREATE_TRAIT,DYNAMIC_TRAIT); + obj->setIsEnumerable(name, isEnum); + return NULL; +} +void ASObject::setIsEnumerable(const multiname &name, bool isEnum) +{ + variable* v = Variables.findObjVar(name, NO_CREATE_TRAIT,DYNAMIC_TRAIT); if (v) v->isenumerable = isEnum; - return NULL; } ASFUNCTIONBODY(ASObject,_constructor) @@ -1158,15 +1189,12 @@ if(!obj) return NullRef; if (this->is<Class_base>() && - (!obj->var || - (obj->var->getObjectType() != T_UNDEFINED && - obj->var->getObjectType() != T_NULL && - obj->var->getObjectType() != T_FUNCTION ))) + (!obj->var || !obj->var->isConstructed() || + obj->var->getObjectType() == T_UNDEFINED || + obj->var->getObjectType() == T_NULL)) { LOG(LOG_CALLS,"accessing class:"<<name<<" "<< this->as<Class_base>()->getQualifiedClassName()<<" "<<nskind); if (obj->kind == INSTANCE_TRAIT && - nskind != NAMESPACE && - nskind != PACKAGE_INTERNAL_NAMESPACE && nskind != STATIC_PROTECTED_NAMESPACE) throwError<TypeError>(kCallOfNonFunctionError,name.normalizedName()); } @@ -1177,11 +1205,11 @@ ASObject* target=this; if(target->classdef) { - LOG(LOG_CALLS,_("Calling the getter on type ") << target->classdef->class_name); + LOG(LOG_CALLS,_("Calling the getter on type ") << target->classdef->class_name<< " for "<<name); } else { - LOG(LOG_CALLS,_("Calling the getter")); + LOG(LOG_CALLS,_("Calling the getter")<< " for "<<name); } IFunction* getter=obj->getter; target->incRef(); @@ -1289,9 +1317,11 @@ switch(it->second.kind) { case DECLARED_TRAIT: - case CONSTANT_TRAIT: kind="Declared: "; break; + case CONSTANT_TRAIT: + kind="Constant: "; + break; case INSTANCE_TRAIT: kind="Declared (instance)"; break;
View file
lightspark.tar.xz/src/asobject.h
Changed
@@ -496,9 +496,11 @@ /* applies proxy namespace settings to name for internal usage */ void applyProxyProperty(multiname &name); - void dumpVariables() { Variables.dumpVariables(); } + void dumpVariables(); void setConstructIndicator() { constructIndicator = true; } + + void setIsEnumerable(const multiname& name, bool isEnum); }; class Number;
View file
lightspark.tar.xz/src/scripting/abc.cpp
Changed
@@ -1402,6 +1402,29 @@ while(stack_index > 0) stack[--stack_index]->decRef(); } +void call_context::runtime_stack_push(ASObject* s) +{ + if(stack_index>=max_stack) + throwError<ASError>(kStackOverflowError); + stack[stack_index++]=s; +} +ASObject* call_context::runtime_stack_pop() +{ + if(stack_index==0) + throwError<ASError>(kStackUnderflowError); + + ASObject* ret=stack[--stack_index]; + return ret; +} +ASObject* call_context::runtime_stack_peek() +{ + if(stack_index==0) + { + LOG(LOG_ERROR,_("Empty stack")); + return NULL; + } + return stack[stack_index-1]; +} call_context::~call_context() {
View file
lightspark.tar.xz/src/scripting/abc.h
Changed
@@ -390,7 +390,7 @@ static number_t subtract_io(int32_t, ASObject*); static number_t subtract_do(number_t, ASObject*); static void popScope(call_context* th); - static ASObject* newActivation(call_context* th, method_info*); + static ASObject* newActivation(call_context* th, method_info* mi, ASObject* caller); static ASObject* coerce_s(ASObject*); static ASObject* checkfilter(ASObject*); static void coerce_a(); @@ -482,8 +482,8 @@ void start() DLL_PUBLIC; void finalize(); static void Run(ABCVm* th); - static ASObject* executeFunction(const SyntheticFunction* function, call_context* context); - static ASObject* executeFunctionFast(const SyntheticFunction* function, call_context* context); + static ASObject* executeFunction(const SyntheticFunction* function, call_context* context, ASObject *caller); + static ASObject* executeFunctionFast(const SyntheticFunction* function, call_context* context, ASObject *caller); static void optimizeFunction(SyntheticFunction* function); static void verifyBranch(std::set<uint32_t>& pendingBlock,std::map<uint32_t,BasicBlock>& basicBlocks, int oldStart, int here, int offset, int code_len);
View file
lightspark.tar.xz/src/scripting/abc_codesynt.cpp
Changed
@@ -313,9 +313,10 @@ struct_elems.push_back(int_type); context_type=llvm::PointerType::getUnqual(llvm::StructType::get(llvm_context(),LLVMMAKEARRAYREF(struct_elems),true)); - //newActivation needs both method_info and the context + //newActivation needs method_info, context and caller sig.push_back(context_type); sig.push_back(voidptr_type); + sig.push_back(voidptr_type); FT=llvm::FunctionType::get(voidptr_type, LLVMMAKEARRAYREF(sig), false); llvm::Function* F=llvm::Function::Create(FT,llvm::Function::ExternalLinkage,"newActivation",module); ex->addGlobalMapping(F,(void*)&ABCVm::newActivation);
View file
lightspark.tar.xz/src/scripting/abc_fast_interpreter.cpp
Changed
@@ -40,7 +40,7 @@ }; }; -ASObject* ABCVm::executeFunctionFast(const SyntheticFunction* function, call_context* context) +ASObject* ABCVm::executeFunctionFast(const SyntheticFunction* function, call_context* context, ASObject *caller) { method_info* mi=function->mi; @@ -750,7 +750,7 @@ case 0x57: { //newactivation - context->runtime_stack_push(newActivation(context, mi)); + context->runtime_stack_push(newActivation(context, mi,caller)); break; } case 0x58: @@ -841,9 +841,12 @@ LOG(LOG_CALLS, _("setLocal ") << i ); ASObject* obj=context->runtime_stack_pop(); assert_and_throw(obj); - if(context->locals[i]) - context->locals[i]->decRef(); - context->locals[i]=obj; + if ((int)i != context->argarrayposition) + { + if(context->locals[i]) + context->locals[i]->decRef(); + context->locals[i]=obj; + } break; } case 0x64: @@ -993,9 +996,15 @@ //convert_o ASObject* val=context->runtime_stack_pop(); if (val->is<Null>()) + { + LOG(LOG_ERROR,"trying to call convert_o on null"); throwError<TypeError>(kConvertNullToObjectError); + } if (val->is<Undefined>()) + { + LOG(LOG_ERROR,"trying to call convert_o on undefined"); throwError<TypeError>(kConvertUndefinedToObjectError); + } context->runtime_stack_push(val); break; @@ -1436,9 +1445,12 @@ int i=opcode&3; LOG(LOG_CALLS, "setLocal " << i ); ASObject* obj=context->runtime_stack_pop(); - if(context->locals[i]) - context->locals[i]->decRef(); - context->locals[i]=obj; + if ((int)i != context->argarrayposition) + { + if(context->locals[i]) + context->locals[i]->decRef(); + context->locals[i]=obj; + } break; } case 0xf2:
View file
lightspark.tar.xz/src/scripting/abc_interpreter.cpp
Changed
@@ -36,7 +36,7 @@ return ret; } -ASObject* ABCVm::executeFunction(const SyntheticFunction* function, call_context* context) +ASObject* ABCVm::executeFunction(const SyntheticFunction* function, call_context* context, ASObject* caller) { method_info* mi=function->mi; @@ -868,7 +868,7 @@ case 0x57: { //newactivation - context->runtime_stack_push(newActivation(context, mi)); + context->runtime_stack_push(newActivation(context, mi,caller)); break; } case 0x58: @@ -962,9 +962,12 @@ LOG(LOG_CALLS, _("setLocal ") << i ); ASObject* obj=context->runtime_stack_pop(); assert_and_throw(obj); - if(context->locals[i]) - context->locals[i]->decRef(); - context->locals[i]=obj; + if ((int)i != context->argarrayposition) + { + if(context->locals[i]) + context->locals[i]->decRef(); + context->locals[i]=obj; + } break; } case 0x64: @@ -1114,9 +1117,15 @@ //convert_o ASObject* val=context->runtime_stack_pop(); if (val->is<Null>()) + { + LOG(LOG_ERROR,"trying to call convert_o on null"); throwError<TypeError>(kConvertNullToObjectError); + } if (val->is<Undefined>()) + { + LOG(LOG_ERROR,"trying to call convert_o on undefined"); throwError<TypeError>(kConvertUndefinedToObjectError); + } context->runtime_stack_push(val); break; @@ -1543,11 +1552,14 @@ { //setlocal_n int i=opcode&3; - LOG(LOG_CALLS, _("setLocal ") << i ); + LOG(LOG_CALLS, _("setLocal ") << i); ASObject* obj=context->runtime_stack_pop(); - if(context->locals[i]) - context->locals[i]->decRef(); - context->locals[i]=obj; + if ((int)i != context->argarrayposition) + { + if(context->locals[i]) + context->locals[i]->decRef(); + context->locals[i]=obj; + } break; } case 0xef:
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -53,8 +53,18 @@ void ABCVm::setProperty(ASObject* value,ASObject* obj,multiname* name) { - LOG(LOG_CALLS,_("setProperty ") << *name << ' ' << obj->toDebugString()<<" " << value->toString()); + LOG(LOG_CALLS,_("setProperty ") << *name << ' ' << obj<<" "<<obj->toDebugString()<<" " << value->toString()<<" "<<value); + if(obj->is<Null>()) + { + LOG(LOG_ERROR,"calling setProperty on null:" << *name << ' ' << obj->toDebugString()<<" " << value->toString()); + throwError<TypeError>(kConvertNullToObjectError); + } + if (obj->is<Undefined>()) + { + LOG(LOG_ERROR,"calling setProperty on undefined:" << *name << ' ' << obj->toDebugString()<<" " << value->toString()); + throwError<TypeError>(kConvertUndefinedToObjectError); + } //Do not allow to set contant traits obj->setVariableByMultiname(*name,value,ASObject::CONST_NOT_ALLOWED); obj->decRef(); @@ -63,7 +73,16 @@ void ABCVm::setProperty_i(int32_t value,ASObject* obj,multiname* name) { LOG(LOG_CALLS,_("setProperty_i ") << *name << ' ' <<obj); - + if(obj->is<Null>()) + { + LOG(LOG_ERROR,"calling setProperty_i on null:" << *name << ' ' << obj->toDebugString()<<" " << value); + throwError<TypeError>(kConvertNullToObjectError); + } + if (obj->is<Undefined>()) + { + LOG(LOG_ERROR,"calling setProperty_i on undefined:" << *name << ' ' << obj->toDebugString()<<" " << value); + throwError<TypeError>(kConvertUndefinedToObjectError); + } obj->setVariableByMultiname_i(*name,value); obj->decRef(); } @@ -207,7 +226,7 @@ void ABCVm::setSlot(ASObject* value, ASObject* obj, int n) { - LOG(LOG_CALLS,"setSlot " << n); + LOG(LOG_CALLS,"setSlot " << n << " "<< obj<<" " <<obj->toDebugString() << " "<< value->toDebugString()<<" "<<value); obj->setSlot(n,value); obj->decRef(); } @@ -290,9 +309,15 @@ checkDeclaredTraits(obj); if(obj->is<Null>()) + { + LOG(LOG_ERROR,"trying to call property on null:"<<*name); throwError<TypeError>(kConvertNullToObjectError); + } if (obj->is<Undefined>()) + { + LOG(LOG_ERROR,"trying to call property on undefined:"<<*name); throwError<TypeError>(kConvertUndefinedToObjectError); + } //We should skip the special implementation of get _NR<ASObject> o=obj->getVariableByMultiname(*name, ASObject::SKIP_IMPL); @@ -635,7 +660,7 @@ if (f->is<SyntheticFunction>()) { SyntheticFunction* sf=f->as<SyntheticFunction>(); - if (sf->mi->body) + if (sf->mi->body && !sf->mi->needsActivation()) { LOG(LOG_CALLS,_("Building method traits")); for(unsigned int i=0;i<sf->mi->body->trait_count;i++) @@ -1204,8 +1229,7 @@ ASObject* ABCVm::pushNaN() { LOG(LOG_CALLS, _("pushNaN") ); - //Not completely correct, but mostly ok - return getSys()->getUndefinedRef(); + return abstract_d(Number::NaN); } bool ABCVm::ifGT(ASObject* obj2, ASObject* obj1) @@ -1454,7 +1478,7 @@ else { LOG(LOG_NOT_IMPLEMENTED,"findPropStrict: " << *name << " not found"); - throwError<ReferenceError>(kUndefinedVarError); + throwError<ReferenceError>(kUndefinedVarError,name->normalizedName()); return getSys()->getUndefinedRef(); } } @@ -1518,9 +1542,15 @@ ASObject* obj=th->runtime_stack_pop(); if(obj->is<Null>()) + { + LOG(LOG_ERROR,"trying to call super on null:"<<*name); throwError<TypeError>(kConvertNullToObjectError); + } if (obj->is<Undefined>()) + { + LOG(LOG_ERROR,"trying to call super on undefined:"<<*name); throwError<TypeError>(kConvertUndefinedToObjectError); + } assert_and_throw(th->inClass); assert_and_throw(th->inClass->super); @@ -1570,10 +1600,12 @@ case T_STRING: obj->decRef(); type->decRef(); + LOG(LOG_ERROR,"trying to call isTypelate on null:"<<obj->toDebugString()); throwError<TypeError>(kConvertNullToObjectError); case T_UNDEFINED: obj->decRef(); type->decRef(); + LOG(LOG_ERROR,"trying to call isTypelate on undefined:"<<obj->toDebugString()); throwError<TypeError>(kConvertUndefinedToObjectError); case T_CLASS: break; @@ -1640,18 +1672,11 @@ { LOG(LOG_CALLS,_("asTypelate")); - //HACK: until we have implemented all flash classes - if(type->is<Undefined>()) - { - LOG(LOG_NOT_IMPLEMENTED,"asTypelate with undefined"); - type->decRef(); - return obj; - } - if(!type->is<Class_base>()) { obj->decRef(); type->decRef(); + LOG(LOG_ERROR,"trying to call asTypelate on non class object:"<<obj->toDebugString()); throwError<TypeError>(kConvertNullToObjectError); } Class_base* c=static_cast<Class_base*>(type); @@ -2083,6 +2108,17 @@ Class_base* base = baseClass->as<Class_base>(); assert(!base->isFinal); ret->setSuper(_MR(base)); + i = th->context->root->applicationDomain->classesBeingDefined.cbegin(); + while (i != th->context->root->applicationDomain->classesBeingDefined.cend()) + { + if(i->second == base) + { + th->context->root->applicationDomain->classesSuperNotFilled.push_back(ret); + break; + } + i++; + } + } //Add protected namespace if needed @@ -2107,8 +2143,8 @@ instance_info* cur=&th->context->instances[n]; for(unsigned int i=0;i<cur->trait_count;i++) { - int kind=cur->traits[i].kind&0xf; - if(kind==traits_info::Method || kind==traits_info::Setter || kind==traits_info::Getter) + //int kind=cur->traits[i].kind&0xf; + //if(kind==traits_info::Method || kind==traits_info::Setter || kind==traits_info::Getter) th->context->buildTrait(ret,&cur->traits[i],true); } @@ -2206,6 +2242,17 @@ th->runtime_stack_push(ret); cinit->decRef(); + auto j = th->context->root->applicationDomain->classesSuperNotFilled.cbegin(); + while (j != th->context->root->applicationDomain->classesSuperNotFilled.cend()) + { + if((*j)->super == ret) + { + (*j)->copyBorrowedTraitsFromSuper(); + th->context->root->applicationDomain->classesSuperNotFilled.remove(ret); + break; + } + j++; + } //Remove the class to the ones being currently defined in this context th->context->root->applicationDomain->classesBeingDefined.erase(mname); } @@ -2215,17 +2262,24 @@ LOG(LOG_CALLS,_("swap")); } -ASObject* ABCVm::newActivation(call_context* th,method_info* info) +ASObject* ABCVm::newActivation(call_context* th, method_info* mi, ASObject* caller) { LOG(LOG_CALLS,"newActivation"); //TODO: Should create a real activation object //TODO: Should method traits be added to the activation context? - ASObject* act=Class<ASObject>::getInstanceS(); + ASObject* act= NULL; + if (caller != NULL && caller->is<Function_object>())
View file
lightspark.tar.xz/src/scripting/abcutils.h
Changed
@@ -53,6 +53,7 @@ ABCContext* context; uint32_t locals_size; uint32_t max_stack; + int32_t argarrayposition; // position of argument array in locals ( -1 if no argument array needed) std::vector<scope_entry> scope_stack; method_info* mi; /* This is the function's inClass that is currently executing. It is used @@ -66,30 +67,10 @@ int initialScopeStack; ~call_context(); void runtime_stack_clear(); - void runtime_stack_push(ASObject* s) - { - if(stack_index>=max_stack) - throw RunTimeException("Stack overflow"); - stack[stack_index++]=s; - } - ASObject* runtime_stack_pop() - { - if(stack_index==0) - throw RunTimeException("Empty stack"); - - ASObject* ret=stack[--stack_index]; - return ret; - } - ASObject* runtime_stack_peek() - { - if(stack_index==0) - { - LOG(LOG_ERROR,_("Empty stack")); - return NULL; - } - return stack[stack_index-1]; - } + void runtime_stack_push(ASObject* s); + ASObject* runtime_stack_pop(); + ASObject* runtime_stack_peek(); }; -}; +} #endif /* SCRIPTING_ABCUTILS_H */
View file
lightspark.tar.xz/src/scripting/flash/net/flashnet.cpp
Changed
@@ -596,6 +596,7 @@ c->setVariableByQName("PENDING","",Class<ASString>::getInstanceS("pending"),DECLARED_TRAIT); } +std::map<tiny_string, SharedObject* > SharedObject::sharedobjectmap; SharedObject::SharedObject(Class_base* c):EventDispatcher(c) { data=_MR(new_asobject()); @@ -603,10 +604,9 @@ void SharedObject::sinit(Class_base* c) { - // TODO: Use _constructorNotInstantiatable after getLocal is - // implemented CLASS_SETUP_NO_CONSTRUCTOR(c, EventDispatcher, CLASS_SEALED); c->setDeclaredMethodByQName("getLocal","",Class<IFunction>::getFunction(getLocal),NORMAL_METHOD,false); + c->setDeclaredMethodByQName("flush","",Class<IFunction>::getFunction(flush),NORMAL_METHOD,true); REGISTER_GETTER(c,data); } @@ -614,8 +614,30 @@ ASFUNCTIONBODY(SharedObject,getLocal) { - //TODO: Implement this - return Class<SharedObject>::getInstanceS(); + tiny_string name; + tiny_string localPath; + bool secure; + ARG_UNPACK(name) (localPath,"") (secure,false); + + if (name=="") + throwError<ASError>(0,"invalid name"); + if (localPath != "" || secure) + LOG(LOG_NOT_IMPLEMENTED,"SharedObject.getLocal: parameters 'localPath' and 'secure' are ignored"); + + + std::map<tiny_string, SharedObject* >::iterator it = sharedobjectmap.find(name); + if (it == sharedobjectmap.end()) + { + sharedobjectmap.insert(make_pair(name,Class<SharedObject>::getInstanceS())); + it = sharedobjectmap.find(name); + } + it->second->incRef(); + return it->second; +} +ASFUNCTIONBODY(SharedObject,flush) +{ + LOG(LOG_NOT_IMPLEMENTED,"SharedObject.flush not implemented"); + return NULL; } void ObjectEncoding::sinit(Class_base* c) @@ -624,7 +646,7 @@ c->setVariableByQName("AMF0","",abstract_i(AMF0),DECLARED_TRAIT); c->setVariableByQName("AMF3","",abstract_i(AMF3),DECLARED_TRAIT); c->setVariableByQName("DEFAULT","",abstract_i(DEFAULT),DECLARED_TRAIT); -}; +} NetConnection::NetConnection(Class_base* c): EventDispatcher(c),_connected(false),downloader(NULL),messageCount(0), @@ -647,7 +669,7 @@ c->setDeclaredMethodByQName("proxyType","",Class<IFunction>::getFunction(_getProxyType),GETTER_METHOD,true); c->setDeclaredMethodByQName("proxyType","",Class<IFunction>::getFunction(_setProxyType),SETTER_METHOD,true); c->setDeclaredMethodByQName("uri","",Class<IFunction>::getFunction(_getURI),GETTER_METHOD,true); - c->setDeclaredMethodByQName("close","",Class<IFunction>::getFunction(close),GETTER_METHOD,true); + c->setDeclaredMethodByQName("close","",Class<IFunction>::getFunction(close),NORMAL_METHOD,true); REGISTER_GETTER_SETTER(c,client); } @@ -1993,6 +2015,7 @@ CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); c->setDeclaredMethodByQName("allowDomain","",Class<IFunction>::getFunction(allowDomain),NORMAL_METHOD,true); c->setDeclaredMethodByQName("allowInsecureDomain","",Class<IFunction>::getFunction(allowInsecureDomain),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("send","",Class<IFunction>::getFunction(send),NORMAL_METHOD,true); REGISTER_GETTER(c,isSupported); } ASFUNCTIONBODY_GETTER(LocalConnection, isSupported); @@ -2012,11 +2035,16 @@ } ASFUNCTIONBODY(LocalConnection, allowInsecureDomain) { - EventDispatcher::_constructor(obj, NULL, 0); LocalConnection* th=Class<LocalConnection>::cast(obj); LOG(LOG_NOT_IMPLEMENTED,"LocalConnection::allowInsecureDomain is not implemented"); return NULL; } +ASFUNCTIONBODY(LocalConnection, send) +{ + LocalConnection* th=Class<LocalConnection>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"LocalConnection::send is not implemented"); + return NULL; +} NetGroup::NetGroup(Class_base* c): EventDispatcher(c)
View file
lightspark.tar.xz/src/scripting/flash/net/flashnet.h
Changed
@@ -104,10 +104,13 @@ class SharedObject: public EventDispatcher { +private: + static std::map<tiny_string, SharedObject* > sharedobjectmap; public: SharedObject(Class_base* c); static void sinit(Class_base*); ASFUNCTION(getLocal); + ASFUNCTION(flush); ASPROPERTY_GETTER(_NR<ASObject>,data); }; @@ -371,6 +374,7 @@ ASPROPERTY_GETTER(bool,isSupported); ASFUNCTION(allowDomain); ASFUNCTION(allowInsecureDomain); + ASFUNCTION(send); }; class NetGroup: public EventDispatcher
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.cpp
Changed
@@ -57,6 +57,7 @@ c->setDeclaredMethodByQName("screenResolutionX","",Class<IFunction>::getFunction(_getScreenResolutionX),GETTER_METHOD,false); c->setDeclaredMethodByQName("screenResolutionY","",Class<IFunction>::getFunction(_getScreenResolutionY),GETTER_METHOD,false); c->setDeclaredMethodByQName("hasAccessibility","",Class<IFunction>::getFunction(_getHasAccessibility),GETTER_METHOD,false); + c->setDeclaredMethodByQName("screenDPI","",Class<IFunction>::getFunction(_getScreenDPI),GETTER_METHOD,false); } @@ -176,6 +177,12 @@ LOG(LOG_NOT_IMPLEMENTED,"hasAccessibility always returns false"); return abstract_b(false); } +ASFUNCTIONBODY(Capabilities,_getScreenDPI) +{ + GdkScreen* screen = gdk_screen_get_default(); + gdouble dpi = gdk_screen_get_resolution (screen); + return abstract_d(dpi); +} #define MIN_DOMAIN_MEMORY_LIMIT 1024 ApplicationDomain::ApplicationDomain(Class_base* c, _NR<ApplicationDomain> p):ASObject(c),domainMemory(Class<ByteArray>::getInstanceS()),parentDomain(p) @@ -586,7 +593,7 @@ ASFUNCTIONBODY(ASWorker,_getCurrent) { LOG(LOG_NOT_IMPLEMENTED, "Worker not implemented"); - return getSys()->getUndefinedRef(); + return Class<ASObject>::getInstanceS(); }
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.h
Changed
@@ -36,7 +36,7 @@ public: DLL_PUBLIC static const char* EMULATED_VERSION; static const char* MANUFACTURER; - Capabilities(Class_base* c):ASObject(c){}; + Capabilities(Class_base* c):ASObject(c){} static void sinit(Class_base* c); ASFUNCTION(_getLanguage); ASFUNCTION(_getPlayerType); @@ -51,6 +51,7 @@ ASFUNCTION(_getScreenResolutionX); ASFUNCTION(_getScreenResolutionY); ASFUNCTION(_getHasAccessibility); + ASFUNCTION(_getScreenDPI); }; class ApplicationDomain: public ASObject @@ -61,6 +62,9 @@ ApplicationDomain(Class_base* c, _NR<ApplicationDomain> p=NullRef); void finalize(); std::map<const multiname*, Class_base*> classesBeingDefined; + + // list of classes where super class is not defined yet + std::list<Class_base*> classesSuperNotFilled; static void sinit(Class_base* c); static void buildTraits(ASObject* o);
View file
lightspark.tar.xz/src/scripting/toplevel/Date.cpp
Changed
@@ -158,6 +158,7 @@ c->prototype->setVariableByQName("toTimeString","",Class<IFunction>::getFunction(toTimeString),DYNAMIC_TRAIT); c->prototype->setVariableByQName("toLocaleTimeString","",Class<IFunction>::getFunction(toLocaleTimeString),DYNAMIC_TRAIT); c->prototype->setVariableByQName("toLocaleDateString","",Class<IFunction>::getFunction(toLocaleDateString),DYNAMIC_TRAIT); + c->prototype->setVariableByQName("toLocaleString","",Class<IFunction>::getFunction(toLocaleString),DYNAMIC_TRAIT); } void Date::buildTraits(ASObject* o)
View file
lightspark.tar.xz/src/scripting/toplevel/XML.cpp
Changed
@@ -2298,6 +2298,8 @@ bool XML::isEqual(ASObject* r) { + if (!isConstructed()) + return !r->isConstructed() || r->getObjectType() == T_NULL || r->getObjectType() == T_UNDEFINED; XML *x=dynamic_cast<XML *>(r); if(x) return nodesEqual(this, x);
View file
lightspark.tar.xz/src/scripting/toplevel/XMLList.cpp
Changed
@@ -1085,6 +1085,9 @@ bool XMLList::isEqual(ASObject* r) { + if (!isConstructed()) + return !r->isConstructed() || r->getObjectType() == T_NULL || r->getObjectType() == T_UNDEFINED; + if(nodes.size()==0 && r->getObjectType()==T_UNDEFINED) return true;
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -116,6 +116,7 @@ void Undefined::setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst) { + LOG(LOG_ERROR,"trying to set variable on undefined:"<<name <<" "<<o->toDebugString()); throwError<TypeError>(kConvertUndefinedToObjectError); } @@ -412,9 +413,14 @@ cc.locals[i+1]=getSys()->getUndefinedRef(); } } - - assert_and_throw(mi->needsArgs()==false || mi->needsRest()==false); - if(mi->needsRest()) //TODO + cc.argarrayposition = -1; + if(mi->needsArgs()) + { + assert_and_throw(cc.locals_size>args_len+1); + cc.locals[args_len+1]=argumentsArray; + cc.argarrayposition=args_len+1; + } + else if(mi->needsRest()|| passedToRest > 0) // it seems that Adobe allows additional parameters without setting "needsRest" { assert_and_throw(argumentsArray==NULL); Array* rest=Class<Array>::getInstanceS(); @@ -425,11 +431,7 @@ assert_and_throw(cc.locals_size>args_len+1); cc.locals[args_len+1]=rest; - } - else if(mi->needsArgs()) - { - assert_and_throw(cc.locals_size>args_len+1); - cc.locals[args_len+1]=argumentsArray; + cc.argarrayposition= args_len+1; } //Parameters are ready @@ -448,7 +450,7 @@ if(codeStatus == method_body_info::OPTIMIZED && getSys()->useFastInterpreter) { //This is a mildy hot function, execute it using the fast interpreter - ret=ABCVm::executeFunctionFast(this,&cc); + ret=ABCVm::executeFunctionFast(this,&cc,obj); } else { @@ -456,7 +458,7 @@ const method_body_info::CODE_STATUS oldCodeStatus = codeStatus; mi->body->codeStatus = method_body_info::USED; //This is not a hot function, execute it using the interpreter - ret=ABCVm::executeFunction(this,&cc); + ret=ABCVm::executeFunction(this,&cc,obj); //Restore the previous codeStatus mi->body->codeStatus = oldCodeStatus; } @@ -632,12 +634,14 @@ int32_t Null::getVariableByMultiname_i(const multiname& name) { + LOG(LOG_ERROR,"trying to get variable on null:"<<name); throwError<TypeError>(kConvertNullToObjectError); return 0; } _NR<ASObject> Null::getVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt) { + LOG(LOG_ERROR,"trying to get variable on null:"<<name); throwError<TypeError>(kConvertNullToObjectError); return NullRef; } @@ -657,6 +661,7 @@ void Null::setVariableByMultiname(const multiname& name, ASObject* o, CONST_ALLOWED_FLAG allowConst) { o->decRef(); + LOG(LOG_ERROR,"trying to set variable on null:"<<name<<" value:"<<o->toDebugString()); throwError<TypeError>(kConvertNullToObjectError); } @@ -766,7 +771,7 @@ */ void Class_base::copyBorrowedTraitsFromSuper() { - assert(borrowedVariables.Variables.empty()); + //assert(borrowedVariables.Variables.empty()); variables_map::var_iterator i = super->borrowedVariables.Variables.begin(); for(;i != super->borrowedVariables.Variables.end(); ++i) { @@ -823,6 +828,13 @@ return o; } +void Class_base::setSuper(Ref<Class_base> super_) +{ + assert(!super); + super = super_; + copyBorrowedTraitsFromSuper(); +} + ASFUNCTIONBODY(Class_base,_toString) { Class_base* th = obj->as<Class_base>();
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.h
Changed
@@ -219,12 +219,7 @@ */ virtual ASObject* coerce(ASObject* o) const; - void setSuper(_R<Class_base> super_) - { - assert(!super); - super = super_; - copyBorrowedTraitsFromSuper(); - } + void setSuper(_R<Class_base> super_); const variable* findBorrowedGettable(const multiname& name, NS_KIND &nskind) const DLL_LOCAL; variable* findBorrowedSettable(const multiname& name, bool* has_getter=NULL) DLL_LOCAL; variable* findSettableInPrototype(const multiname& name) DLL_LOCAL;
View file
lightspark.tar.xz/src/tiny_string.cpp
Changed
@@ -508,7 +508,6 @@ uint32_t len = 0; for (CharIterator it=begin(); it!=end(); it++) { - assert(pend-p >= 6); gunichar c = g_unichar_tolower(*it); gint n = g_unichar_to_utf8(c, p); p += n; @@ -530,7 +529,6 @@ uint32_t len = 0; for (CharIterator it=begin(); it!=end(); it++) { - assert(pend-p >= 6); gunichar c = g_unichar_toupper(*it); gint n = g_unichar_to_utf8(c, p); p += n;
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
.