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 29 matching lines...) Expand all Loading... |
40 #include "platform/loader/fetch/AccessControlStatus.h" | 40 #include "platform/loader/fetch/AccessControlStatus.h" |
41 #include "platform/loader/fetch/CrossOriginAccessControl.h" | 41 #include "platform/loader/fetch/CrossOriginAccessControl.h" |
42 #include "v8/include/v8.h" | 42 #include "v8/include/v8.h" |
43 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
44 #include "wtf/Noncopyable.h" | 44 #include "wtf/Noncopyable.h" |
45 #include "wtf/Vector.h" | 45 #include "wtf/Vector.h" |
46 #include "wtf/text/TextPosition.h" | 46 #include "wtf/text/TextPosition.h" |
47 | 47 |
48 namespace blink { | 48 namespace blink { |
49 | 49 |
| 50 class CompiledScript; |
50 class DOMWrapperWorld; | 51 class DOMWrapperWorld; |
51 class Element; | 52 class Element; |
52 class FrameViewBase; | 53 class FrameViewBase; |
53 class KURL; | 54 class KURL; |
54 class ScriptSourceCode; | 55 class ScriptSourceCode; |
55 class SecurityOrigin; | 56 class SecurityOrigin; |
56 | 57 |
57 typedef WTF::Vector<v8::Extension*> V8Extensions; | 58 typedef WTF::Vector<v8::Extension*> V8Extensions; |
58 | 59 |
59 | 60 |
(...skipping 24 matching lines...) Expand all Loading... |
84 void executeScriptInMainWorld(const ScriptSourceCode&, | 85 void executeScriptInMainWorld(const ScriptSourceCode&, |
85 AccessControlStatus = NotSharableCrossOrigin); | 86 AccessControlStatus = NotSharableCrossOrigin); |
86 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue( | 87 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue( |
87 const ScriptSourceCode&, | 88 const ScriptSourceCode&, |
88 ExecuteScriptPolicy = DoNotExecuteScriptWhenScriptsDisabled); | 89 ExecuteScriptPolicy = DoNotExecuteScriptWhenScriptsDisabled); |
89 v8::Local<v8::Value> executeScriptAndReturnValue( | 90 v8::Local<v8::Value> executeScriptAndReturnValue( |
90 v8::Local<v8::Context>, | 91 v8::Local<v8::Context>, |
91 const ScriptSourceCode&, | 92 const ScriptSourceCode&, |
92 AccessControlStatus = NotSharableCrossOrigin); | 93 AccessControlStatus = NotSharableCrossOrigin); |
93 | 94 |
| 95 // The same, but separated into two phases. |
| 96 // compileScriptInMainWorld may return nullptr. |
| 97 CompiledScript* compileScriptInMainWorld(const ScriptSourceCode&, |
| 98 AccessControlStatus); |
| 99 void executeScriptInMainWorld(const CompiledScript&); |
| 100 |
94 // Executes JavaScript in an isolated world. The script gets its own global | 101 // Executes JavaScript in an isolated world. The script gets its own global |
95 // scope, its own prototypes for intrinsic JavaScript objects (String, Array, | 102 // scope, its own prototypes for intrinsic JavaScript objects (String, Array, |
96 // and so-on), and its own wrappers for all DOM nodes and DOM constructors. | 103 // and so-on), and its own wrappers for all DOM nodes and DOM constructors. |
97 // | 104 // |
98 // If an isolated world with the specified ID already exists, it is reused. | 105 // If an isolated world with the specified ID already exists, it is reused. |
99 // Otherwise, a new world is created. | 106 // Otherwise, a new world is created. |
100 // | 107 // |
101 // FIXME: We don't want to support multiple scripts. | 108 // FIXME: We don't want to support multiple scripts. |
102 void executeScriptInIsolatedWorld(int worldID, | 109 void executeScriptInIsolatedWorld(int worldID, |
103 const HeapVector<ScriptSourceCode>& sources, | 110 const HeapVector<ScriptSourceCode>& sources, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, | 152 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, |
146 AccessControlStatus, | 153 AccessControlStatus, |
147 ExecuteScriptPolicy); | 154 ExecuteScriptPolicy); |
148 | 155 |
149 Member<LocalWindowProxyManager> m_windowProxyManager; | 156 Member<LocalWindowProxyManager> m_windowProxyManager; |
150 }; | 157 }; |
151 | 158 |
152 } // namespace blink | 159 } // namespace blink |
153 | 160 |
154 #endif // ScriptController_h | 161 #endif // ScriptController_h |
OLD | NEW |