| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2011 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 v8::Context::Scope contextScope(debugContext); | 218 v8::Context::Scope contextScope(debugContext); |
| 219 v8::TryCatch tryCatch; | 219 v8::TryCatch tryCatch; |
| 220 // <script> tag source and attribute value source are preprocessed before we
enter V8. | 220 // <script> tag source and attribute value source are preprocessed before we
enter V8. |
| 221 // Avoid preprocessing any internal scripts by processing only eval source i
n this V8 event handler. | 221 // Avoid preprocessing any internal scripts by processing only eval source i
n this V8 event handler. |
| 222 v8::Handle<v8::Value> argvEventData[] = { eventData }; | 222 v8::Handle<v8::Value> argvEventData[] = { eventData }; |
| 223 v8::Handle<v8::Value> v8Value = callDebuggerMethod("isEvalCompilation", WTF_
ARRAY_LENGTH(argvEventData), argvEventData); | 223 v8::Handle<v8::Value> v8Value = callDebuggerMethod("isEvalCompilation", WTF_
ARRAY_LENGTH(argvEventData), argvEventData); |
| 224 if (v8Value.IsEmpty() || !v8Value->ToBoolean()->Value()) | 224 if (v8Value.IsEmpty() || !v8Value->ToBoolean()->Value()) |
| 225 return; | 225 return; |
| 226 | 226 |
| 227 // The name and source are in the JS event data. | 227 // The name and source are in the JS event data. |
| 228 String scriptName = toWebCoreStringWithUndefinedOrNullCheck(callDebuggerMeth
od("getScriptName", WTF_ARRAY_LENGTH(argvEventData), argvEventData)); | 228 String scriptName = toCoreStringWithUndefinedOrNullCheck(callDebuggerMethod(
"getScriptName", WTF_ARRAY_LENGTH(argvEventData), argvEventData)); |
| 229 String script = toWebCoreStringWithUndefinedOrNullCheck(callDebuggerMethod("
getScriptSource", WTF_ARRAY_LENGTH(argvEventData), argvEventData)); | 229 String script = toCoreStringWithUndefinedOrNullCheck(callDebuggerMethod("get
ScriptSource", WTF_ARRAY_LENGTH(argvEventData), argvEventData)); |
| 230 | 230 |
| 231 String preprocessedSource = m_scriptPreprocessor->preprocessSourceCode(scri
pt, scriptName); | 231 String preprocessedSource = m_scriptPreprocessor->preprocessSourceCode(scri
pt, scriptName); |
| 232 | 232 |
| 233 v8::Handle<v8::Value> argvPreprocessedScript[] = { eventData, v8String(debug
Context->GetIsolate(), preprocessedSource) }; | 233 v8::Handle<v8::Value> argvPreprocessedScript[] = { eventData, v8String(debug
Context->GetIsolate(), preprocessedSource) }; |
| 234 callDebuggerMethod("setScriptSource", WTF_ARRAY_LENGTH(argvPreprocessedScrip
t), argvPreprocessedScript); | 234 callDebuggerMethod("setScriptSource", WTF_ARRAY_LENGTH(argvPreprocessedScrip
t), argvPreprocessedScript); |
| 235 } | 235 } |
| 236 | 236 |
| 237 static bool isCreatingPreprocessor = false; | 237 static bool isCreatingPreprocessor = false; |
| 238 | 238 |
| 239 bool PageScriptDebugServer::canPreprocess(Frame* frame) | 239 bool PageScriptDebugServer::canPreprocess(Frame* frame) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 String PageScriptDebugServer::preprocessEventListener(Frame* frame, const String
& source, const String& url, const String& functionName) | 272 String PageScriptDebugServer::preprocessEventListener(Frame* frame, const String
& source, const String& url, const String& functionName) |
| 273 { | 273 { |
| 274 if (!canPreprocess(frame)) | 274 if (!canPreprocess(frame)) |
| 275 return source; | 275 return source; |
| 276 | 276 |
| 277 return m_scriptPreprocessor->preprocessSourceCode(source, url, functionName)
; | 277 return m_scriptPreprocessor->preprocessSourceCode(source, url, functionName)
; |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace WebCore | 280 } // namespace WebCore |
| OLD | NEW |