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

Side by Side Diff: Source/bindings/core/v8/PrivateScriptRunner.cpp

Issue 654583003: Use the Document rather than the Frame's execution context to install JS-based marquee elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/core/v8/PrivateScriptRunner.h ('k') | Source/core/html/HTMLMarqueeElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "bindings/core/v8/PrivateScriptRunner.h" 6 #include "bindings/core/v8/PrivateScriptRunner.h"
7 7
8 #include "bindings/core/v8/DOMWrapperWorld.h" 8 #include "bindings/core/v8/DOMWrapperWorld.h"
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
11 #include "bindings/core/v8/V8PerContextData.h" 11 #include "bindings/core/v8/V8PerContextData.h"
12 #include "bindings/core/v8/V8ScriptRunner.h" 12 #include "bindings/core/v8/V8ScriptRunner.h"
13 #include "core/PrivateScriptSources.h" 13 #include "core/PrivateScriptSources.h"
14 #ifndef NDEBUG 14 #ifndef NDEBUG
15 #include "core/PrivateScriptSourcesForTesting.h" 15 #include "core/PrivateScriptSourcesForTesting.h"
16 #endif 16 #endif
17 #include "core/dom/Document.h"
17 #include "core/dom/ExceptionCode.h" 18 #include "core/dom/ExceptionCode.h"
18 #include "platform/PlatformResourceLoader.h" 19 #include "platform/PlatformResourceLoader.h"
19 20
20 namespace blink { 21 namespace blink {
21 22
22 static void dumpV8Message(v8::Handle<v8::Message> message) 23 static void dumpV8Message(v8::Handle<v8::Message> message)
23 { 24 {
24 if (message.IsEmpty()) 25 if (message.IsEmpty())
25 return; 26 return;
26 27
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // to use it with |this.foo|.) 164 // to use it with |this.foo|.)
164 if (classObject->GetPrototype() != holderObject->GetPrototype()) 165 if (classObject->GetPrototype() != holderObject->GetPrototype())
165 classObject->SetPrototype(holderObject->GetPrototype()); 166 classObject->SetPrototype(holderObject->GetPrototype());
166 holderObject->SetPrototype(classObject); 167 holderObject->SetPrototype(classObject);
167 168
168 isInitialized = v8Boolean(true, isolate); 169 isInitialized = v8Boolean(true, isolate);
169 V8HiddenValue::setHiddenValue(isolate, holderObject, V8HiddenValue::priv ateScriptObjectIsInitialized(isolate), isInitialized); 170 V8HiddenValue::setHiddenValue(isolate, holderObject, V8HiddenValue::priv ateScriptObjectIsInitialized(isolate), isInitialized);
170 } 171 }
171 } 172 }
172 173
173 v8::Handle<v8::Value> PrivateScriptRunner::installClassIfNeeded(LocalFrame* fram e, String className) 174 v8::Handle<v8::Value> PrivateScriptRunner::installClassIfNeeded(Document* docume nt, String className)
174 { 175 {
175 if (!frame) 176 v8::HandleScope handleScope(toIsolate(document));
176 return v8::Handle<v8::Value>(); 177 v8::Handle<v8::Context> context = toV8Context(document->contextDocument().ge t(), DOMWrapperWorld::privateScriptIsolatedWorld());
177 v8::HandleScope handleScope(toIsolate(frame));
178 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::privat eScriptIsolatedWorld());
179 if (context.IsEmpty()) 178 if (context.IsEmpty())
180 return v8::Handle<v8::Value>(); 179 return v8::Handle<v8::Value>();
181 ScriptState* scriptState = ScriptState::from(context); 180 ScriptState* scriptState = ScriptState::from(context);
182 if (!scriptState->executionContext()) 181 if (!scriptState->executionContext())
183 return v8::Handle<v8::Value>(); 182 return v8::Handle<v8::Value>();
184 183
185 ScriptState::Scope scope(scriptState); 184 ScriptState::Scope scope(scriptState);
186 return classObjectOfPrivateScript(scriptState, className); 185 return classObjectOfPrivateScript(scriptState, className);
187 } 186 }
188 187
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 v8::Handle<v8::Value> result = V8ScriptRunner::callFunction(v8::Handle<v8::F unction>::Cast(method), scriptState->executionContext(), holder, argc, argv, scr iptState->isolate()); 294 v8::Handle<v8::Value> result = V8ScriptRunner::callFunction(v8::Handle<v8::F unction>::Cast(method), scriptState->executionContext(), holder, argc, argv, scr iptState->isolate());
296 if (block.HasCaught()) { 295 if (block.HasCaught()) {
297 rethrowExceptionInPrivateScript(scriptState->isolate(), block, scriptSta teInUserScript, ExceptionState::ExecutionContext, methodName, className); 296 rethrowExceptionInPrivateScript(scriptState->isolate(), block, scriptSta teInUserScript, ExceptionState::ExecutionContext, methodName, className);
298 block.ReThrow(); 297 block.ReThrow();
299 return v8::Handle<v8::Value>(); 298 return v8::Handle<v8::Value>();
300 } 299 }
301 return result; 300 return result;
302 } 301 }
303 302
304 } // namespace blink 303 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/PrivateScriptRunner.h ('k') | Source/core/html/HTMLMarqueeElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698