Closed
Bug 475438
Opened 16 years ago
Closed 6 years ago
flash.utils.getQualifiedClassName is missing.
Categories
(Tamarin Graveyard :: Virtual Machine, defect)
Tamarin Graveyard
Virtual Machine
Tracking
(Not tracked)
RESOLVED
WONTFIX
Future
People
(Reporter: ben.garney, Unassigned)
References
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.43 Safari/525.19
Build Identifier:
getQualifiedClassName is missing from avmshell.
The following C++ code can be used to recreate it:
Stringp DomainObject::getClassName(Atom a)
{
AvmCore* core = this->core();
Traits *t = NULL;
if (core->istype(a, CLASS_TYPE))
{
ClassClosure *cc = (ClassClosure *)AvmCore::atomToScriptObject(a);
t = cc->ivtable()->traits;
}
else
{
t = toplevel()->toTraits(a);
}
return t->formatClassName();
}
A line must be added to the Domain definition in Domain.as as well:
public native function getClassName(o:*):String;
This is modeled on the implementation of getClassByName in http://hg.mozilla.org/tamarin-redux/file/e3cc0ba266a2/shell/shell_toplevel.as, which redirects to Domain.currentDomain.getClass().
The function appears to be missing in tamarin-redux tip as of Jan 26, 2009.
Reproducible: Always
Steps to Reproduce:
1. Try to call getQualifiedClassName.
Actual Results:
It does not exist.
Expected Results:
It does exist.
Reporter | ||
Comment 1•16 years ago
|
||
On review, this code probably crashes when you pass a null object. It is based on ObjectClass::_toString(), which always has a valid this.
Comment 2•16 years ago
|
||
It is available in package avmplus (along with getQualifiedSuperclassName and describeType) -- all you really need to do is add AS3 wrappers like so:
package flash.utils
{
import avmplus.*;
public function getQualifiedSuperclassName(value:*):String
{
return avmplus.getQualifiedSuperclassName(value);
}
}
Reporter | ||
Comment 3•16 years ago
|
||
Yup, you are totally right. Thank you for correcting me, Steven!
In case anyone ever needs it, here is the corrected implementation of the code I posted in this bug:
Ok, here is an updated version, which does work correctly when you pass in
nulls.
Stringp DomainObject::getClassName(Atom a)
{
// Return null string for null values.
if(AvmCore::isNull(a))
return (Stringp)AtomConstants::nullStringAtom;
AvmCore *core = this->core();
Traits *t = NULL;
if (core->istype(a, CLASS_TYPE))
{
ClassClosure *cc = (ClassClosure *)AvmCore::atomToScriptObject(a);
t = cc->ivtable()->traits;
}
else
{
t = toplevel()->toTraits(a);
}
// Is this even possible?
if(!t)
return (Stringp)AtomConstants::nullStringAtom;
return t->formatClassName();
}
Reporter | ||
Comment 4•16 years ago
|
||
PS - Would it make sense to add that to the official codebase so that it's in the same place as Flex et al?
Comment 5•16 years ago
|
||
(In reply to comment #4)
> PS - Would it make sense to add that to the official codebase so that it's in
> the same place as Flex et al?
Sure, I'd be happy with such a patch, feel free to submit one
Reporter | ||
Comment 6•16 years ago
|
||
Would you prefer against redux or central? Also, am I blind or is there no script file that contains stuff from the flash.util namespace? Would the recommended place be core/actionscript.lang.as?
Comment 7•16 years ago
|
||
(In reply to comment #6)
> Would you prefer against redux or central?
generally, we're putting day-to-day changes into redux (aka the "unstable" branch), then merging them over into central ("stable") every month or two.
> Also, am I blind or is there no
> script file that contains stuff from the flash.util namespace? Would the
> recommended place be core/actionscript.lang.as?
Correct. avmplus itself shouldn't contain any of the flash namespaces -- this should go somewhere in avmshell, not avmplus (eg shell_toplevel.as)
Reporter | ||
Comment 8•16 years ago
|
||
For the reference of future people who may run into this issue, you can get ahold of a wide variety of Flash-compatible stubs from redtamarin at http://code.google.com/p/redtamarin/source/browse/#svn/as3/redshell/trunk/src
It is under the MPL so compatible with Tamarin.
Steven, given this exists, is it still worthwhile to worry about adding support to flash.* stuff in "official" tamarin? If not I won't bother with a patch.
Comment 9•16 years ago
|
||
IMHO, anything in the flash.* namespace doesn't belong in the avmplus/core area; however, the ones that are trivial wrappers (eg ByteArray) would make sense to have present in avmshell. Other reviewers should chime in here but I think patches of that sort would be generally useful and welcome.
Updated•16 years ago
|
Blocks: AS3_Builtins
Flags: flashplayer-qrb+
Priority: -- → P4
Target Milestone: --- → Future
Updated•15 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•15 years ago
|
Priority: P4 → --
Updated•6 years ago
|
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•