Bug Tracker

Opened 10 years ago

Closed 9 years ago

#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:
Blocked by: Blocking:

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 (2)

comment:1 Changed 10 years ago by dmethvin

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?

comment:2 Changed 9 years ago by addyosmani

Keywords: adobe air function load added
Priority: majorlow
Resolution: invalid
Status: newclosed

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.

Note: See TracTickets for help on using tickets.