trustedDomains can't handle multiple domains? #130

Closed
mattbaker opened this Issue Apr 3, 2013 · 4 comments

Comments

Projects
None yet
2 participants

I'm noticing that specifying multiple domains to the trustedDomain configuration property doesn't allow either domain. If I only specify one domain then it will work.

I'm not too familiar with Flash or AS, but I noticed the line below:

// Allow the swf object to be run on any domain, for when the site hosts the file on a separate server
      if (flashvars.trustedDomain) {
        flash.system.Security.allowDomain(flashvars.trustedDomain.split("\\").join("\\\\"));
      }

However the [docs](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Security.html#allowDomain(\)) for allowDomain seem to indicate that it takes multiple strings, not a single, delimited string. Could this be the issue? Without Flash I can't attempt my own build to test this.

Apologies if I'm off the mark — has anyone else had trouble specifying more than one trusted domain?

Works

ZeroClipboard.setDefaults({
      moviePath: "//mycdn.net/assets/ZeroClipboard-dcb75625e3ee9cca54f3e3557284c2ae.swf",
      trustedDomains: ['localhost'],
      allowScriptAccess: "always",
   });

Does not work

ZeroClipboard.setDefaults({
      moviePath: "//mycdn.net/assets/ZeroClipboard-dcb75625e3ee9cca54f3e3557284c2ae.swf",
      trustedDomains: ['mydomain.com','localhost'],
      allowScriptAccess: "always",
   });
Owner

JamesMGreene commented Apr 3, 2013

I believe you are correct. I'm speculating that the appropriate fix would be as follows:

if (flashvars.trustedDomain) {
  var domains = flashvars.trustedDomain.split("\\").join("\\\\").split(",");
  flash.system.Security.allowDomain.apply(null, domains);
}

@ghost ghost assigned JamesMGreene May 3, 2013

JamesMGreene added a commit to JamesMGreene/zeroclipboard that referenced this issue May 3, 2013

Owner

JamesMGreene commented May 3, 2013

@mattbaker: Care to give the SWF file in PR #140 a try?

Appears to work!

Owner

JamesMGreene commented May 3, 2013

Excellent. Thanks for the quick turnaround on testing! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment