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

Unified Diff: Source/bindings/v8/ScriptPreprocessor.cpp

Issue 314953005: Add an ASSERT about cross-world wrapper leakage into ScriptValue (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/ScriptPreprocessor.cpp
diff --git a/Source/bindings/v8/ScriptPreprocessor.cpp b/Source/bindings/v8/ScriptPreprocessor.cpp
index 9fc3cee9c058ce306bab0cdde0cecfa96dcc89cb..3c38767e8ffbc55ab850394a067bee858fc18bf7 100644
--- a/Source/bindings/v8/ScriptPreprocessor.cpp
+++ b/Source/bindings/v8/ScriptPreprocessor.cpp
@@ -49,12 +49,13 @@ ScriptPreprocessor::ScriptPreprocessor(const ScriptSourceCode& preprocessorSourc
RefPtr<DOMWrapperWorld> world = DOMWrapperWorld::ensureIsolatedWorld(ScriptPreprocessorIsolatedWorldId, DOMWrapperWorld::mainWorldExtensionGroup);
m_scriptState = ScriptState::from(toV8Context(frame, *world));
+ v8::HandleScope handleScope(m_scriptState->isolate());
ASSERT(frame);
v8::TryCatch tryCatch;
tryCatch.SetVerbose(true);
Vector<ScriptSourceCode> sources;
sources.append(preprocessorSourceCode);
- Vector<ScriptValue> scriptResults;
+ Vector<v8::Local<v8::Value> > scriptResults;
frame->script().executeScriptInIsolatedWorld(ScriptPreprocessorIsolatedWorldId, sources, DOMWrapperWorld::mainWorldExtensionGroup, &scriptResults);
if (scriptResults.size() != 1) {
@@ -62,12 +63,12 @@ ScriptPreprocessor::ScriptPreprocessor(const ScriptSourceCode& preprocessorSourc
return;
}
- ScriptValue preprocessorFunction = scriptResults[0];
- if (!preprocessorFunction.isFunction()) {
+ v8::Local<v8::Value> preprocessorFunction = scriptResults[0];
+ if (preprocessorFunction.IsEmpty() || !preprocessorFunction->IsFunction()) {
frame->console().addMessage(JSMessageSource, ErrorMessageLevel, "The preprocessor must compile to a function.");
return;
}
- m_preprocessorFunction.set(m_scriptState->isolate(), v8::Handle<v8::Function>::Cast(preprocessorFunction.v8Value()));
+ m_preprocessorFunction.set(m_scriptState->isolate(), v8::Handle<v8::Function>::Cast(preprocessorFunction));
}
String ScriptPreprocessor::preprocessSourceCode(const String& sourceCode, const String& sourceName)

Powered by Google App Engine
This is Rietveld 408576698