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"
30 #include "swfdec_sandbox.h"
33 SWFDEC_AS_NATIVE (12, 0, swfdec_system_security_allowDomain
)
35 swfdec_system_security_allowDomain (SwfdecAsContext
*cx
,
36 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
39 SWFDEC_STUB ("System.security.allowDomain (static)");
42 SWFDEC_AS_NATIVE (12, 1, swfdec_system_security_allowInsecureDomain
)
44 swfdec_system_security_allowInsecureDomain (SwfdecAsContext
*cx
,
45 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
48 SWFDEC_STUB ("System.security.allowInsecureDomain (static)");
52 swfdec_system_security_do_loadPolicyFile (gpointer url
, gpointer player
)
54 swfdec_policy_file_new (player
, url
);
57 SWFDEC_AS_NATIVE (12, 2, swfdec_system_security_loadPolicyFile
)
59 swfdec_system_security_loadPolicyFile (SwfdecAsContext
*cx
,
60 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
64 const char *url_string
;
67 SWFDEC_AS_CHECK (0, NULL
, "s", &url_string
);
69 player
= SWFDEC_PLAYER (cx
);
70 url
= swfdec_player_create_url (player
, url_string
);
71 swfdec_player_request_resource (player
, swfdec_system_security_do_loadPolicyFile
,
72 url
, (GDestroyNotify
) swfdec_url_free
);
75 SWFDEC_AS_NATIVE (12, 3, swfdec_system_security_chooseLocalSwfPath
)
77 swfdec_system_security_chooseLocalSwfPath (SwfdecAsContext
*cx
,
78 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
81 SWFDEC_STUB ("System.security.chooseLocalSwfPath (static)");
84 SWFDEC_AS_NATIVE (12, 4, swfdec_system_security_escapeDomain
)
86 swfdec_system_security_escapeDomain (SwfdecAsContext
*cx
,
87 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
90 SWFDEC_STUB ("System.security.escapeDomain (static)");
93 SWFDEC_AS_NATIVE (12, 5, swfdec_system_security_get_sandboxType
)
95 swfdec_system_security_get_sandboxType (SwfdecAsContext
*cx
,
96 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
99 switch (swfdec_sandbox_get (SWFDEC_PLAYER (cx
))->type
) {
100 case SWFDEC_SANDBOX_REMOTE
:
101 SWFDEC_AS_VALUE_SET_STRING (ret
, SWFDEC_AS_STR_remote
);
104 case SWFDEC_SANDBOX_LOCAL_FILE
:
105 SWFDEC_AS_VALUE_SET_STRING (ret
, SWFDEC_AS_STR_localWithFile
);
108 case SWFDEC_SANDBOX_LOCAL_NETWORK
:
109 SWFDEC_AS_VALUE_SET_STRING (ret
, SWFDEC_AS_STR_localWithNetwork
);
112 case SWFDEC_SANDBOX_LOCAL_TRUSTED
:
113 SWFDEC_AS_VALUE_SET_STRING (ret
, SWFDEC_AS_STR_localTrusted
);
116 case SWFDEC_SANDBOX_NONE
:
118 g_return_if_reached ();
122 SWFDEC_AS_NATIVE (12, 6, swfdec_system_security_set_sandboxType
)
124 swfdec_system_security_set_sandboxType (SwfdecAsContext
*cx
,
125 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
131 // PolicyFileResolver
133 SWFDEC_AS_NATIVE (15, 0, swfdec_system_security_policy_file_resolver_resolve
)
135 swfdec_system_security_policy_file_resolver_resolve (SwfdecAsContext
*cx
,
136 SwfdecAsObject
*object
, guint argc
, SwfdecAsValue
*argv
,
139 SWFDEC_STUB ("System.security.PolicyFileResolver.resolve");