| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 WindowProxy* existingWindowProxy(DOMWrapperWorld&); | 66 WindowProxy* existingWindowProxy(DOMWrapperWorld&); |
| 67 | 67 |
| 68 // Evaluate JavaScript in the main world. | 68 // Evaluate JavaScript in the main world. |
| 69 void executeScriptInMainWorld(const String&); | 69 void executeScriptInMainWorld(const String&); |
| 70 void executeScriptInMainWorld(const ScriptSourceCode&); | 70 void executeScriptInMainWorld(const ScriptSourceCode&); |
| 71 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue(const ScriptSour
ceCode&); | 71 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue(const ScriptSour
ceCode&); |
| 72 v8::Local<v8::Value> executeScriptAndReturnValue(v8::Handle<v8::Context>, co
nst ScriptSourceCode&); | 72 v8::Local<v8::Value> executeScriptAndReturnValue(v8::Handle<v8::Context>, co
nst ScriptSourceCode&); |
| 73 | 73 |
| 74 void executeModuleScript(AbstractModule&, const String& source, const TextPo
sition& textPosition); | 74 void executeModuleScript(AbstractModule&, const String& source, const TextPo
sition& textPosition); |
| 75 | 75 |
| 76 // Executes JavaScript in an isolated world. The script gets its own global
scope, | |
| 77 // its own prototypes for intrinsic JavaScript objects (String, Array, and s
o-on), | |
| 78 // and its own wrappers for all DOM nodes and DOM constructors. | |
| 79 // | |
| 80 // If an isolated world with the specified ID already exists, it is reused. | |
| 81 // Otherwise, a new world is created. | |
| 82 // | |
| 83 // FIXME: Get rid of extensionGroup here. | |
| 84 void executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode
>& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* results); | |
| 85 | |
| 86 v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::V
alue>, int argc, v8::Handle<v8::Value> argv[]); | 76 v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::V
alue>, int argc, v8::Handle<v8::Value> argv[]); |
| 87 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*); | 77 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*); |
| 88 | 78 |
| 89 static bool canAccessFromCurrentOrigin(LocalFrame*); | 79 static bool canAccessFromCurrentOrigin(LocalFrame*); |
| 90 | 80 |
| 91 static void setCaptureCallStackForUncaughtExceptions(bool); | 81 static void setCaptureCallStackForUncaughtExceptions(bool); |
| 92 | 82 |
| 93 void clearWindowProxy(); | 83 void clearWindowProxy(); |
| 94 void updateDocument(); | 84 void updateDocument(); |
| 95 | 85 |
| 96 void clearForClose(); | 86 void clearForClose(); |
| 97 | 87 |
| 98 // Registers a v8 extension to be available on webpages. Will only | 88 // Registers a v8 extension to be available on webpages. Will only |
| 99 // affect v8 contexts initialized after this call. Takes ownership of | 89 // affect v8 contexts initialized after this call. Takes ownership of |
| 100 // the v8::Extension object passed. | 90 // the v8::Extension object passed. |
| 101 static void registerExtensionIfNeeded(v8::Extension*); | 91 static void registerExtensionIfNeeded(v8::Extension*); |
| 102 static V8Extensions& registeredExtensions(); | 92 static V8Extensions& registeredExtensions(); |
| 103 | 93 |
| 104 void setWorldDebugId(int worldId, int debuggerId); | 94 void setWorldDebugId(int debuggerId); |
| 105 | 95 |
| 106 v8::Isolate* isolate() const { return m_isolate; } | 96 v8::Isolate* isolate() const { return m_isolate; } |
| 107 | 97 |
| 108 private: | 98 private: |
| 109 typedef HashMap<int, OwnPtr<WindowProxy> > IsolatedWorldMap; | 99 typedef HashMap<int, OwnPtr<WindowProxy> > IsolatedWorldMap; |
| 110 | 100 |
| 111 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&); | 101 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&); |
| 112 | 102 |
| 113 LocalFrame* m_frame; | 103 LocalFrame* m_frame; |
| 114 const String* m_sourceURL; | 104 const String* m_sourceURL; |
| 115 v8::Isolate* m_isolate; | 105 v8::Isolate* m_isolate; |
| 116 | 106 |
| 117 OwnPtr<WindowProxy> m_windowProxy; | 107 OwnPtr<WindowProxy> m_windowProxy; |
| 118 IsolatedWorldMap m_isolatedWorlds; | 108 IsolatedWorldMap m_isolatedWorlds; |
| 119 }; | 109 }; |
| 120 | 110 |
| 121 } // namespace blink | 111 } // namespace blink |
| 122 | 112 |
| 123 #endif // SKY_ENGINE_BINDINGS_CORE_V8_SCRIPTCONTROLLER_H_ | 113 #endif // SKY_ENGINE_BINDINGS_CORE_V8_SCRIPTCONTROLLER_H_ |
| OLD | NEW |