Title: [194123] trunk
Revision
194123
Author
[email protected]
Date
2015-12-15 16:23:49 -0800 (Tue, 15 Dec 2015)

Log Message

Web Inspector: Localize "global code" and "eval code" strings
https://bugs.webkit.org/show_bug.cgi?id=152313

Reviewed by Timothy Hatcher.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Models/CallFrame.js:
(WebInspector.CallFrame.fromPayload):
Localize the strings given to use from the backend.

LayoutTests:

* inspector/debugger/js-stacktrace-expected.txt:
* inspector/debugger/js-stacktrace.html:
* inspector/model/stack-trace-expected.txt: Added.
* inspector/model/stack-trace.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (194122 => 194123)


--- trunk/LayoutTests/ChangeLog	2015-12-16 00:06:02 UTC (rev 194122)
+++ trunk/LayoutTests/ChangeLog	2015-12-16 00:23:49 UTC (rev 194123)
@@ -1,3 +1,15 @@
+2015-12-15  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Localize "global code" and "eval code" strings
+        https://bugs.webkit.org/show_bug.cgi?id=152313
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/debugger/js-stacktrace-expected.txt:
+        * inspector/debugger/js-stacktrace.html:
+        * inspector/model/stack-trace-expected.txt: Added.
+        * inspector/model/stack-trace.html: Added.
+
 2015-12-15  Tim Horton  <[email protected]>
 
         REGRESSION (r191849): There's no yellow bouncy highlight when using Find on Page on iOS

Modified: trunk/LayoutTests/inspector/debugger/js-stacktrace-expected.txt (194122 => 194123)


--- trunk/LayoutTests/inspector/debugger/js-stacktrace-expected.txt	2015-12-16 00:06:02 UTC (rev 194122)
+++ trunk/LayoutTests/inspector/debugger/js-stacktrace-expected.txt	2015-12-16 00:23:49 UTC (rev 194123)
@@ -19,7 +19,7 @@
     {
         "lineNumber": null,
         "columnNumber": null,
-        "functionName": "eval code",
+        "functionName": "Eval Code",
         "nativeCode": true,
         "programCode": true
     }
@@ -73,7 +73,7 @@
     {
         "lineNumber": null,
         "columnNumber": null,
-        "functionName": "eval code",
+        "functionName": "Eval Code",
         "nativeCode": true,
         "programCode": true
     }

Modified: trunk/LayoutTests/inspector/debugger/js-stacktrace.html (194122 => 194123)


--- trunk/LayoutTests/inspector/debugger/js-stacktrace.html	2015-12-16 00:06:02 UTC (rev 194122)
+++ trunk/LayoutTests/inspector/debugger/js-stacktrace.html	2015-12-16 00:23:49 UTC (rev 194123)
@@ -114,7 +114,7 @@
         var index = 0;
         for (var frame of stackTrace) {
             index++;
-            if (frame.nativeCode && frame.functionName === "eval code")
+            if (frame.programCode)
                 break;
         }
         return stackTrace.slice(0, index);

Added: trunk/LayoutTests/inspector/model/stack-trace-expected.txt (0 => 194123)


--- trunk/LayoutTests/inspector/model/stack-trace-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/model/stack-trace-expected.txt	2015-12-16 00:23:49 UTC (rev 194123)
@@ -0,0 +1,23 @@
+Tests for the WebInspector.StackTrace model object.
+
+
+== Running test suite: WebInspector.StackTrace
+-- Running test case: WebInspector.ConsoleMessage.StackTrace
+PASS: ConsoleMessage type should be Trace.
+PASS: ConsoleMessage should have StackTrace.
+PASS: CallFrame in StackTrace has no identifier.
+PASS: CallFrame in StackTrace has no thisObject.
+PASS: CallFrame in StackTrace has no scopeChain.
+StackTrace: 11
+  1: foo - nativeCode (true) programCode (false)
+  2: Eval Code - nativeCode (true) programCode (true)
+  3: eval - nativeCode (true) programCode (false)
+  4: Global Code (stack-trace.html:2) - nativeCode (false) programCode (true)
+  5: appendChild - nativeCode (true) programCode (false)
+  6: triggerConsoleMessage (stack-trace.html:9) - nativeCode (false) programCode (false)
+  7: Eval Code - nativeCode (true) programCode (true)
+  8: eval - nativeCode (true) programCode (false)
+  9: _evaluateOn - nativeCode (true) programCode (false)
+  10: _evaluateAndWrap - nativeCode (true) programCode (false)
+  11: evaluate - nativeCode (true) programCode (false)
+

Added: trunk/LayoutTests/inspector/model/stack-trace.html (0 => 194123)


