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

Unified Diff: Source/bindings/v8/DebuggerScript.js

Issue 13575004: Apply script preprocessor to Web page scripts only. (Closed) Base URL: https://chromium.googlesource.com/external/WebKit_trimmed.git@master
Patch Set: Partial response to review Created 7 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/DebuggerScript.js
diff --git a/Source/bindings/v8/DebuggerScript.js b/Source/bindings/v8/DebuggerScript.js
index 2eb43c61a9b47a2d933abea30a45f0513a790349..4a72223c48cd95f2d05da35ba164e5df15386af8 100644
--- a/Source/bindings/v8/DebuggerScript.js
+++ b/Source/bindings/v8/DebuggerScript.js
@@ -271,6 +271,48 @@ DebuggerScript.getScriptName = function(eventData)
return eventData.script().script_.nameOrSourceURL();
}
+// Matched enum in V8 objects.hs
+DebuggerScript.ScriptCompilationType = {
+ Host: 0,
+ Eval: 1,
+ JSON: 2
+};
+
+DebuggerScript._getScriptCompilationTypeInfo = function(script) {
+ var result = "";
+ var fromScript = script.evalFromScript();
+ if (script.compilationType() == DebuggerScript.ScriptCompilationType.Eval && fromScript) {
+ result += 'eval from ';
+ if (fromScript.compilationType() == DebuggerScript.ScriptCompilationType.Eval) {
+ result += DebuggerScript._getScriptCompilationTypeInfo(fromScript);
+ } else {
+ var name = fromScript.name();
+ if (name) {
+ var location = script.evalFromLocation();
+ result += name + (location ? ':' + (location.line + 1) + ':' + (location.column + 1) : '');
+ } else {
+ result += '(unknown source)';
+ }
+ }
+ return result;
+ } else if (script.compilationType() == Debug.ScriptCompilationType.JSON) {
+ result += 'JSON ';
+ } else { // script.compilation == Debug.ScriptCompilationType.Host
+ result += '[unnamed] ';
+ }
+ return result || 'Failed to extract info';
+}
+
+DebuggerScript.getScriptCompilationTypeInfo = function(eventData)
+{
+ try {
+ var script = eventData.script();
+ return DebuggerScript._getScriptCompilationTypeInfo(script);
+ } catch (exc) {
+ return exc + '';
+ }
+}
+
DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame)
{
// Get function name.

Powered by Google App Engine
This is Rietveld 408576698