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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 class DOMWrapperWorld; | 49 class DOMWrapperWorld; |
50 class ExecutionContext; | 50 class ExecutionContext; |
51 class Event; | 51 class Event; |
52 class HTMLDocument; | 52 class HTMLDocument; |
53 class HTMLPlugInElement; | 53 class HTMLPlugInElement; |
54 class KURL; | 54 class KURL; |
55 class LocalFrame; | 55 class LocalFrame; |
56 class ScriptState; | 56 class ScriptState; |
57 class ScriptSourceCode; | 57 class ScriptSourceCode; |
58 class SecurityOrigin; | 58 class SecurityOrigin; |
59 class V8WindowShell; | 59 class WindowProxy; |
60 class Widget; | 60 class Widget; |
61 | 61 |
62 typedef WTF::Vector<v8::Extension*> V8Extensions; | 62 typedef WTF::Vector<v8::Extension*> V8Extensions; |
63 | 63 |
64 enum ReasonForCallingCanExecuteScripts { | 64 enum ReasonForCallingCanExecuteScripts { |
65 AboutToExecuteScript, | 65 AboutToExecuteScript, |
66 NotAboutToExecuteScript | 66 NotAboutToExecuteScript |
67 }; | 67 }; |
68 | 68 |
69 class ScriptController { | 69 class ScriptController { |
70 public: | 70 public: |
71 enum ExecuteScriptPolicy { | 71 enum ExecuteScriptPolicy { |
72 ExecuteScriptWhenScriptsDisabled, | 72 ExecuteScriptWhenScriptsDisabled, |
73 DoNotExecuteScriptWhenScriptsDisabled | 73 DoNotExecuteScriptWhenScriptsDisabled |
74 }; | 74 }; |
75 | 75 |
76 ScriptController(LocalFrame*); | 76 ScriptController(LocalFrame*); |
77 ~ScriptController(); | 77 ~ScriptController(); |
78 | 78 |
79 bool initializeMainWorld(); | 79 bool initializeMainWorld(); |
80 V8WindowShell* windowShell(DOMWrapperWorld&); | 80 WindowProxy* windowShell(DOMWrapperWorld&); |
81 V8WindowShell* existingWindowShell(DOMWrapperWorld&); | 81 WindowProxy* 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 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue(const ScriptSour ceCode&); | 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. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 // affect v8 contexts initialized after this call. Takes ownership of | 143 // affect v8 contexts initialized after this call. Takes ownership of |
144 // the v8::Extension object passed. | 144 // the v8::Extension object passed. |
145 static void registerExtensionIfNeeded(v8::Extension*); | 145 static void registerExtensionIfNeeded(v8::Extension*); |
146 static V8Extensions& registeredExtensions(); | 146 static V8Extensions& registeredExtensions(); |
147 | 147 |
148 void setWorldDebugId(int worldId, int debuggerId); | 148 void setWorldDebugId(int worldId, int debuggerId); |
149 | 149 |
150 v8::Isolate* isolate() const { return m_isolate; } | 150 v8::Isolate* isolate() const { return m_isolate; } |
151 | 151 |
152 private: | 152 private: |
153 typedef HashMap<int, OwnPtr<V8WindowShell> > IsolatedWorldMap; | 153 typedef HashMap<int, OwnPtr<WindowProxy> > IsolatedWorldMap; |
154 typedef HashMap<Widget*, NPObject*> PluginObjectMap; | 154 typedef HashMap<Widget*, NPObject*> PluginObjectMap; |
155 | 155 |
156 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, Acce ssControlStatus, ExecuteScriptPolicy); | 156 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, Acce ssControlStatus, ExecuteScriptPolicy); |
157 | 157 |
158 LocalFrame* m_frame; | 158 LocalFrame* m_frame; |
159 const String* m_sourceURL; | 159 const String* m_sourceURL; |
160 v8::Isolate* m_isolate; | 160 v8::Isolate* m_isolate; |
161 | 161 |
162 OwnPtr<V8WindowShell> m_windowShell; | 162 OwnPtr<WindowProxy> m_windowShell; |
jochen (gone - plz use gerrit)
2014/08/11 14:27:31
same here
| |
163 IsolatedWorldMap m_isolatedWorlds; | 163 IsolatedWorldMap m_isolatedWorlds; |
164 | 164 |
165 // A mapping between Widgets and their corresponding script object. | 165 // A mapping between Widgets and their corresponding script object. |
166 // This list is used so that when the plugin dies, we can immediately | 166 // This list is used so that when the plugin dies, we can immediately |
167 // invalidate all sub-objects which are associated with that plugin. | 167 // invalidate all sub-objects which are associated with that plugin. |
168 // The frame keeps a NPObject reference for each item on the list. | 168 // The frame keeps a NPObject reference for each item on the list. |
169 PluginObjectMap m_pluginObjects; | 169 PluginObjectMap m_pluginObjects; |
170 | 170 |
171 NPObject* m_windowScriptNPObject; | 171 NPObject* m_windowScriptNPObject; |
172 }; | 172 }; |
173 | 173 |
174 } // namespace blink | 174 } // namespace blink |
175 | 175 |
176 #endif // ScriptController_h | 176 #endif // ScriptController_h |
OLD | NEW |