OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef ScriptController_h | 31 #ifndef ScriptController_h |
32 #define ScriptController_h | 32 #define ScriptController_h |
33 | 33 |
34 #include "bindings/v8/ScriptInstance.h" | 34 #include "bindings/v8/ScriptInstance.h" |
35 #include "bindings/v8/ScriptValue.h" | 35 #include "bindings/v8/ScriptValue.h" |
36 | 36 |
37 #include <v8.h> | 37 #include "core/loader/CrossOriginAccessControl.h" |
38 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
39 #include "wtf/HashMap.h" | 39 #include "wtf/HashMap.h" |
40 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
42 #include "wtf/text/TextPosition.h" | 42 #include "wtf/text/TextPosition.h" |
| 43 #include <v8.h> |
43 | 44 |
44 struct NPObject; | 45 struct NPObject; |
45 | 46 |
46 namespace WebCore { | 47 namespace WebCore { |
47 | 48 |
48 class DOMWrapperWorld; | 49 class DOMWrapperWorld; |
49 class Event; | 50 class Event; |
50 class Frame; | 51 class Frame; |
51 class HTMLDocument; | 52 class HTMLDocument; |
52 class HTMLPlugInElement; | 53 class HTMLPlugInElement; |
(...skipping 21 matching lines...) Expand all Loading... |
74 ~ScriptController(); | 75 ~ScriptController(); |
75 | 76 |
76 bool initializeMainWorld(); | 77 bool initializeMainWorld(); |
77 V8WindowShell* windowShell(DOMWrapperWorld*); | 78 V8WindowShell* windowShell(DOMWrapperWorld*); |
78 V8WindowShell* existingWindowShell(DOMWrapperWorld*); | 79 V8WindowShell* existingWindowShell(DOMWrapperWorld*); |
79 | 80 |
80 ScriptValue executeScript(const ScriptSourceCode&); | 81 ScriptValue executeScript(const ScriptSourceCode&); |
81 ScriptValue executeScript(const String& script, bool forceUserGesture = fals
e); | 82 ScriptValue executeScript(const String& script, bool forceUserGesture = fals
e); |
82 | 83 |
83 // Evaluate JavaScript in the main world. | 84 // Evaluate JavaScript in the main world. |
84 ScriptValue executeScriptInMainWorld(const ScriptSourceCode&); | 85 ScriptValue executeScriptInMainWorld(const ScriptSourceCode&, AccessControlS
tatus = NotSharableCrossOrigin); |
85 | 86 |
86 // Executes JavaScript in an isolated world. The script gets its own global
scope, | 87 // Executes JavaScript in an isolated world. The script gets its own global
scope, |
87 // its own prototypes for intrinsic JavaScript objects (String, Array, and s
o-on), | 88 // its own prototypes for intrinsic JavaScript objects (String, Array, and s
o-on), |
88 // and its own wrappers for all DOM nodes and DOM constructors. | 89 // and its own wrappers for all DOM nodes and DOM constructors. |
89 // | 90 // |
90 // If an isolated world with the specified ID already exists, it is reused. | 91 // If an isolated world with the specified ID already exists, it is reused. |
91 // Otherwise, a new world is created. | 92 // Otherwise, a new world is created. |
92 // | 93 // |
93 // FIXME: Get rid of extensionGroup here. | 94 // FIXME: Get rid of extensionGroup here. |
94 void executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode
>& sources, int extensionGroup, Vector<ScriptValue>* results); | 95 void executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode
>& sources, int extensionGroup, Vector<ScriptValue>* results); |
95 | 96 |
96 // Returns true if argument is a JavaScript URL. | 97 // Returns true if argument is a JavaScript URL. |
97 bool executeScriptIfJavaScriptURL(const KURL&); | 98 bool executeScriptIfJavaScriptURL(const KURL&); |
98 | 99 |
99 v8::Local<v8::Value> compileAndRunScript(const ScriptSourceCode&); | 100 v8::Local<v8::Value> compileAndRunScript(const ScriptSourceCode&, AccessCont
rolStatus = NotSharableCrossOrigin); |
100 | 101 |
101 v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::O
bject>, int argc, v8::Handle<v8::Value> argv[]); | 102 v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::O
bject>, int argc, v8::Handle<v8::Value> argv[]); |
102 ScriptValue callFunctionEvenIfScriptDisabled(v8::Handle<v8::Function>, v8::H
andle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]); | 103 ScriptValue callFunctionEvenIfScriptDisabled(v8::Handle<v8::Function>, v8::H
andle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]); |
103 static v8::Local<v8::Value> callFunctionWithInstrumentation(ScriptExecutionC
ontext*, v8::Handle<v8::Function>, v8::Handle<v8::Object> receiver, int argc, v8
::Handle<v8::Value> args[]); | 104 static v8::Local<v8::Value> callFunctionWithInstrumentation(ScriptExecutionC
ontext*, v8::Handle<v8::Function>, v8::Handle<v8::Object> receiver, int argc, v8
::Handle<v8::Value> args[]); |
104 | 105 |
105 // Returns true if the current world is isolated, and has its own Content | 106 // Returns true if the current world is isolated, and has its own Content |
106 // Security Policy. In this case, the policy of the main world should be | 107 // Security Policy. In this case, the policy of the main world should be |
107 // ignored when evaluating resources injected into the DOM. | 108 // ignored when evaluating resources injected into the DOM. |
108 bool shouldBypassMainWorldContentSecurityPolicy(); | 109 bool shouldBypassMainWorldContentSecurityPolicy(); |
109 | 110 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // invalidate all sub-objects which are associated with that plugin. | 183 // invalidate all sub-objects which are associated with that plugin. |
183 // The frame keeps a NPObject reference for each item on the list. | 184 // The frame keeps a NPObject reference for each item on the list. |
184 PluginObjectMap m_pluginObjects; | 185 PluginObjectMap m_pluginObjects; |
185 | 186 |
186 NPObject* m_windowScriptNPObject; | 187 NPObject* m_windowScriptNPObject; |
187 }; | 188 }; |
188 | 189 |
189 } // namespace WebCore | 190 } // namespace WebCore |
190 | 191 |
191 #endif // ScriptController_h | 192 #endif // ScriptController_h |
OLD | NEW |