Projects
Essentials
lightspark
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 71
View file
lightspark.spec
Changed
@@ -24,7 +24,7 @@ %endif Name: lightspark -Version: 0.7.2.99+git20150607.1836 +Version: 0.7.2.99+git20150614.1817 Release: 0 Summary: Modern, free, open-source flash player implementation License: LGPL-3.0+
View file
lightspark.tar.xz/src/asobject.cpp
Changed
@@ -343,7 +343,7 @@ _NR<ASObject> o=getVariableByMultiname(valueOfName,SKIP_IMPL); if (!o->is<IFunction>()) - throwError<TypeError>(kCallOfNonFunctionError, valueOfName.normalizedName()); + throwError<TypeError>(kCallOfNonFunctionError, valueOfName.normalizedNameUnresolved()); IFunction* f=o->as<IFunction>(); incRef(); @@ -623,7 +623,7 @@ if (obj && (obj->kind == CONSTANT_TRAIT && allowConst==CONST_NOT_ALLOWED)) { - throwError<ReferenceError>(kConstWriteError, name.normalizedName(), classdef->as<Class_base>()->getQualifiedClassName()); + throwError<ReferenceError>(kConstWriteError, name.normalizedNameUnresolved(), classdef->as<Class_base>()->getQualifiedClassName()); } if(!obj && cls) { @@ -634,7 +634,7 @@ obj=cls->findBorrowedSettable(name,&has_getter); if(obj && (cls->isFinal || cls->isSealed) && !obj->setter) { - throwError<ReferenceError>(kCannotAssignToMethodError, name.normalizedName(), cls ? cls->getQualifiedClassName() : ""); + throwError<ReferenceError>(kCannotAssignToMethodError, name.normalizedNameUnresolved(), cls ? cls->getQualifiedClassName() : ""); } } @@ -649,7 +649,7 @@ ((protoObj->var && protoObj->var->is<Function>()) || protoObj->setter)) { - throwError<ReferenceError>(kCannotAssignToMethodError, name.normalizedName(), cls ? cls->getQualifiedClassName() : ""); + throwError<ReferenceError>(kCannotAssignToMethodError, name.normalizedNameUnresolved(), cls ? cls->getQualifiedClassName() : ""); } } @@ -657,16 +657,16 @@ { if(has_getter) // Is this a read-only property? { - throwError<ReferenceError>(kConstWriteError, name.normalizedName(), cls ? cls->getQualifiedClassName() : ""); + throwError<ReferenceError>(kConstWriteError, name.normalizedNameUnresolved(), cls ? cls->getQualifiedClassName() : ""); } // Properties can not be added to a sealed class - if (cls && cls->isSealed) + if (cls && cls->isSealed && getVm()->currentCallContext) { 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()); + throwError<ReferenceError>(kConstWriteError, name.normalizedNameUnresolved(), cls ? cls->getQualifiedClassName() : ""); + throwError<ReferenceError>(kWriteSealedError, name.normalizedNameUnresolved(), cls->getQualifiedClassName()); } //Create a new dynamic variable @@ -838,8 +838,8 @@ return NULL; if(createKind == DYNAMIC_TRAIT) { - if(!mname.ns.begin()->hasEmptyName()) - throwError<ReferenceError>(kWriteSealedError, mname.normalizedName(), "" /* TODO: class name */); + //if(!mname.ns.begin()->hasEmptyName()) + // throwError<ReferenceError>(kWriteSealedError, mname.normalizedName(), "" /* TODO: class name */); var_iterator inserted=Variables.insert( make_pair(varName(name,mname.ns[0]),variable(createKind))).first; return &inserted->second; @@ -856,7 +856,7 @@ return NULL; uint32_t name=mname.normalizedNameId(); assert(!mname.ns.empty()); - + const_var_iterator ret=Variables.lower_bound(varName(name,mname.ns.front())); auto nsIt=mname.ns.begin(); @@ -928,7 +928,7 @@ v.mname = &mname; v.traitKind = traitKind; v.typemname = typemname; - context->addUninitializedVar(v); + //context->addUninitializedVar(v); obj = getSys()->getUndefinedRef(); obj = type->coerce(obj); } @@ -952,8 +952,9 @@ v.mname = &mname; v.traitKind = traitKind; v.typemname = typemname; - context->addUninitializedVar(v); - obj = getSys()->getNullRef(); + //context->addUninitializedVar(v); + obj = getSys()->getUndefinedRef(); + //obj = getSys()->getNullRef(); obj = type->coerce(obj); } //else @@ -1200,7 +1201,7 @@ LOG(LOG_CALLS,"accessing class:"<<name<<" "<< this->as<Class_base>()->getQualifiedClassName()<<" "<<nskind); if (obj->kind == INSTANCE_TRAIT && nskind != STATIC_PROTECTED_NAMESPACE) - throwError<TypeError>(kCallOfNonFunctionError,name.normalizedName()); + throwError<TypeError>(kCallOfNonFunctionError,name.normalizedNameUnresolved()); } if(obj->getter) @@ -1863,7 +1864,7 @@ variable* ret=findSettable(prototypeName,&has_getter); if(!ret && has_getter) throwError<ReferenceError>(kConstWriteError, - prototypeName.normalizedName(), + prototypeName.normalizedNameUnresolved(), classdef ? classdef->as<Class_base>()->getQualifiedClassName() : ""); if(!ret) ret = Variables.findObjVar(prototypeName,DYNAMIC_TRAIT,DECLARED_TRAIT|DYNAMIC_TRAIT);
View file
lightspark.tar.xz/src/scripting/abc_opcodes.cpp
Changed
@@ -53,16 +53,16 @@ void ABCVm::setProperty(ASObject* value,ASObject* obj,multiname* name) { - LOG(LOG_CALLS,_("setProperty ") << *name << ' ' << obj<<" "<<obj->toDebugString()<<" " << value->toString()<<" "<<value); + LOG(LOG_CALLS,_("setProperty ") << *name << ' ' << obj<<" "<<obj->toDebugString()<<" " <<value); if(obj->is<Null>()) { - LOG(LOG_ERROR,"calling setProperty on null:" << *name << ' ' << obj->toDebugString()<<" " << value->toString()); + LOG(LOG_ERROR,"calling setProperty on null:" << *name << ' ' << obj->toDebugString()<<" " << value->toDebugString()); throwError<TypeError>(kConvertNullToObjectError); } if (obj->is<Undefined>()) { - LOG(LOG_ERROR,"calling setProperty on undefined:" << *name << ' ' << obj->toDebugString()<<" " << value->toString()); + LOG(LOG_ERROR,"calling setProperty on undefined:" << *name << ' ' << obj->toDebugString()<<" " << value->toDebugString()); throwError<TypeError>(kConvertUndefinedToObjectError); } //Do not allow to set contant traits @@ -442,13 +442,13 @@ if(prop.isNull()) { if (obj->getClass() && obj->getClass()->isSealed) - throwError<ReferenceError>(kReadSealedError, name->normalizedName(), obj->getClass()->getQualifiedClassName()); + throwError<ReferenceError>(kReadSealedError, name->normalizedNameUnresolved(), obj->getClass()->getQualifiedClassName()); if (name->isEmpty()) - throwError<ReferenceError>(kReadSealedErrorNs, name->normalizedName(), obj->getClassName()); + throwError<ReferenceError>(kReadSealedErrorNs, name->normalizedNameUnresolved(), 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()); + LOG(LOG_NOT_IMPLEMENTED,"getProperty: " << name->normalizedNameUnresolved() << " not found on " << obj->toDebugString()); ret = getSys()->getUndefinedRef(); } else @@ -1192,6 +1192,10 @@ case T_INTEGER: case T_UINTEGER: break; + case T_NULL: + if (!obj2->isConstructed() && !obj2->is<Class_base>()) + return true; + return false; default: return false; } @@ -1201,6 +1205,10 @@ case T_INTEGER: case T_UINTEGER: break; + case T_NULL: + if (!obj1->isConstructed() && !obj1->is<Class_base>()) + return true; + return false; default: return false; } @@ -1354,7 +1362,7 @@ _NR<ASObject> ret = obj->getVariableByMultiname(*name,ASObject::NONE,cls); if (ret.isNull()) - throwError<ReferenceError>(kCallOfNonFunctionError,name->normalizedName()); + throwError<ReferenceError>(kCallOfNonFunctionError,name->normalizedNameUnresolved()); name->resetNameIfObject(); @@ -1497,7 +1505,7 @@ else { LOG(LOG_NOT_IMPLEMENTED,"findPropStrict: " << *name << " not found"); - throwError<ReferenceError>(kUndefinedVarError,name->normalizedName()); + throwError<ReferenceError>(kUndefinedVarError,name->normalizedNameUnresolved()); return getSys()->getUndefinedRef(); } } @@ -1818,7 +1826,7 @@ for(int i=0;i<m;++i) args[i]->decRef(); obj->decRef(); - throwError<ReferenceError>(kUndefinedVarError, name->normalizedName()); + throwError<ReferenceError>(kUndefinedVarError, name->normalizedNameUnresolved()); } name->resetNameIfObject();
View file
lightspark.tar.xz/src/scripting/flash/display/DisplayObject.cpp
Changed
@@ -126,6 +126,8 @@ c->setDeclaredMethodByQName("scaleX","",Class<IFunction>::getFunction(_setScaleX),SETTER_METHOD,true); c->setDeclaredMethodByQName("scaleY","",Class<IFunction>::getFunction(_getScaleY),GETTER_METHOD,true); c->setDeclaredMethodByQName("scaleY","",Class<IFunction>::getFunction(_setScaleY),SETTER_METHOD,true); + c->setDeclaredMethodByQName("scaleZ","",Class<IFunction>::getFunction(_getScaleZ),GETTER_METHOD,true); + c->setDeclaredMethodByQName("scaleZ","",Class<IFunction>::getFunction(_setScaleZ),SETTER_METHOD,true); c->setDeclaredMethodByQName("x","",Class<IFunction>::getFunction(_getX),GETTER_METHOD,true); c->setDeclaredMethodByQName("x","",Class<IFunction>::getFunction(_setX),SETTER_METHOD,true); c->setDeclaredMethodByQName("y","",Class<IFunction>::getFunction(_getY),GETTER_METHOD,true); @@ -525,6 +527,36 @@ return NULL; } +ASFUNCTIONBODY(DisplayObject,_getScaleZ) +{ + DisplayObject* th=static_cast<DisplayObject*>(obj); + return abstract_d(th->sz); +} + +void DisplayObject::setScaleZ(number_t val) +{ + //Apply the difference + if(sz!=val) + { + sz=val; + if(onStage) + requestInvalidation(getSys()); + } +} + +ASFUNCTIONBODY(DisplayObject,_setScaleZ) +{ + LOG(LOG_NOT_IMPLEMENTED,"DisplayObject.scaleZ is set, but not used anywhere"); + DisplayObject* th=static_cast<DisplayObject*>(obj); + assert_and_throw(argslen==1); + number_t val=args[0]->toNumber(); + //Stop using the legacy matrix + if(th->useLegacyMatrix) + th->useLegacyMatrix=false; + th->setScaleZ(val); + return NULL; +} + ASFUNCTIONBODY(DisplayObject,_getX) { DisplayObject* th=static_cast<DisplayObject*>(obj); @@ -829,7 +861,10 @@ _NR<RootMovieClip> DisplayObject::getRoot() { if(parent.isNull()) + { + LOG(LOG_ERROR,"DisplayObject has no root:"<<this->toDebugString()); return NullRef; + } return parent->getRoot(); }
View file
lightspark.tar.xz/src/scripting/flash/display/DisplayObject.h
Changed
@@ -56,7 +56,7 @@ MATRIX Matrix; number_t tx,ty; number_t rotation; - number_t sx,sy; + number_t sx,sy,sz; float alpha; tiny_string blendMode; public: @@ -175,6 +175,7 @@ void setY(number_t y); void setScaleX(number_t val); void setScaleY(number_t val); + void setScaleZ(number_t val); // Nominal width and heigt are the size before scaling and rotation number_t getNominalWidth(); number_t getNominalHeight(); @@ -195,6 +196,8 @@ ASFUNCTION(_setScaleX); ASFUNCTION(_getScaleY); ASFUNCTION(_setScaleY); + ASFUNCTION(_getScaleZ); + ASFUNCTION(_setScaleZ); ASFUNCTION(_getLoaderInfo); ASFUNCTION(_getBounds); ASFUNCTION(_getWidth);
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.cpp
Changed
@@ -54,15 +54,19 @@ LoaderInfo::LoaderInfo(Class_base* c):EventDispatcher(c),applicationDomain(NullRef),securityDomain(NullRef), contentType("application/x-shockwave-flash"), bytesLoaded(0),bytesTotal(0),sharedEvents(NullRef), - loader(NullRef),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0),childAllowsParent(true),uncaughtErrorEvents(NullRef) + loader(NullRef),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0), + childAllowsParent(true),uncaughtErrorEvents(NullRef),parentAllowsChild(true) { + LOG(LOG_NOT_IMPLEMENTED,"LoaderInfo: childAllowsParent and parentAllowsChild always return true"); } LoaderInfo::LoaderInfo(Class_base* c, _R<Loader> l):EventDispatcher(c),applicationDomain(NullRef),securityDomain(NullRef), contentType("application/x-shockwave-flash"), bytesLoaded(0),bytesTotal(0),sharedEvents(NullRef), - loader(l),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0),childAllowsParent(true),uncaughtErrorEvents(NullRef) + loader(l),bytesData(NullRef),loadStatus(STARTED),actionScriptVersion(3),swfVersion(0), + childAllowsParent(true),uncaughtErrorEvents(NullRef),parentAllowsChild(true) { + LOG(LOG_NOT_IMPLEMENTED,"LoaderInfo: childAllowsParent and parentAllowsChild always return true"); } void LoaderInfo::sinit(Class_base* c) @@ -85,6 +89,7 @@ REGISTER_GETTER(c,childAllowsParent); REGISTER_GETTER(c,contentType); REGISTER_GETTER(c,uncaughtErrorEvents); + REGISTER_GETTER(c,parentAllowsChild); } ASFUNCTIONBODY_GETTER(LoaderInfo,parameters); @@ -93,6 +98,7 @@ ASFUNCTIONBODY_GETTER(LoaderInfo,contentType); ASFUNCTIONBODY_GETTER(LoaderInfo,swfVersion); ASFUNCTIONBODY_GETTER(LoaderInfo,uncaughtErrorEvents); +ASFUNCTIONBODY_GETTER(LoaderInfo,parentAllowsChild); void LoaderInfo::buildTraits(ASObject* o) { @@ -952,7 +958,8 @@ FrameLabel_data& fl = *j; if(fl.frame == frame) { - assert_and_throw(fl.name == label); + LOG(LOG_INFO,"existing frame label found:"<<fl.name<<", new value:"<<label); + fl.name = label; return; } else if(fl.frame > frame)
View file
lightspark.tar.xz/src/scripting/flash/display/flashdisplay.h
Changed
@@ -250,6 +250,7 @@ ASPROPERTY_GETTER(uint32_t,swfVersion); ASPROPERTY_GETTER(bool, childAllowsParent); ASPROPERTY_GETTER(_NR<UncaughtErrorEvents>,uncaughtErrorEvents); + ASPROPERTY_GETTER(bool,parentAllowsChild); LoaderInfo(Class_base* c); LoaderInfo(Class_base* c, _R<Loader> l); void finalize();
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.cpp
Changed
@@ -104,6 +104,8 @@ c->setDeclaredMethodByQName("isDefaultPrevented","",Class<IFunction>::getFunction(_isDefaultPrevented),NORMAL_METHOD,true); c->setDeclaredMethodByQName("preventDefault","",Class<IFunction>::getFunction(_preventDefault),NORMAL_METHOD,true); c->setDeclaredMethodByQName("clone","",Class<IFunction>::getFunction(clone),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("stopPropagation","",Class<IFunction>::getFunction(stopPropagation),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("stopImmediatePropagation","",Class<IFunction>::getFunction(stopImmediatePropagation),NORMAL_METHOD,true); REGISTER_GETTER(c,currentTarget); REGISTER_GETTER(c,target); REGISTER_GETTER(c,type); @@ -185,6 +187,19 @@ return th->cloneImpl(); } +ASFUNCTIONBODY(Event,stopPropagation) +{ + Event* th=static_cast<Event*>(obj); + LOG(LOG_NOT_IMPLEMENTED,"Event.stopPropagation not implemented"); + return NULL; +} +ASFUNCTIONBODY(Event,stopImmediatePropagation) +{ + Event* th=static_cast<Event*>(obj); + LOG(LOG_NOT_IMPLEMENTED,"Event.stopImmediatePropagation not implemented"); + return NULL; +} + void EventPhase::sinit(Class_base* c) { CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED | CLASS_FINAL); @@ -275,6 +290,12 @@ CLASS_SETUP(c, Event, _constructor, CLASS_SEALED); c->setVariableByQName("TIMER","",Class<ASString>::getInstanceS("timer"),DECLARED_TRAIT); c->setVariableByQName("TIMER_COMPLETE","",Class<ASString>::getInstanceS("timerComplete"),DECLARED_TRAIT); + c->setDeclaredMethodByQName("updateAfterEvent","",Class<IFunction>::getFunction(updateAfterEvent),NORMAL_METHOD,true); +} +ASFUNCTIONBODY(TimerEvent,updateAfterEvent) +{ + LOG(LOG_NOT_IMPLEMENTED,"TimerEvent::updateAfterEvent not implemented"); + return NULL; } void MouseEvent::sinit(Class_base* c) @@ -293,7 +314,7 @@ c->setVariableByQName("ROLL_OUT","",Class<ASString>::getInstanceS("rollOut"),DECLARED_TRAIT); c->setDeclaredMethodByQName("updateAfterEvent","",Class<IFunction>::getFunction(updateAfterEvent),NORMAL_METHOD,true); - REGISTER_GETTER(c,relatedObject); + REGISTER_GETTER_SETTER(c,relatedObject); REGISTER_GETTER(c,stageX); REGISTER_GETTER(c,stageY); REGISTER_GETTER_SETTER(c,localX); @@ -339,7 +360,7 @@ return NULL; } -ASFUNCTIONBODY_GETTER(MouseEvent,relatedObject); +ASFUNCTIONBODY_GETTER_SETTER(MouseEvent,relatedObject); ASFUNCTIONBODY_GETTER(MouseEvent,localX); ASFUNCTIONBODY_GETTER(MouseEvent,localY); ASFUNCTIONBODY_GETTER(MouseEvent,stageX);
View file
lightspark.tar.xz/src/scripting/flash/events/flashevents.h
Changed
@@ -65,6 +65,8 @@ //and the handling is serialized ASPROPERTY_GETTER(_NR<ASObject>,target); ASPROPERTY_GETTER(_NR<ASObject>,currentTarget); + ASFUNCTION(stopPropagation); + ASFUNCTION(stopImmediatePropagation); private: /* * To be implemented by each derived class to allow redispatching @@ -257,6 +259,7 @@ static void buildTraits(ASObject* o) { } + ASFUNCTION(updateAfterEvent); }; class MouseEvent: public Event @@ -284,7 +287,7 @@ ASFUNCTION_GETTER_SETTER(shiftKey); ASPROPERTY_GETTER(number_t,stageX); ASPROPERTY_GETTER(number_t,stageY); - ASPROPERTY_GETTER(_NR<InteractiveObject>,relatedObject); + ASPROPERTY_GETTER_SETTER(_NR<InteractiveObject>,relatedObject); ASFUNCTION(updateAfterEvent); };
View file
lightspark.tar.xz/src/scripting/flash/media/flashmedia.cpp
Changed
@@ -593,12 +593,50 @@ void StageVideo::sinit(Class_base *c) { - CLASS_SETUP(c, EventDispatcher, _constructor, CLASS_SEALED); + CLASS_SETUP(c, EventDispatcher, _constructorNotInstantiatable, CLASS_SEALED); + c->setDeclaredMethodByQName("videoWidth","",Class<IFunction>::getFunction(_getVideoWidth),GETTER_METHOD,true); + c->setDeclaredMethodByQName("videoHeight","",Class<IFunction>::getFunction(_getVideoHeight),GETTER_METHOD,true); + c->setDeclaredMethodByQName("attachNetStream","",Class<IFunction>::getFunction(attachNetStream),NORMAL_METHOD,true); } -ASFUNCTIONBODY(StageVideo,_constructor) + +void StageVideo::finalize() { - EventDispatcher::_constructor(obj, NULL, 0); + netStream.reset(); +} + +ASFUNCTIONBODY(StageVideo,_getVideoWidth) +{ + StageVideo* th=Class<StageVideo>::cast(obj); + return abstract_i(th->videoWidth); +} + +ASFUNCTIONBODY(StageVideo,_getVideoHeight) +{ + StageVideo* th=Class<StageVideo>::cast(obj); + return abstract_i(th->videoHeight); +} + +ASFUNCTIONBODY(StageVideo,attachNetStream) +{ + StageVideo* th=Class<StageVideo>::cast(obj); + assert_and_throw(argslen==1); + if(args[0]->getObjectType()==T_NULL || args[0]->getObjectType()==T_UNDEFINED) //Drop the connection + { + Mutex::Lock l(th->mutex); + th->netStream=NullRef; + return NULL; + } + + //Validate the parameter + if(!args[0]->getClass()->isSubClass(Class<NetStream>::getClass())) + throw RunTimeException("Type mismatch in StageVideo::attachNetStream"); + + //Acquire the netStream + args[0]->incRef(); + + Mutex::Lock l(th->mutex); + th->netStream=_MR(Class<NetStream>::cast(args[0])); return NULL; }
View file
lightspark.tar.xz/src/scripting/flash/media/flashmedia.h
Changed
@@ -157,10 +157,18 @@ class StageVideo : public EventDispatcher { +private: + mutable Mutex mutex; + mutable uint32_t videoWidth, videoHeight; + _NR<NetStream> netStream; public: - StageVideo(Class_base* c):EventDispatcher(c){} + StageVideo(Class_base* c):EventDispatcher(c),videoWidth(0),videoHeight(0){} + void finalize(); static void sinit(Class_base*); ASFUNCTION(_constructor); + ASFUNCTION(_getVideoWidth); + ASFUNCTION(_getVideoHeight); + ASFUNCTION(attachNetStream); }; class StageVideoAvailability : public ASObject
View file
lightspark.tar.xz/src/scripting/flash/net/flashnet.cpp
Changed
@@ -2006,7 +2006,7 @@ } LocalConnection::LocalConnection(Class_base* c): - EventDispatcher(c),isSupported(false) + EventDispatcher(c),isSupported(false),client(NULL) { } @@ -2016,14 +2016,20 @@ 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); + c->setDeclaredMethodByQName("connect","",Class<IFunction>::getFunction(connect),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("close","",Class<IFunction>::getFunction(close),NORMAL_METHOD,true); REGISTER_GETTER(c,isSupported); + REGISTER_GETTER_SETTER(c,client); } ASFUNCTIONBODY_GETTER(LocalConnection, isSupported); +ASFUNCTIONBODY_GETTER_SETTER(LocalConnection, client); ASFUNCTIONBODY(LocalConnection, _constructor) { EventDispatcher::_constructor(obj, NULL, 0); LocalConnection* th=Class<LocalConnection>::cast(obj); + th->incRef(); + th->client = _NR<LocalConnection>(th); LOG(LOG_NOT_IMPLEMENTED,"LocalConnection is not implemented"); return NULL; } @@ -2045,6 +2051,18 @@ LOG(LOG_NOT_IMPLEMENTED,"LocalConnection::send is not implemented"); return NULL; } +ASFUNCTIONBODY(LocalConnection, connect) +{ + LocalConnection* th=Class<LocalConnection>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"LocalConnection::connect is not implemented"); + return NULL; +} +ASFUNCTIONBODY(LocalConnection, close) +{ + LocalConnection* th=Class<LocalConnection>::cast(obj); + LOG(LOG_NOT_IMPLEMENTED,"LocalConnection::close is not implemented"); + return NULL; +} NetGroup::NetGroup(Class_base* c): EventDispatcher(c)
View file
lightspark.tar.xz/src/scripting/flash/net/flashnet.h
Changed
@@ -375,6 +375,9 @@ ASFUNCTION(allowDomain); ASFUNCTION(allowInsecureDomain); ASFUNCTION(send); + ASFUNCTION(connect); + ASFUNCTION(close); + ASPROPERTY_GETTER_SETTER(_NR<ASObject>,client); }; class NetGroup: public EventDispatcher
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.cpp
Changed
@@ -295,7 +295,7 @@ ASObject* target; ASObject* o=th->getVariableAndTargetByMultiname(name,target); if(o == NULL) - throwError<ReferenceError>(kClassNotFoundError,name.normalizedName()); + throwError<ReferenceError>(kClassNotFoundError,name.normalizedNameUnresolved()); //TODO: specs says that also namespaces and function may be returned assert_and_throw(o->getObjectType()==T_CLASS); @@ -535,8 +535,9 @@ ASFUNCTIONBODY(Security, loadPolicyFile) { - LOG(LOG_INFO, "Loading policy file: " << getSys()->mainClip->getOrigin().goToURL(args[0]->toString())); - getSys()->securityManager->addPolicyFile(getSys()->mainClip->getOrigin().goToURL(args[0]->toString())); + tiny_string url = args[0]->toString(); + LOG(LOG_INFO, "Loading policy file: " << getSys()->mainClip->getOrigin().goToURL(url)); + getSys()->securityManager->addPolicyFile(getSys()->mainClip->getOrigin().goToURL(url)); assert_and_throw(argslen == 1); return NULL; } @@ -570,6 +571,7 @@ { CLASS_SETUP(c, ASObject, _constructorNotInstantiatable, CLASS_SEALED | CLASS_FINAL); c->setDeclaredMethodByQName("totalMemory","",Class<IFunction>::getFunction(totalMemory),GETTER_METHOD,false); + c->setDeclaredMethodByQName("disposeXML","",Class<IFunction>::getFunction(totalMemory),GETTER_METHOD,false); } @@ -578,6 +580,11 @@ LOG(LOG_NOT_IMPLEMENTED, "System.totalMemory not implemented"); return abstract_d(1024); } +ASFUNCTIONBODY(System,disposeXML) +{ + LOG(LOG_NOT_IMPLEMENTED, "System.disposeXML not implemented"); + return NULL; +} ASWorker::ASWorker(Class_base* c): EventDispatcher(c)
View file
lightspark.tar.xz/src/scripting/flash/system/flashsystem.h
Changed
@@ -157,6 +157,7 @@ System(Class_base* c):ASObject(c){} static void sinit(Class_base* c); ASFUNCTION(totalMemory); + ASFUNCTION(disposeXML); }; class ASWorker: public EventDispatcher {
View file
lightspark.tar.xz/src/scripting/flash/utils/ByteArray.cpp
Changed
@@ -56,7 +56,7 @@ void ByteArray::sinit(Class_base* c) { - CLASS_SETUP_NO_CONSTRUCTOR(c, ASObject, CLASS_SEALED); + CLASS_SETUP(c, ASObject, _constructor, CLASS_SEALED); c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(_getLength),GETTER_METHOD,true); c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(_setLength),SETTER_METHOD,true); c->setDeclaredMethodByQName("bytesAvailable","",Class<IFunction>::getFunction(_getBytesAvailable),GETTER_METHOD,true); @@ -231,6 +231,11 @@ return position; } +ASFUNCTIONBODY(ByteArray,_constructor) +{ + return NULL; +} + ASFUNCTIONBODY(ByteArray,_getPosition) { ByteArray* th=static_cast<ByteArray*>(obj); @@ -984,6 +989,8 @@ { if(considerDynamic==false) return ASObject::hasPropertyByMultiname(name, considerDynamic, considerPrototype); + if (!isConstructed()) + return false; unsigned int index=0; if(!Array::isValidMultiname(name,index))
View file
lightspark.tar.xz/src/scripting/flash/utils/ByteArray.h
Changed
@@ -71,6 +71,7 @@ uint8_t getCurrentObjectEncoding() const { return currentObjectEncoding; } void setCurrentObjectEncoding(uint8_t encoding) { currentObjectEncoding = encoding; } + ASFUNCTION(_constructor); ASFUNCTION(_getBytesAvailable); ASFUNCTION(_getLength); ASFUNCTION(_setLength);
View file
lightspark.tar.xz/src/scripting/flash/utils/Dictionary.cpp
Changed
@@ -229,7 +229,13 @@ bool Dictionary::hasPropertyByMultiname(const multiname& name, bool considerDynamic, bool considerPrototype) { if(considerDynamic==false) + { + if(name.name_type==multiname::NAME_OBJECT) + return false; return ASObject::hasPropertyByMultiname(name, considerDynamic, considerPrototype); + } + if (!isConstructed()) + return false; if(name.name_type==multiname::NAME_OBJECT) {
View file
lightspark.tar.xz/src/scripting/flash/utils/Proxy.cpp
Changed
@@ -114,7 +114,7 @@ ASObject* arg = namearg; //We now suppress special handling implEnable=false; - LOG(LOG_CALLS,"Proxy::getProperty "<< name.normalizedName() << " " << this->toDebugString()); + LOG(LOG_CALLS,"Proxy::getProperty "<< name.normalizedNameUnresolved() << " " << this->toDebugString()); incRef(); _NR<ASObject> ret=_MNR(f->call(this,&arg,1)); implEnable=true; @@ -129,7 +129,8 @@ bool asobject_has_property=ASObject::hasPropertyByMultiname(name, considerDynamic, considerPrototype); if(asobject_has_property || !implEnable) return asobject_has_property; - + if (!isConstructed()) + return false; //Check if there is a custom hasProperty defined, skipping implementation to avoid recursive calls multiname hasPropertyName(NULL); hasPropertyName.name_type=multiname::NAME_STRING;
View file
lightspark.tar.xz/src/scripting/toplevel/Array.cpp
Changed
@@ -1277,6 +1277,8 @@ { if(considerDynamic==false) return ASObject::hasPropertyByMultiname(name, considerDynamic, considerPrototype); + if (!isConstructed()) + return false; uint32_t index=0; if(!isValidMultiname(name,index)) @@ -1333,7 +1335,7 @@ // Derived classes may be sealed! if (getClass() && getClass()->isSealed) throwError<ReferenceError>(kWriteSealedError, - name.normalizedName(), + name.normalizedNameUnresolved(), getClass()->getQualifiedClassName()); if (index==0xFFFFFFFF) return;
View file
lightspark.tar.xz/src/scripting/toplevel/Error.h
Changed
@@ -36,6 +36,7 @@ void throwError(int errorID, const tiny_string& arg1="", const tiny_string& arg2="", const tiny_string& arg3="") { tiny_string message = createErrorMessage(errorID, arg1, arg2, arg3); + LOG(LOG_INFO,"throwing exception:"<<errorID<<" "<<message); throw Class<T>::getInstanceS(message, errorID); }
View file
lightspark.tar.xz/src/scripting/toplevel/JSON.cpp
Changed
@@ -73,8 +73,6 @@ { _NR<ASObject> value; ARG_UNPACK(value); - if (value->has_toJSON()) - return Class<ASString>::getInstanceS(value->call_toJSON()); std::vector<ASObject *> path; tiny_string filter; IFunction* replacer = NULL;
View file
lightspark.tar.xz/src/scripting/toplevel/Vector.cpp
Changed
@@ -164,7 +164,7 @@ } else { - throwError<ArgumentError>(kCheckTypeFailedError, args[0]->toString(), "Vector"); + throwError<ArgumentError>(kCheckTypeFailedError, args[0]->getClassName(), "Vector"); } return NULL; @@ -1076,7 +1076,7 @@ // Don't throw for non-numeric NAME_STRING or NAME_OBJECT // because they can still be valid built-in property names. if(!validIndex && (name.name_type==multiname::NAME_INT || name.name_type==multiname::NAME_NUMBER)) - throwError<RangeError>(kOutOfRangeError, name.normalizedName(), "?"); + throwError<RangeError>(kOutOfRangeError, name.normalizedNameUnresolved(), "?"); return validIndex; }
View file
lightspark.tar.xz/src/scripting/toplevel/XML.cpp
Changed
@@ -1554,6 +1554,8 @@ { if(considerDynamic == false) return ASObject::hasPropertyByMultiname(name, considerDynamic, considerPrototype); + if (!isConstructed()) + return false; //Only the first namespace is used, is this right? tiny_string ns_uri; @@ -1696,7 +1698,7 @@ // Don't throw for non-numeric NAME_STRING or NAME_OBJECT // because they can still be valid built-in property names. if(!validIndex && (name.name_type==multiname::NAME_INT || name.name_type==multiname::NAME_NUMBER)) - throwError<RangeError>(kOutOfRangeError, name.normalizedName(), "?"); + throwError<RangeError>(kOutOfRangeError, name.normalizedNameUnresolved(), "?"); return validIndex; }
View file
lightspark.tar.xz/src/scripting/toplevel/XMLList.cpp
Changed
@@ -716,6 +716,8 @@ { if(considerDynamic==false) return ASObject::hasPropertyByMultiname(name, considerDynamic, considerPrototype); + if (!isConstructed()) + return false; unsigned int index=0; if(XML::isValidMultiname(name,index))
View file
lightspark.tar.xz/src/scripting/toplevel/toplevel.cpp
Changed
@@ -54,11 +54,15 @@ Null::Null():ASObject((Class_base*)(NULL)) { + traitsInitialized = true; + constructIndicator = true; type=T_NULL; } Undefined::Undefined():ASObject((Class_base*)(NULL)) { + traitsInitialized = true; + constructIndicator = true; type=T_UNDEFINED; } @@ -135,10 +139,10 @@ { c->prototype->setVariableByQName("toString","",Class<IFunction>::getFunction(IFunction::_toString),DYNAMIC_TRAIT); - c->setDeclaredMethodByQName("call","",Class<IFunction>::getFunction(IFunction::_call),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("call",AS3,Class<IFunction>::getFunction(IFunction::_call),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("apply","",Class<IFunction>::getFunction(IFunction::apply),NORMAL_METHOD,true); - c->setDeclaredMethodByQName("apply",AS3,Class<IFunction>::getFunction(IFunction::apply),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("call","",Class<IFunction>::getFunction(IFunction::_call,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("call",AS3,Class<IFunction>::getFunction(IFunction::_call,1),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("apply","",Class<IFunction>::getFunction(IFunction::apply,2),NORMAL_METHOD,true); + c->setDeclaredMethodByQName("apply",AS3,Class<IFunction>::getFunction(IFunction::apply,2),NORMAL_METHOD,true); c->setDeclaredMethodByQName("length","",Class<IFunction>::getFunction(IFunction::_getter_length),GETTER_METHOD,true); c->setDeclaredMethodByQName("toString","",Class<IFunction>::getFunction(IFunction::_toString),NORMAL_METHOD,false); } @@ -808,7 +812,12 @@ ASObject* Class_base::coerce(ASObject* o) const { - if(o->is<Null>() || o->is<Undefined>()) + if (o->is<Undefined>()) + { + o->decRef(); + return getSys()->getNullRef(); + } + if(o->is<Null>()) return o; if(o->is<Class_base>()) { /* classes can be cast to the type 'Object' or 'Class' */
View file
lightspark.tar.xz/src/swftypes.cpp
Changed
@@ -94,6 +94,25 @@ } } +tiny_string multiname::normalizedNameUnresolved() const +{ + switch(name_type) + { + case multiname::NAME_INT: + return Integer::toString(name_i); + case multiname::NAME_NUMBER: + return Number::toString(name_d); + case multiname::NAME_STRING: + return getSys()->getStringFromUniqueId(name_s_id); + case multiname::NAME_OBJECT: + return name_o ? name_o->getClassName() : "*"; + default: + assert("Unexpected name kind" && false); + //Should never reach this + return ""; + } +} + void multiname::setName(ASObject* n) { if (name_type==NAME_OBJECT && name_o!=NULL) { @@ -1353,7 +1372,12 @@ { /* collon is not the first character and there is * another collon before it */ - assert_and_throw(collon != tmp.raw_buf() && *(collon-1) == ':'); + if (collon == tmp.raw_buf() || *(collon-1) != ':') + { + name=tmp; + ns=""; + return; + } uint32_t collon_offset = collon-tmp.raw_buf(); ns = tmp.substr_bytes(0,collon_offset-1); name = tmp.substr_bytes(collon_offset+1,tmp.numBytes()-collon_offset-1);
View file
lightspark.tar.xz/src/swftypes.h
Changed
@@ -370,6 +370,13 @@ * Return a string id whatever is the name type */ uint32_t normalizedNameId() const; + /* + Returns a string name whatever is the name type, but does not resolve NAME_OBJECT names + this should be used for exception or debug messages to avoid calling + overridden toString property of the object + */ + tiny_string normalizedNameUnresolved() const; + tiny_string qualifiedString() const; /* sets name_type, name_s/name_d based on the object n */ void setName(ASObject* n);
View file
lightspark.tar.xz/tools/langref_parser
Changed
@@ -42,9 +42,9 @@ isConst = False toplevelfiles = [ "ArgumentError.html", "Array.html", "Boolean.html", "Class.html", "Date.html", "DefinitionError.html", "Error.html", - "EvalError.html", "Function.html", "Math.html", "Namespace.html", "Number.html", "Object.html", "QName.html", "RangeError.html", + "EvalError.html", "Function.html", "int.html", "JSON.html", "Math.html", "Namespace.html", "Number.html", "Object.html", "QName.html", "RangeError.html", "ReferenceError.html", "RegExp.html", "SecurityError.html", "String.html", "SyntaxError.html", - "TypeError.html", "URIError.html", "Vector.html", "VerifyError.html", "XML.html", "XMLList.html" ] + "TypeError.html", "uint.html", "URIError.html", "Vector.html", "VerifyError.html", "XML.html", "XMLList.html" ] regclass = re.compile(r'<title>([a-zA-Z0-9\.]*)') regconst = re.compile(r'Public Constants')
View file
lightspark.tar.xz/tools/pygil
Changed
@@ -13,7 +13,7 @@ #These regexp are used for finding important pieces in the source sinit = re.compile('.*void\s*(\w*)::sinit\(.*') -rconstructor = re.compile('[^/]*ASFUNCTIONBODY\([^,]*, *\_constructor\)') +rconstructor = re.compile('[^/]*ASFUNCTIONBODY\( *([^,]*), *\_constructor\)') #looks like builtin->registerBuiltin("Capabilities","flash.system",Class<Capabilities>::getRef()); rclass = re.compile('.*builtin->registerBuiltin\( *"([^"]*)", *"([^"]*)", *Class<([^>]*)>::getRef\(\)\)') rtemplateclass = re.compile('.*builtin->registerBuiltin\( *"([^"]*)", *"([^"]*)", *_MR\(Template<([^>]*)>::getTemplate\(\)\)\)') @@ -24,11 +24,11 @@ rget = re.compile('[^/]*->setDeclaredMethodByQName\( *"([^"]*)", *([^,]*),[^,]*, *GETTER_METHOD, *([^ ]*)') rset = re.compile('[^/]*->setDeclaredMethodByQName\( *"([^"]*)", *([^,]*),[^,]*, *SETTER_METHOD, *([^ ]*)') rmet = re.compile('[^/]*->setDeclaredMethodByQName\( *"([^"]*)", *([^,]*),[^,]*,(\w\),)* *NORMAL_METHOD, *([^ ]*)') +rmet2 = re.compile('[^/]*->prototype->setVariableByQName\( *"([^"]*)", *([^,]*),[^,]*,(\w\),)* *[A-Z]*\_TRAIT') rget2 = re.compile('.*REGISTER_GETTER\([^,]*, *(.*)\)') rset2 = re.compile('.*REGISTER_SETTER\([^,]*, *(.*)\)') rgetset2 = re.compile('.*REGISTER_GETTER_SETTER\([^,]*, *(.*)\)') -#Constant names do not contain lower-case letters -rconst = re.compile('[^/]*->setVariableByQName\("([A-Z_0-9]*)",.*_TRAIT'); +rconst = re.compile('[^/]*->setVariableByQName\("([A-Za-z_0-9]*)",.*[A-Z]*\_TRAIT'); rcomment = re.compile('[ \t]*/') def getFullname(cls,name): @@ -51,6 +51,7 @@ warnNotRegistered = set([]) internalToExternal = {} curClass = "" +curClassConstructor = "" #1. Step: parse scripting/abc.cpp to map the AS3 names to our class names f = open('../src/scripting/abc.cpp','r') @@ -109,7 +110,12 @@ m = rconstructor.match(line) if m: #the constructor is named after the class - methods.add((curClass,curClass[curClass.rfind('.')+1:])) + curClassConstructor = m.group(1) + if curClassConstructor not in internalToExternal: + warnNotRegistered.add(curClassConstructor) + else: + curClassConstructor = internalToExternal[curClassConstructor] + methods.add((curClassConstructor,curClassConstructor[curClassConstructor.rfind('.')+1:])) continue m = rget.match(line) if m: @@ -136,6 +142,10 @@ if m: methods.add((curClass, m.group(1))) continue + m = rmet2.match(line) + if m: + methods.add((curClass, m.group(1))) + continue m = rconst.match(line) if m: const.add((curClass,m.group(1)))
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
.