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

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

Issue 1483733002: Remove support for NPObjects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 months 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 26 matching lines...) Expand all
37 #include "core/fetch/AccessControlStatus.h" 37 #include "core/fetch/AccessControlStatus.h"
38 #include "core/fetch/CrossOriginAccessControl.h" 38 #include "core/fetch/CrossOriginAccessControl.h"
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 struct NPObject;
48
49 namespace blink { 47 namespace blink {
50 48
51 class DOMWrapperWorld; 49 class DOMWrapperWorld;
52 class ExecutionContext; 50 class ExecutionContext;
53 class HTMLDocument; 51 class HTMLDocument;
54 class HTMLPlugInElement; 52 class HTMLPlugInElement;
55 class KURL; 53 class KURL;
56 class ScriptState; 54 class ScriptState;
57 class ScriptSourceCode; 55 class ScriptSourceCode;
58 class SecurityOrigin; 56 class SecurityOrigin;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 bool executeScriptIfJavaScriptURL(const KURL&); 106 bool executeScriptIfJavaScriptURL(const KURL&);
109 107
110 v8::MaybeLocal<v8::Value> callFunction(v8::Local<v8::Function>, v8::Local<v8 ::Value>, int argc, v8::Local<v8::Value> argv[]); 108 v8::MaybeLocal<v8::Value> callFunction(v8::Local<v8::Function>, v8::Local<v8 ::Value>, int argc, v8::Local<v8::Value> argv[]);
111 static v8::MaybeLocal<v8::Value> callFunction(ExecutionContext*, v8::Local<v 8::Function>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info [], v8::Isolate*); 109 static v8::MaybeLocal<v8::Value> callFunction(ExecutionContext*, v8::Local<v 8::Function>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info [], v8::Isolate*);
112 110
113 // Returns true if the current world is isolated, and has its own Content 111 // Returns true if the current world is isolated, and has its own Content
114 // Security Policy. In this case, the policy of the main world should be 112 // Security Policy. In this case, the policy of the main world should be
115 // ignored when evaluating resources injected into the DOM. 113 // ignored when evaluating resources injected into the DOM.
116 bool shouldBypassMainWorldCSP(); 114 bool shouldBypassMainWorldCSP();
117 115
118 // Creates a property of the global object of a frame.
119 bool bindToWindowObject(LocalFrame*, const String& key, NPObject*);
120
121 PassRefPtr<SharedPersistent<v8::Object>> createPluginWrapper(Widget*); 116 PassRefPtr<SharedPersistent<v8::Object>> createPluginWrapper(Widget*);
122 117
123 void enableEval(); 118 void enableEval();
124 void disableEval(const String& errorMessage); 119 void disableEval(const String& errorMessage);
125 120
126 static bool canAccessFromCurrentOrigin(v8::Isolate*, Frame*); 121 static bool canAccessFromCurrentOrigin(v8::Isolate*, Frame*);
127 122
128 static void setCaptureCallStackForUncaughtExceptions(v8::Isolate*, bool); 123 static void setCaptureCallStackForUncaughtExceptions(v8::Isolate*, bool);
129 void collectIsolatedContexts(Vector<std::pair<ScriptState*, SecurityOrigin*> >&); 124 void collectIsolatedContexts(Vector<std::pair<ScriptState*, SecurityOrigin*> >&);
130 125
131 bool canExecuteScripts(ReasonForCallingCanExecuteScripts); 126 bool canExecuteScripts(ReasonForCallingCanExecuteScripts);
132 127
133 TextPosition eventHandlerPosition() const; 128 TextPosition eventHandlerPosition() const;
134 129
135 void clearWindowProxy(); 130 void clearWindowProxy();
136 void updateDocument(); 131 void updateDocument();
137 132
138 void namedItemAdded(HTMLDocument*, const AtomicString&); 133 void namedItemAdded(HTMLDocument*, const AtomicString&);
139 void namedItemRemoved(HTMLDocument*, const AtomicString&); 134 void namedItemRemoved(HTMLDocument*, const AtomicString&);
140 135
141 void updateSecurityOrigin(SecurityOrigin*); 136 void updateSecurityOrigin(SecurityOrigin*);
142 void clearScriptObjects();
143 void cleanupScriptObjectsForPlugin(Widget*);
144 137
145 void clearForClose(); 138 void clearForClose();
146 139
147 NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*);
148 NPObject* windowScriptNPObject();
149
150 // Registers a v8 extension to be available on webpages. Will only 140 // Registers a v8 extension to be available on webpages. Will only
151 // affect v8 contexts initialized after this call. Takes ownership of 141 // affect v8 contexts initialized after this call. Takes ownership of
152 // the v8::Extension object passed. 142 // the v8::Extension object passed.
153 static void registerExtensionIfNeeded(v8::Extension*); 143 static void registerExtensionIfNeeded(v8::Extension*);
154 static V8Extensions& registeredExtensions(); 144 static V8Extensions& registeredExtensions();
155 145
156 v8::Isolate* isolate() const { return m_windowProxyManager->isolate(); } 146 v8::Isolate* isolate() const { return m_windowProxyManager->isolate(); }
157 147
158 WindowProxyManager* getWindowProxyManager() const { return m_windowProxyMana ger.get(); } 148 WindowProxyManager* getWindowProxyManager() const { return m_windowProxyMana ger.get(); }
159 149
160 private: 150 private:
161 explicit ScriptController(LocalFrame*); 151 explicit ScriptController(LocalFrame*);
162 152
163 LocalFrame* frame() const { return toLocalFrame(m_windowProxyManager->frame( )); } 153 LocalFrame* frame() const { return toLocalFrame(m_windowProxyManager->frame( )); }
164 154
165 typedef WillBeHeapHashMap<RawPtrWillBeMember<Widget>, NPObject*> PluginObjec tMap;
166
167 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, Acce ssControlStatus, ExecuteScriptPolicy, double* compilationFinishTime = 0); 155 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, Acce ssControlStatus, ExecuteScriptPolicy, double* compilationFinishTime = 0);
168 156
169 OwnPtrWillBeMember<WindowProxyManager> m_windowProxyManager; 157 OwnPtrWillBeMember<WindowProxyManager> m_windowProxyManager;
170 const String* m_sourceURL; 158 const String* m_sourceURL;
171
172 // A mapping between Widgets and their corresponding script object.
173 // This list is used so that when the plugin dies, we can immediately
174 // invalidate all sub-objects which are associated with that plugin.
175 // The frame keeps a NPObject reference for each item on the list.
176 PluginObjectMap m_pluginObjects;
177
178 NPObject* m_windowScriptNPObject;
179 }; 159 };
180 160
181 } // namespace blink 161 } // namespace blink
182 162
183 #endif // ScriptController_h 163 #endif // ScriptController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698