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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 ScriptController(LocalFrame*); | 76 ScriptController(LocalFrame*); |
77 ~ScriptController(); | 77 ~ScriptController(); |
78 | 78 |
79 bool initializeMainWorld(); | 79 bool initializeMainWorld(); |
80 V8WindowShell* windowShell(DOMWrapperWorld&); | 80 V8WindowShell* windowShell(DOMWrapperWorld&); |
81 V8WindowShell* existingWindowShell(DOMWrapperWorld&); | 81 V8WindowShell* existingWindowShell(DOMWrapperWorld&); |
82 | 82 |
83 // Evaluate JavaScript in the main world. | 83 // Evaluate JavaScript in the main world. |
84 void executeScriptInMainWorld(const String&, ExecuteScriptPolicy = DoNotExec
uteScriptWhenScriptsDisabled); | 84 void executeScriptInMainWorld(const String&, ExecuteScriptPolicy = DoNotExec
uteScriptWhenScriptsDisabled); |
85 void executeScriptInMainWorld(const ScriptSourceCode&, AccessControlStatus =
NotSharableCrossOrigin); | 85 void executeScriptInMainWorld(const ScriptSourceCode&, AccessControlStatus =
NotSharableCrossOrigin); |
86 ScriptValue executeScriptInMainWorldAndReturnValue(const ScriptSourceCode&); | 86 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue(const ScriptSour
ceCode&); |
87 v8::Local<v8::Value> executeScriptAndReturnValue(v8::Handle<v8::Context>, co
nst ScriptSourceCode&, AccessControlStatus = NotSharableCrossOrigin); | 87 v8::Local<v8::Value> executeScriptAndReturnValue(v8::Handle<v8::Context>, co
nst ScriptSourceCode&, AccessControlStatus = NotSharableCrossOrigin); |
88 | 88 |
89 // Executes JavaScript in an isolated world. The script gets its own global
scope, | 89 // Executes JavaScript in an isolated world. The script gets its own global
scope, |
90 // its own prototypes for intrinsic JavaScript objects (String, Array, and s
o-on), | 90 // its own prototypes for intrinsic JavaScript objects (String, Array, and s
o-on), |
91 // and its own wrappers for all DOM nodes and DOM constructors. | 91 // and its own wrappers for all DOM nodes and DOM constructors. |
92 // | 92 // |
93 // If an isolated world with the specified ID already exists, it is reused. | 93 // If an isolated world with the specified ID already exists, it is reused. |
94 // Otherwise, a new world is created. | 94 // Otherwise, a new world is created. |
95 // | 95 // |
96 // FIXME: Get rid of extensionGroup here. | 96 // FIXME: Get rid of extensionGroup here. |
97 void executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode
>& sources, int extensionGroup, Vector<ScriptValue>* results); | 97 void executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode
>& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* results); |
98 | 98 |
99 // Returns true if argument is a JavaScript URL. | 99 // Returns true if argument is a JavaScript URL. |
100 bool executeScriptIfJavaScriptURL(const KURL&); | 100 bool executeScriptIfJavaScriptURL(const KURL&); |
101 | 101 |
102 v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::V
alue>, int argc, v8::Handle<v8::Value> argv[]); | 102 v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::V
alue>, int argc, v8::Handle<v8::Value> argv[]); |
103 static v8::Local<v8::Value> callFunction(ExecutionContext*, v8::Handle<v8::F
unction>, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[]
, v8::Isolate*); | 103 static v8::Local<v8::Value> callFunction(ExecutionContext*, v8::Handle<v8::F
unction>, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[]
, v8::Isolate*); |
104 | 104 |
105 // Returns true if the current world is isolated, and has its own Content | 105 // 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 | 106 // Security Policy. In this case, the policy of the main world should be |
107 // ignored when evaluating resources injected into the DOM. | 107 // ignored when evaluating resources injected into the DOM. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 bool setContextDebugId(int); | 148 bool setContextDebugId(int); |
149 static int contextDebugId(v8::Handle<v8::Context>); | 149 static int contextDebugId(v8::Handle<v8::Context>); |
150 | 150 |
151 v8::Isolate* isolate() const { return m_isolate; } | 151 v8::Isolate* isolate() const { return m_isolate; } |
152 | 152 |
153 private: | 153 private: |
154 typedef HashMap<int, OwnPtr<V8WindowShell> > IsolatedWorldMap; | 154 typedef HashMap<int, OwnPtr<V8WindowShell> > IsolatedWorldMap; |
155 typedef HashMap<Widget*, NPObject*> PluginObjectMap; | 155 typedef HashMap<Widget*, NPObject*> PluginObjectMap; |
156 | 156 |
157 ScriptValue evaluateScriptInMainWorld(const ScriptSourceCode&, AccessControl
Status, ExecuteScriptPolicy); | 157 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, Acce
ssControlStatus, ExecuteScriptPolicy); |
158 | 158 |
159 LocalFrame* m_frame; | 159 LocalFrame* m_frame; |
160 const String* m_sourceURL; | 160 const String* m_sourceURL; |
161 v8::Isolate* m_isolate; | 161 v8::Isolate* m_isolate; |
162 | 162 |
163 OwnPtr<V8WindowShell> m_windowShell; | 163 OwnPtr<V8WindowShell> m_windowShell; |
164 IsolatedWorldMap m_isolatedWorlds; | 164 IsolatedWorldMap m_isolatedWorlds; |
165 | 165 |
166 // A mapping between Widgets and their corresponding script object. | 166 // A mapping between Widgets and their corresponding script object. |
167 // This list is used so that when the plugin dies, we can immediately | 167 // This list is used so that when the plugin dies, we can immediately |
168 // invalidate all sub-objects which are associated with that plugin. | 168 // invalidate all sub-objects which are associated with that plugin. |
169 // The frame keeps a NPObject reference for each item on the list. | 169 // The frame keeps a NPObject reference for each item on the list. |
170 PluginObjectMap m_pluginObjects; | 170 PluginObjectMap m_pluginObjects; |
171 | 171 |
172 NPObject* m_windowScriptNPObject; | 172 NPObject* m_windowScriptNPObject; |
173 }; | 173 }; |
174 | 174 |
175 } // namespace WebCore | 175 } // namespace WebCore |
176 | 176 |
177 #endif // ScriptController_h | 177 #endif // ScriptController_h |
OLD | NEW |