| OLD | NEW |
| 1 // Copyright 2008, Google Inc. | 1 // Copyright 2008, Google Inc. |
| 2 // All rights reserved. | 2 // 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // Check whether it is safe to access a frame in another domain. | 204 // Check whether it is safe to access a frame in another domain. |
| 205 static bool isSafeScript(Frame* target); | 205 static bool isSafeScript(Frame* target); |
| 206 | 206 |
| 207 // Pass command-line flags to the JS engine | 207 // Pass command-line flags to the JS engine |
| 208 static void setFlags(const char* str, int length); | 208 static void setFlags(const char* str, int length); |
| 209 | 209 |
| 210 // Protect and unprotect the JS wrapper from garbage collected. | 210 // Protect and unprotect the JS wrapper from garbage collected. |
| 211 static void gcProtectJSWrapper(void* object); | 211 static void gcProtectJSWrapper(void* object); |
| 212 static void gcUnprotectJSWrapper(void* object); | 212 static void gcUnprotectJSWrapper(void* object); |
| 213 | 213 |
| 214 // Get/Set RecordPlaybackMode flag. | |
| 215 // This is a special mode where JS helps the browser implement | |
| 216 // playback/record mode. Generally, in this mode, some functions | |
| 217 // of client-side randomness are removed. For example, in | |
| 218 // this mode Math.random() and Date.getTime() may not return | |
| 219 // values which vary. | |
| 220 static bool RecordPlaybackMode() { return m_recordPlaybackMode; } | |
| 221 static void setRecordPlaybackMode(bool value) { m_recordPlaybackMode = value
; } | |
| 222 | |
| 223 // Set/Get ShouldExposeGCController flag. | |
| 224 // Some WebKit layout test need window.GCController.collect() to | |
| 225 // trigger GC, this flag lets the binding code expose | |
| 226 // window.GCController.collect() to the JavaScript code. | |
| 227 // | |
| 228 // GCController.collect() needs V8 engine expose gc() function by passing | |
| 229 // '--expose-gc' flag to the engine. | |
| 230 static bool shouldExposeGCController() { | |
| 231 return m_shouldExposeGCController; | |
| 232 } | |
| 233 static void setShouldExposeGCController(bool value) { | |
| 234 m_shouldExposeGCController = value; | |
| 235 } | |
| 236 | |
| 237 void finishedWithEvent(Event*); | 214 void finishedWithEvent(Event*); |
| 238 void setEventHandlerLineno(int lineno); | 215 void setEventHandlerLineno(int lineno); |
| 239 | 216 |
| 240 void setProcessingTimerCallback(bool b) { m_processingTimerCallback = b; } | 217 void setProcessingTimerCallback(bool b) { m_processingTimerCallback = b; } |
| 241 bool processingUserGesture() const; | 218 bool processingUserGesture() const; |
| 242 | 219 |
| 243 void setPaused(bool b) { m_paused = b; } | 220 void setPaused(bool b) { m_paused = b; } |
| 244 bool isPaused() const { return m_paused; } | 221 bool isPaused() const { return m_paused; } |
| 245 | 222 |
| 246 const String* sourceURL() const { return m_sourceURL; } // 0 if we are not e
valuating any script | 223 const String* sourceURL() const { return m_sourceURL; } // 0 if we are not e
valuating any script |
| 247 | 224 |
| 248 void clearWindowShell(); | 225 void clearWindowShell(); |
| 249 void updateDocument(); | 226 void updateDocument(); |
| 250 | 227 |
| 251 void updateSecurityOrigin(); | 228 void updateSecurityOrigin(); |
| 252 void clearScriptObjects(); | 229 void clearScriptObjects(); |
| 253 void updatePlatformScriptObjects(); | 230 void updatePlatformScriptObjects(); |
| 254 void cleanupScriptObjectsForPlugin(void*); | 231 void cleanupScriptObjectsForPlugin(void*); |
| 255 | 232 |
| 256 #if ENABLE(NETSCAPE_PLUGIN_API) | 233 #if ENABLE(NETSCAPE_PLUGIN_API) |
| 257 NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*); | 234 NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*); |
| 258 NPObject* windowScriptNPObject(); | 235 NPObject* windowScriptNPObject(); |
| 259 #endif | 236 #endif |
| 260 | 237 |
| 261 private: | 238 private: |
| 262 static bool m_recordPlaybackMode; | |
| 263 static bool m_shouldExposeGCController; | |
| 264 | |
| 265 Frame* m_frame; | 239 Frame* m_frame; |
| 266 const String* m_sourceURL; | 240 const String* m_sourceURL; |
| 267 | 241 |
| 268 bool m_processingTimerCallback; | 242 bool m_processingTimerCallback; |
| 269 bool m_paused; | 243 bool m_paused; |
| 270 | 244 |
| 271 OwnPtr<V8Proxy> m_proxy; | 245 OwnPtr<V8Proxy> m_proxy; |
| 272 typedef HashMap<void*, NPObject*> PluginObjectMap; | 246 typedef HashMap<void*, NPObject*> PluginObjectMap; |
| 273 | 247 |
| 274 // A mapping between Widgets and their corresponding script object. | 248 // A mapping between Widgets and their corresponding script object. |
| 275 // This list is used so that when the plugin dies, we can immediately | 249 // This list is used so that when the plugin dies, we can immediately |
| 276 // invalidate all sub-objects which are associated with that plugin. | 250 // invalidate all sub-objects which are associated with that plugin. |
| 277 // The frame keeps a NPObject reference for each item on the list. | 251 // The frame keeps a NPObject reference for each item on the list. |
| 278 PluginObjectMap m_pluginObjects; | 252 PluginObjectMap m_pluginObjects; |
| 279 #if ENABLE(NETSCAPE_PLUGIN_API) | 253 #if ENABLE(NETSCAPE_PLUGIN_API) |
| 280 NPObject* m_windowScriptNPObject; | 254 NPObject* m_windowScriptNPObject; |
| 281 #endif | 255 #endif |
| 282 }; | 256 }; |
| 283 | 257 |
| 284 } // namespace WebCore | 258 } // namespace WebCore |
| 285 | 259 |
| 286 #endif // ScriptController_h | 260 #endif // ScriptController_h |
| OLD | NEW |