Ticket #5822 (closed bug: invalid)
new Function not allowed after page load in Adobe AIR
| Reported by: | dmethvin | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.4.1 |
| Component: | ajax | Version: | 1.4 |
| Keywords: | adobe air function load | Cc: | |
| Blocking: | Blocked by: |
Description
http://groups.google.com/group/jquery-en/browse_frm/thread/3f6c8b8e20627861
I think
if ( window.JSON && window.JSON.parse ) {
data = window.JSON.parse( data );
} else {
data = window["eval"]("(" + data + ")");
}
is better than
if ( window.JSON && window.JSON.parse ) {
data = window.JSON.parse( data );
} else {
data = (new Function("return " + data))();
}
because "new Function()" is not allow after page loaded.
from AIR doc) :
Function constructor Calls to new Function(param, body) can be replaced with an inline function declaration or used only before the page load event has been handled.
Change History
comment:2 Changed 3 years ago by addyosmani
- Keywords adobe air function load added
- Priority changed from major to low
- Status changed from new to closed
- Resolution set to invalid
Closing as AIR users have a common workaround specifically mentioned in their docs for this. Also there has been no response from the original submitter to questions asked in this ticket 9 months ago (and we've had two releases since). Please feel free to re-open if further information is available or the releases we rolled out do not fix this issue.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Instead of giving up on new Function perhaps we could just have AIR users define window.JSON? Or define our own jQuery.JSON and use that if window.JSON isn't there, with a default implementation using new Function. Is there a way to feature-detect AIR?