Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptController.h

Issue 2564903002: ScriptController: Expose methods to compile a script and execute a compiled script. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 28 matching lines...) Expand all
39 #include "core/frame/LocalFrame.h" 39 #include "core/frame/LocalFrame.h"
40 #include "platform/heap/Handle.h" 40 #include "platform/heap/Handle.h"
41 #include "wtf/HashMap.h" 41 #include "wtf/HashMap.h"
42 #include "wtf/Noncopyable.h" 42 #include "wtf/Noncopyable.h"
43 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
44 #include "wtf/text/TextPosition.h" 44 #include "wtf/text/TextPosition.h"
45 #include <v8.h> 45 #include <v8.h>
46 46
47 namespace blink { 47 namespace blink {
48 48
49 class CompiledScript;
49 class DOMWrapperWorld; 50 class DOMWrapperWorld;
50 class Element; 51 class Element;
51 class HTMLDocument; 52 class HTMLDocument;
52 class KURL; 53 class KURL;
53 class ScriptSourceCode; 54 class ScriptSourceCode;
54 class SecurityOrigin; 55 class SecurityOrigin;
55 class WindowProxy; 56 class WindowProxy;
56 class Widget; 57 class Widget;
57 58
58 typedef WTF::Vector<v8::Extension*> V8Extensions; 59 typedef WTF::Vector<v8::Extension*> V8Extensions;
(...skipping 30 matching lines...) Expand all
89 void executeScriptInMainWorld(const ScriptSourceCode&, 90 void executeScriptInMainWorld(const ScriptSourceCode&,
90 AccessControlStatus = NotSharableCrossOrigin); 91 AccessControlStatus = NotSharableCrossOrigin);
91 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue( 92 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue(
92 const ScriptSourceCode&, 93 const ScriptSourceCode&,
93 ExecuteScriptPolicy = DoNotExecuteScriptWhenScriptsDisabled); 94 ExecuteScriptPolicy = DoNotExecuteScriptWhenScriptsDisabled);
94 v8::Local<v8::Value> executeScriptAndReturnValue( 95 v8::Local<v8::Value> executeScriptAndReturnValue(
95 v8::Local<v8::Context>, 96 v8::Local<v8::Context>,
96 const ScriptSourceCode&, 97 const ScriptSourceCode&,
97 AccessControlStatus = NotSharableCrossOrigin); 98 AccessControlStatus = NotSharableCrossOrigin);
98 99
100 // The same, but separated into two phases.
101 // compileScriptInMainWorld may return nullptr.
102 CompiledScript* compileScriptInMainWorld(const ScriptSourceCode&,
103 AccessControlStatus);
104 void executeScriptInMainWorld(const CompiledScript&);
105
99 // Executes JavaScript in an isolated world. The script gets its own global 106 // Executes JavaScript in an isolated world. The script gets its own global
100 // scope, its own prototypes for intrinsic JavaScript objects (String, Array, 107 // scope, its own prototypes for intrinsic JavaScript objects (String, Array,
101 // and so-on), and its own wrappers for all DOM nodes and DOM constructors. 108 // and so-on), and its own wrappers for all DOM nodes and DOM constructors.
102 // 109 //
103 // If an isolated world with the specified ID already exists, it is reused. 110 // If an isolated world with the specified ID already exists, it is reused.
104 // Otherwise, a new world is created. 111 // Otherwise, a new world is created.
105 // 112 //
106 // FIXME: Get rid of extensionGroup here. 113 // FIXME: Get rid of extensionGroup here.
107 // FIXME: We don't want to support multiple scripts. 114 // FIXME: We don't want to support multiple scripts.
108 void executeScriptInIsolatedWorld(int worldID, 115 void executeScriptInIsolatedWorld(int worldID,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, 166 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&,
160 AccessControlStatus, 167 AccessControlStatus,
161 ExecuteScriptPolicy); 168 ExecuteScriptPolicy);
162 169
163 Member<WindowProxyManager> m_windowProxyManager; 170 Member<WindowProxyManager> m_windowProxyManager;
164 }; 171 };
165 172
166 } // namespace blink 173 } // namespace blink
167 174
168 #endif // ScriptController_h 175 #endif // ScriptController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698