13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Security<br />

Errors wh<strong>en</strong> calling restricted code<br />

Adobe AIR 1.0 and later<br />

If you call code that is restricted from use in a sandbox due to these security restrictions, the runtime dispatches a<br />

JavaScript error: "Adobe AIR runtime security violation for JavaScript code in the application security sandbox."<br />

For more information, see “Avoiding security-related JavaScript errors” on page 980.<br />

Sandbox protection wh<strong>en</strong> loading HTML cont<strong>en</strong>t from a string<br />

Adobe AIR 1.0 and later<br />

The loadString() method of the HTMLLoader class lets you create HTML cont<strong>en</strong>t at run time. However, data that<br />

you use as the HTML cont<strong>en</strong>t can be corrupted if the data is loaded from an insecure Internet source. For this reason,<br />

by default, HTML created using the loadString() method is not placed in the application sandbox and it has no<br />

access to AIR APIs. However, you can set the placeLoadStringCont<strong>en</strong>tInApplicationSandbox property of an<br />

HTMLLoader object to true to place HTML created using the loadString() method into the application sandbox.<br />

For more information, see “Loading HTML cont<strong>en</strong>t from a string” on page 979.<br />

Scripting betwe<strong>en</strong> cont<strong>en</strong>t in differ<strong>en</strong>t domains<br />

Adobe AIR 1.0 and later<br />

AIR applications are granted special privileges wh<strong>en</strong> they are installed. It is crucial that the same privileges not be<br />

leaked to other cont<strong>en</strong>t, including remote files and local files that are not part of the application.<br />

About the AIR sandbox bridge<br />

Adobe AIR 1.0 and later<br />

Normally, cont<strong>en</strong>t from other domains cannot call scripts in other domains. To protect AIR applications from<br />

accid<strong>en</strong>tal leakage of privileged information or control, the following restrictions are placed on cont<strong>en</strong>t in the<br />

application security sandbox (cont<strong>en</strong>t installed with the application):<br />

Code in the application security sandbox cannot allow to other sandboxes by calling the<br />

Security.allowDomain() method. Calling this method from the application security sandbox will throw an<br />

error.<br />

Importing non-application cont<strong>en</strong>t into the application sandbox by setting the LoaderContext.securityDomain<br />

or the LoaderContext.applicationDomain property is prev<strong>en</strong>ted.<br />

There are still cases where the main AIR application requires cont<strong>en</strong>t from a remote domain to have controlled access<br />

to scripts in the main AIR application, or vice versa. To accomplish this, the runtime provides a sandbox bridge<br />

mechanism, which serves as a gateway betwe<strong>en</strong> the two sandboxes. A sandbox bridge can provide explicit interaction<br />

betwe<strong>en</strong> remote and application security sandboxes.<br />

The sandbox bridge exposes two objects that both loaded and loading scripts can access:<br />

The par<strong>en</strong>tSandboxBridge object lets loading cont<strong>en</strong>t expose properties and functions to scripts in the loaded<br />

cont<strong>en</strong>t.<br />

The childSandboxBridge object lets loaded cont<strong>en</strong>t expose properties and function to scripts in the loading<br />

cont<strong>en</strong>t.<br />

Last updated 6/6/2012<br />

1075

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!