2 * Copyright (C) 2007 Pekka Lampila <pekka.lampila@iki.fi>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
24 #include "swfdec_as_internal.h"
25 #include "swfdec_debug.h"
26 #include "swfdec_as_strings.h"
27 #include "swfdec_resource.h"
28 #include "swfdec_player_internal.h"
29 #include "swfdec_policy_file.h"
32 SWFDEC_AS_NATIVE (12, 0, swfdec_system_security_allowDomain
)
34 swfdec_system_security_allowDomain (SwfdecAsContext
*cx
,
35 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
38 SWFDEC_STUB ("System.security.allowDomain (static)");
41 SWFDEC_AS_NATIVE (12, 1, swfdec_system_security_allowInsecureDomain
)
43 swfdec_system_security_allowInsecureDomain (SwfdecAsContext
*cx
,
44 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
47 SWFDEC_STUB ("System.security.allowInsecureDomain (static)");
51 swfdec_system_security_do_loadPolicyFile (gpointer url
, gpointer player
)
53 swfdec_policy_file_new (player
, url
);
56 SWFDEC_AS_NATIVE (12, 2, swfdec_system_security_loadPolicyFile
)
58 swfdec_system_security_loadPolicyFile (SwfdecAsContext
*cx
,
59 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
63 const char *url_string
;
66 SWFDEC_AS_CHECK (0, NULL
, "s", &url_string
);
68 player
= SWFDEC_PLAYER (cx
);
69 url
= swfdec_player_create_url (player
, url_string
);
70 swfdec_player_request_resource (player
, swfdec_system_security_do_loadPolicyFile
,
71 url
, (GDestroyNotify
) swfdec_url_free
);
74 SWFDEC_AS_NATIVE (12, 3, swfdec_system_security_chooseLocalSwfPath
)
76 swfdec_system_security_chooseLocalSwfPath (SwfdecAsContext
*cx
,
77 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
80 SWFDEC_STUB ("System.security.chooseLocalSwfPath (static)");
83 SWFDEC_AS_NATIVE (12, 4, swfdec_system_security_escapeDomain
)
85 swfdec_system_security_escapeDomain (SwfdecAsContext
*cx
,
86 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
89 SWFDEC_STUB ("System.security.escapeDomain (static)");
92 SWFDEC_AS_NATIVE (12, 5, swfdec_system_security_get_sandboxType
)
94 swfdec_system_security_get_sandboxType (SwfdecAsContext
*cx
,
95 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
98 switch (SWFDEC_SANDBOX (cx
->global
)->type
) {
99 case SWFDEC_SANDBOX_REMOTE
:
100 SWFDEC_AS_VALUE_SET_STRING (ret
, SWFDEC_AS_STR_remote
);
103 case SWFDEC_SANDBOX_LOCAL_FILE
:
104 SWFDEC_AS_VALUE_SET_STRING (ret
, SWFDEC_AS_STR_localWithFile
);
107 case SWFDEC_SANDBOX_LOCAL_NETWORK
:
108 SWFDEC_AS_VALUE_SET_STRING (ret
, SWFDEC_AS_STR_localWithNetwork
);
111 case SWFDEC_SANDBOX_LOCAL_TRUSTED
:
112 SWFDEC_AS_VALUE_SET_STRING (ret
, SWFDEC_AS_STR_localTrusted
);
115 case SWFDEC_SANDBOX_NONE
:
117 g_return_if_reached ();
121 SWFDEC_AS_NATIVE (12, 6, swfdec_system_security_set_sandboxType
)
123 swfdec_system_security_set_sandboxType (SwfdecAsContext
*cx
,
124 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
130 // PolicyFileResolver
132 SWFDEC_AS_NATIVE (15, 0, swfdec_system_security_policy_file_resolver_resolve
)
134 swfdec_system_security_policy_file_resolver_resolve (SwfdecAsContext
*cx
,
135 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
138 SWFDEC_STUB ("System.security.PolicyFileResolver.resolve");