--- trunk/LayoutTests/inspector/model/stack-trace.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/model/stack-trace.html	2015-12-16 00:23:49 UTC (rev 194123)
@@ -0,0 +1,60 @@
+<!doctype html>
+<html>
+<head>
+<script src=""
+<script>
+function triggerConsoleMessage() {
+    let script = document.createElement("script");
+    script.textContent = "//# sourceURL=inline-script.js\neval('function foo() { console.trace(); }; foo();')";
+    document.body.appendChild(script);
+}
+
+function test()
+{
+    function logStackTrace(stackTrace) {
+        InspectorTest.log(`StackTrace: ${stackTrace.callFrames.length}`);
+        for (let i = 0; i < stackTrace.callFrames.length; ++i) {
+            let callFrame = stackTrace.callFrames[i];
+            let string = `  ${i + 1}: ${callFrame.functionName}`;
+            if (callFrame.sourceCodeLocation)
+                string += ` (${callFrame.sourceCodeLocation.originalLocationString()})`;
+            string += " -";
+            string += ` nativeCode (${callFrame.nativeCode})`;
+            string += ` programCode (${callFrame.programCode})`;
+            InspectorTest.log(string);
+        }
+    }
+
+    let suite = InspectorTest.createAsyncSuite("WebInspector.StackTrace");
+
+    suite.addTestCase({
+        name: "WebInspector.ConsoleMessage.StackTrace",
+        description: "Test we can create a StackTrace from console messages (Console.StackTrace).",
+        test: (resolve, reject) => {
+            InspectorTest.evaluateInPage("triggerConsoleMessage()");
+            WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, function addListener(event) {
+                // Trace message should always have a stack trace.
+                let consoleMessage = event.data.message;
+                let stackTrace = consoleMessage.stackTrace;
+                InspectorTest.expectThat(consoleMessage.type === WebInspector.ConsoleMessage.MessageType.Trace, "ConsoleMessage type should be Trace.");
+                InspectorTest.expectThat(stackTrace instanceof WebInspector.StackTrace, "ConsoleMessage should have StackTrace.");
+
+                // Console message stack trace call frame's do not have debugging information.
+                InspectorTest.expectThat(stackTrace.callFrames[0].id === null, "CallFrame in StackTrace has no identifier.");
+                InspectorTest.expectThat(stackTrace.callFrames[0].thisObject === null, "CallFrame in StackTrace has no thisObject.");
+                InspectorTest.expectThat(!stackTrace.callFrames[0].scopeChain.length, "CallFrame in StackTrace has no scopeChain.");
+
+                logStackTrace(consoleMessage.stackTrace);
+                resolve();
+            });
+        }
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests for the WebInspector.StackTrace model object.</p>
+</body>
+</html>

Modified: trunk/Source/WebInspectorUI/ChangeLog (194122 => 194123)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-12-16 00:06:02 UTC (rev 194122)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-12-16 00:23:49 UTC (rev 194123)
@@ -1,3 +1,15 @@
+2015-12-15  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Localize "global code" and "eval code" strings
+        https://bugs.webkit.org/show_bug.cgi?id=152313
+
+        Reviewed by Timothy Hatcher.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Models/CallFrame.js:
+        (WebInspector.CallFrame.fromPayload):
+        Localize the strings given to use from the backend.
+
 2015-12-15  Matt Baker  <[email protected]>
 
         Web Inspector: Convert Sidebar classes to use View

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (194122 => 194123)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2015-12-16 00:06:02 UTC (rev 194122)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2015-12-16 00:23:49 UTC (rev 194123)
@@ -266,6 +266,7 @@
 localizedStrings["Enter a name."] = "Enter a name.";
 localizedStrings["Error: "] = "Error: ";
 localizedStrings["Errors"] = "Errors";
+localizedStrings["Eval Code"] = "Eval Code";
 localizedStrings["Evaluate _javascript_"] = "Evaluate _javascript_";
 localizedStrings["Event Dispatched"] = "Event Dispatched";
 localizedStrings["Event Listeners"] = "Event Listeners";
@@ -309,6 +310,7 @@
 localizedStrings["Garbage Collection"] = "Garbage Collection";
 localizedStrings["Getter"] = "Getter";
 localizedStrings["Global Breakpoints"] = "Global Breakpoints";
+localizedStrings["Global Code"] = "Global Code";
 localizedStrings["Global Lexical Environment"] = "Global Lexical Environment";
 localizedStrings["Global Variables"] = "Global Variables";
 localizedStrings["Grammar"] = "Grammar";
@@ -391,6 +393,7 @@
 localizedStrings["Method"] = "Method";
 localizedStrings["Min"] = "Min";
 localizedStrings["Mixed"] = "Mixed";
+localizedStrings["Module Code"] = "Module Code";
 localizedStrings["Name"] = "Name";
 localizedStrings["Network"] = "Network";
 localizedStrings["Network Issue"] = "Network Issue";

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js (194122 => 194123)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js	2015-12-16 00:06:02 UTC (rev 194122)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js	2015-12-16 00:23:49 UTC (rev 194123)
@@ -112,31 +112,37 @@
     {
         console.assert(payload);
 
-        var url = ""
-        var nativeCode = false;
-        var programCode = false;
-        var sourceCodeLocation = null;
+        let url = ""
+        let nativeCode = false;
+        let programCode = false;
+        let sourceCodeLocation = null;
 
         if (!url || url ="" "[native code]") {
             nativeCode = true;
             url = ""
         } else {
-            var sourceCode = WebInspector.frameResourceManager.resourceForURL(url);
+            let sourceCode = WebInspector.frameResourceManager.resourceForURL(url);
             if (!sourceCode)
                 sourceCode = WebInspector.debuggerManager.scriptsForURL(url)[0];
 
             if (sourceCode) {
                 // The lineNumber is 1-based, but we expect 0-based.
-                var lineNumber = payload.lineNumber - 1;
+                let lineNumber = payload.lineNumber - 1;
                 sourceCodeLocation = sourceCode.createLazySourceCodeLocation(lineNumber, payload.columnNumber);
             }
         }
 
-        var functionName = payload.functionName;
-        if (payload.functionName === "global code"
-            || payload.functionName === "eval code"
-            || payload.functionName === "module code")
+        let functionName = payload.functionName;
+        if (payload.functionName === "global code") {
+            functionName = WebInspector.UIString("Global Code");
             programCode = true;
+        } else if (payload.functionName === "eval code") {
+            functionName = WebInspector.UIString("Eval Code");
+            programCode = true;
+        } else if (payload.functionName === "module code") {
+            functionName = WebInspector.UIString("Module Code");
+            programCode = true;
+        }
 
         return new WebInspector.CallFrame(null, sourceCodeLocation, functionName, null, null, nativeCode, programCode);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to