Can't reach php file hosted on MAMP in Flexunit tests in IntelliJ

47 views Asked by At

I am running a host in MAMP, reachable via http://localhost:8888 and https://myapp.co.uk:8890

My problem is that my flexunit tests are unable to reach a php script running on that host.

At the root is crossdomain.xml file:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
    <site-control permitted-cross-domain-policies='all'/>
    <allow-access-from domain='*' to-ports='*'/>
    <allow-access-from domain="localhost" to-ports="*"/>
</cross-domain-policy>

The crossdomain.xml file can be read via either host in my browser.

I am trying to reach a php script, again I can reach this via either host in my browser.

If I set the build configuration to the defaults, I get a straight IOError. If I set the build configuration to use -use-network=true I get:

Warning: Failed to load policy file from https://myapp.co.uk:8890/crossdomain.xml

Followed by a Security Sandbox Violation:

connection to https://myapp.co.uk:8890/path/to/script.php halted - 
not permitted from file:///Users/me/path/to/output/_flexunit.swf

It doesn't matter whether I leave the crossdomain.xml file to be loaded automatically, or explictly load it using Security.loadPolicyFile(...)

I'm running my flexunit tests via the flexunit task in IntelliJ IDEA.

Any suggestions? I'm stumped.


Addition: a swf of the application is able to reach the MAMP files no problem, it's only the flexunit test that isn't able to. I'm wondering if it might be something to do with the sockets to get the test results back in to IntelliJ IDEA.

1

There are 1 answers

0
Nambew On

It's a security issue, you can't allow website access for swf on your computer with crossdomain.xml. You have to manually specify trusted SWF or directory on your computer.

  • Right click on flash player and go to Global Settings.
  • Open Global Security Settings panel
  • Click on Edit locations and Add file or folder.

You can look at this site for information with screenshot.