| Index: Source/bindings/v8/ScriptDebugServer.cpp
|
| diff --git a/Source/bindings/v8/ScriptDebugServer.cpp b/Source/bindings/v8/ScriptDebugServer.cpp
|
| index 8547abeec49dd4232d40855e80891a900be6d141..bcb74aa428ccc89ebb151a369f5a9f4eb1d9c7d2 100644
|
| --- a/Source/bindings/v8/ScriptDebugServer.cpp
|
| +++ b/Source/bindings/v8/ScriptDebugServer.cpp
|
| @@ -35,6 +35,7 @@
|
| #include "DebuggerScriptSource.h"
|
| #include "V8JavaScriptCallFrame.h"
|
| #include "bindings/v8/ScopedPersistent.h"
|
| + #include "bindings/v8/V8PerContextDebugData.h"
|
| #include "bindings/v8/ScriptObject.h"
|
| #include "bindings/v8/V8Binding.h"
|
| #include "bindings/v8/V8RecursionScope.h"
|
| @@ -458,6 +459,25 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD
|
| if (!m_scriptPreprocessor)
|
| return;
|
|
|
| + if (V8PerContextDebugData::contextCategory(eventContext) != PageContextCategory)
|
| + return;
|
| +
|
| + v8::Handle<v8::Function> getScriptNameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("getScriptName")));
|
| + v8::Handle<v8::Value> argv1[] = { eventDetails.GetEventData() };
|
| + v8::Handle<v8::Value> scriptName = getScriptNameFunction->Call(m_debuggerScript.get(), 1, argv1);
|
| +
|
| + v8::String::Utf8Value scriptNameUtf8Value(scriptName);
|
| + String scriptNameString = String::fromUTF8(*scriptNameUtf8Value, scriptNameUtf8Value.length());
|
| +
|
| + // Allow eval scripts and Web scripts
|
| + if (scriptNameString != "undefined" && !V8PerContextDebugData::isScopedWebCompilation(eventContext))
|
| + return;
|
| +
|
| + // FIXME preprocessor needs to know that this compilation can only return a function,
|
| + // eg DOM attribute event handler.
|
| + if (V8PerContextDebugData::isOneFunctionWebCompilation())
|
| + return;
|
| +
|
| OwnPtr<ScriptPreprocessor> preprocessor(m_scriptPreprocessor.release());
|
| v8::Local<v8::Context> debugContext = v8::Debug::GetDebugContext();
|
| v8::Context::Scope contextScope(debugContext);
|
| @@ -465,12 +485,8 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD
|
| v8::Handle<v8::Value> argv[] = { eventDetails.GetEventData() };
|
| v8::Handle<v8::Value> script = getScriptSourceFunction->Call(m_debuggerScript.get(), 1, argv);
|
|
|
| - v8::Handle<v8::Function> getScriptNameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("getScriptName")));
|
| - v8::Handle<v8::Value> argv1[] = { eventDetails.GetEventData() };
|
| - v8::Handle<v8::Value> scriptName = getScriptNameFunction->Call(m_debuggerScript.get(), 1, argv1);
|
| -
|
| v8::Handle<v8::Function> setScriptSourceFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("setScriptSource")));
|
| - String patchedScript = preprocessor->preprocessSourceCode(toWebCoreStringWithUndefinedOrNullCheck(script), toWebCoreStringWithUndefinedOrNullCheck(scriptName));
|
| + String patchedScript = preprocessor->preprocessSourceCode(toWebCoreStringWithUndefinedOrNullCheck(script), scriptNameString);
|
|
|
| v8::Handle<v8::Value> argv2[] = { eventDetails.GetEventData(), v8String(patchedScript, debugContext->GetIsolate()) };
|
| setScriptSourceFunction->Call(m_debuggerScript.get(), 2, argv2);
|
|
|