Flash ExternalInterface breaks "myString".constructor==String

RESOLVED INCOMPLETE

Status

()

Core
Plug-ins
RESOLVED INCOMPLETE
12 years ago
9 years ago

People

(Reporter: Jonas Bohlin, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: closeme 2009-03-08)

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

After a swf calls a javascript method, or javascript calls a method of a swf using parameters via ExternalInterface, the behaviour of the construct
"myString".constructor == String 
changes! 
typeof("myString") == "string"
is still true!


Reproducible: Always

Steps to Reproduce:
1. Create a swf that exposes a method to javascript using ExternalInterface. Embed it in a html page
2. Call the method with at least one parameter 
3. evaluate the following javascript statements 
//js
var isStringConstructor = ("myString".constructor == String)
var isStringTypeof = (typeof("myString") == "string")

Actual Results:  
isStringConstructor = false
isStringTypeof = true

Expected Results:  
isStringConstructor = true
isStringTypeof = true

This was tested in ff2 on pc & mac. Firebug plugin was active. Flash movie was version 8, players tested were 8 & 9. Problem does not occur in ff1.5.

Here's the test code I've used

function test(){
  var a = "text";
  var isStringConstructor = (a.constructor==String);
  var isStringTypeof = (typeof(a)=="string");
  console.log("is 'a' a string? ",isStringConstructor,isStringTypeof);
}

test(); //is 'a' a string? true,true

document.getElementById("myflashmovie").someMethod("withParam");
/*or have ExternalInterface send parameters out to the browser - 
anything that involves passing _strings_ between browser and flash*/

test(); //is 'a' a string? false,true
If anything loads a new document, you'll get a new set of standard objects including the String constructor.  Could that be happening?  Otherwise, sounds like maybe an npruntime inner/outer object bug?

/be
Assignee: general → nobody
Component: JavaScript Engine → Plug-ins
QA Contact: general → plugins
A complete testcase, attached to the bug or hosted reliably on the web, would be a big help.  Thanks,

/be
(Reporter)

Comment 3

12 years ago
Brendan, I don't think calling ExternalInterface-exposed methods from flash constitues loading a new document? Either way, it seems to be ff2 only, not newer milestone builds (by rumor only).

I'll try to get around to posting an example as soon as possible!

Comment 4

12 years ago
This has been bugging me as well. I had a test page up and I've modified it to use Jonas' test function: http://dev.noiseusse.org/testflash

I can confirm that argument passing, in both directions, works in firefox 1.5 and 3.0a with flash player 9. Also, it appears to me that the problem only occurs when passing arguments to flash and not in the other direction.

Comment 5

12 years ago
This seems to be fixed in FF2.0.1.

Yay!

Comment 6

9 years ago
Do you still see this problem using latest version of Firefox and Flash (10)?

If you do, please comment.
If you do not see the problem, please close the bug - don't use resolution=FIXED, change resolution to:
- INVALID if you believe the problem was flash player
- WORKSFORME if you believe the problem was in Firefox
- INCOMPLETE if it is impossible to test (url or testcase is gone)
Whiteboard: closeme 2009-03-08
Please reopen this bug if it appears with a recent version of firefox 3 in a new profile. http://support.mozilla.com/kb/Profiles
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.