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

Unified Diff: third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp

Issue 1579283002: [DevTools] Blackbox sources with inline source maps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@source-map-backend
Patch Set: deoilpanize Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp
diff --git a/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp b/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp
index 05fc1cfa9744d08b6b2bbf8c5c7c1c8de58cecf1..75f9e598a5c507e43ec0d354505601ebb80fe60d 100644
--- a/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp
+++ b/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp
@@ -28,6 +28,9 @@
#include "core/inspector/v8/V8Debugger.h"
#include "core/inspector/v8/V8JavaScriptCallFrame.h"
#include "platform/JSONValues.h"
+#include "platform/SharedBuffer.h"
+#include "platform/weborigin/KURL.h"
+#include "public/platform/Platform.h"
#include "wtf/Optional.h"
#include "wtf/text/StringBuilder.h"
#include "wtf/text/WTFString.h"
@@ -121,6 +124,19 @@ static PassRefPtrWillBeRawPtr<ScriptCallStack> toScriptCallStack(v8::Local<v8::C
return jsCallFrame ? toScriptCallStack(jsCallFrame.get()) : nullptr;
}
+static PassOwnPtr<SourceMap> parseSourceMapFromDataUrl(const String& url)
+{
+ KURL sourceMapURL(KURL(), url);
+ if (sourceMapURL.isEmpty() || !sourceMapURL.isValid())
+ return nullptr;
+ WebString mimetype;
+ WebString charset;
+ RefPtr<SharedBuffer> data = PassRefPtr<SharedBuffer>(Platform::current()->parseDataURL(sourceMapURL, mimetype, charset));
+ if (!data)
+ return nullptr;
+ return SourceMap::parse(String(data->data(), data->size()));
+}
+
PassOwnPtr<V8DebuggerAgent> V8DebuggerAgent::create(InjectedScriptManager* injectedScriptManager, V8Debugger* debugger, int contextGroupId)
{
return adoptPtr(new V8DebuggerAgentImpl(injectedScriptManager, static_cast<V8DebuggerImpl*>(debugger), contextGroupId));
@@ -217,6 +233,7 @@ void V8DebuggerAgentImpl::disable(ErrorString*)
m_pausedScriptState = nullptr;
m_currentCallStack.Reset();
m_scripts.clear();
+ m_sourceMaps.clear();
m_breakpointIdToDebuggerBreakpointIds.clear();
internalSetAsyncCallStackDepth(0);
m_promiseTracker->setEnabled(false, false);
@@ -519,9 +536,17 @@ bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(PassRefPtr<Ja
return true;
bool isBlackboxed = false;
String scriptURL = it->value.sourceURL();
- if (m_cachedSkipStackRegExp && !scriptURL.isEmpty()) {
+ String sourceMappedScriptURL;
+ auto itSourceMap = m_sourceMaps.find(String::number(frame->sourceID()));
+ if (itSourceMap != m_sourceMaps.end()) {
+ const SourceMap::Entry* entry = itSourceMap->value->findEntry(frame->line(), frame->column());
+ if (entry)
+ sourceMappedScriptURL = entry->sourceURL;
+ }
+ if (m_cachedSkipStackRegExp && (!scriptURL.isEmpty() || !sourceMappedScriptURL.isEmpty())) {
if (!it->value.getBlackboxedState(m_cachedSkipStackGeneration, &isBlackboxed)) {
- isBlackboxed = m_cachedSkipStackRegExp->match(scriptURL) != -1;
+ isBlackboxed = !scriptURL.isEmpty() && m_cachedSkipStackRegExp->match(scriptURL) != -1;
+ isBlackboxed = isBlackboxed || (!sourceMappedScriptURL.isEmpty() && m_cachedSkipStackRegExp->match(sourceMappedScriptURL) != -1);
it->value.setBlackboxedState(m_cachedSkipStackGeneration, isBlackboxed);
}
}
@@ -1480,6 +1505,9 @@ void V8DebuggerAgentImpl::didParseSource(const V8DebuggerParsedScript& parsedScr
bool hasSourceURL = script.hasSourceURL();
String scriptURL = script.sourceURL();
String sourceMapURL = sourceMapURLForScript(script, parsedScript.success);
+ OwnPtr<SourceMap> sourceMap = parseSourceMapFromDataUrl(sourceMapURL);
+ if (sourceMap)
+ m_sourceMaps.set(parsedScript.scriptId, sourceMap.release());
const String* sourceMapURLParam = sourceMapURL.isNull() ? nullptr : &sourceMapURL;
const bool* isContentScriptParam = isContentScript ? &isContentScript : nullptr;
@@ -1662,6 +1690,7 @@ void V8DebuggerAgentImpl::reset()
{
m_scheduledDebuggerStep = NoStep;
m_scripts.clear();
+ m_sourceMaps.clear();
m_breakpointIdToDebuggerBreakpointIds.clear();
resetAsyncCallTracker();
m_promiseTracker->clear();
« no previous file with comments | « third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698