Closed Bug 496633 Opened 15 years ago Closed 15 years ago

TypeError thrown when Vector types from different loaded abcs collide

Categories

(Tamarin Graveyard :: Virtual Machine, defect, P1)

x86
macOS
defect

Tracking

(Not tracked)

VERIFIED FIXED
flash10

People

(Reporter: dschaffe, Assigned: tierney)

Details

Attachments

(3 files)

reported from a player bug.

collision occurs when two different Domains create a typed Vector of the class.

e.g.
    public class mas {
        public function mas() {
            print("mas: in constructor");
            var d1:Domain=new Domain(Domain.currentDomain);
            d1.load("mod1.abc");
            var d2:Domain=new Domain(Domain.currentDomain);
            d2.load("mod2.abc");
        }
    }
    new mas();

TypeError occurs if each loaded class in different domains create a typed vector with the same type.  e.g.
mod1.abc and mod2.abc both do:
            var v:Vector.<foo>=new Vector.<foo>();
            v.push(new foo());

when mas.abc is run error is:
TypeError: Error #1034: Type Coercion failed: cannot convert foo@312e91 to foo.
	at Vector$object/http://adobe.com/AS3/2006/builtin::push()
	at Function/http://adobe.com/AS3/2006/builtin::apply()
	at Function/<anonymous>()
	at mod2()
	at global$init()
	at avmplus::Domain/loadBytes()
	at avmplus::Domain/load()
	at mas()
	at global$init()

commented out the Vector reference and changing to just a simple reference does not return the TypeError. e.g.
  // both mod1.abc and mod2.abc contain:
  var v:foo=new foo();
Flags: flashplayer-triage+
Flags: flashplayer-qrb?
Attached file files to reproduce bug
added bug files to reproduce bug.  see build.sh for build instructions.  running avmshell mas.abc reproduces the TypeError in tr-1982.
Assignee: nobody → tierney
Status: NEW → ASSIGNED
Flags: flashplayer-qrb? → flashplayer-qrb+
Target Milestone: --- → flash10
Priority: -- → P1
The problem was that we were only creating 1 Vector class for Vector.<Foo>.  However, there were 2 different Foo's from different domains.

Instead of storing the instantiated Vector classes in the builtin Domain, store them in the Domain the type parameter came from.  This allows us to have 2 different Vector.<Foo> (one for each Foo) that are only visible where the appropriate definition of Foo is available.  

Also had to change the instantiated_type map from using the name, to using the type parameter since there can now be multipe Vector.<Foo>.
Attachment #382158 - Flags: superreview?(stejohns)
Attachment #382158 - Flags: review?(stejohns)
Comment on attachment 382158 [details] [diff] [review]
Fix vector problem

approved, but we *must* add acceptance tests for this in a subsequent patch.
Attachment #382158 - Flags: superreview?(stejohns)
Attachment #382158 - Flags: superreview+
Attachment #382158 - Flags: review?(stejohns)
Attachment #382158 - Flags: review+
Attached patch testcaseSplinter Review
Pushed fix along with testcases:
http://hg.mozilla.org/tamarin-redux/rev/d13df55e72bb
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
closing bug by marking verified/fixed
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: