JavaScriptCore:
authorkmccullough@apple.com <kmccullough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Mar 2009 22:47:49 +0000 (22:47 +0000)
committerkmccullough@apple.com <kmccullough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Mar 2009 22:47:49 +0000 (22:47 +0000)
2009-03-03  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Oliver Hunt.

        <rdar://problem/6639110> console.profile() doesn't work without a title

        * profiler/Profiler.cpp:
        (JSC::Profiler::startProfiling): assert if there is not title to ensure
        we don't start profiling without one.

WebCore:

2009-03-03  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Oliver Hunt.

        <rdar://problem/6639110> console.profile() doesn't work without a title

        * page/Console.cpp:
        (WebCore::Console::profile): If there is no title assume this is a user
        initiated profile and give it the next incremented title name.

LayoutTests:

2009-03-03  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Oliver Hunt.

        <rdar://problem/6639110> console.profile() doesn't work without a title

        * fast/profiler/profile-with-no-title-expected.txt: Added.
        * fast/profiler/profile-with-no-title.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41407 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/profiler/Profiler.cpp
LayoutTests/ChangeLog
LayoutTests/fast/profiler/profile-with-no-title-expected.txt [new file with mode: 0644]
LayoutTests/fast/profiler/profile-with-no-title.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/page/Console.cpp

index e0baa3c8e388ebb4171109833fd7757959994322..b69ca5919101a94e50df99e83cb82fb5885c1f4f 100644 (file)
@@ -1,3 +1,13 @@
+2009-03-03  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        <rdar://problem/6639110> console.profile() doesn't work without a title
+
+        * profiler/Profiler.cpp:
+        (JSC::Profiler::startProfiling): assert if there is not title to ensure
+        we don't start profiling without one.
+
 2009-03-02  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Mark Rowe.
index 2de8f84e5af0032f57358bfc4cf9c6b5b971d8a9..ace0a33860dc4eb04ab33b0bf59127ab00c97273 100644 (file)
@@ -58,6 +58,8 @@ Profiler* Profiler::profiler()
 
 void Profiler::startProfiling(ExecState* exec, const UString& title)
 {
+    ASSERT_ARG(title, !title.isNull());
+
     // Check if we currently have a Profile for this global ExecState and title.
     // If so return early and don't create a new Profile.
     ExecState* globalExec = exec ? exec->lexicalGlobalObject()->globalExec() : 0;
index 0cefa9939804ae2c8405a5d2da93ccc1ccf0f87a..6d8d40620aec1b5e74368884dd49213adb748ec4 100644 (file)
@@ -1,3 +1,12 @@
+2009-03-03  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        <rdar://problem/6639110> console.profile() doesn't work without a title
+
+        * fast/profiler/profile-with-no-title-expected.txt: Added.
+        * fast/profiler/profile-with-no-title.html: Added.
+
 2009-03-03  Pamela Greene  <pam@chromium.org>
 
         Remove junk files that must have been accidentally committed.
diff --git a/LayoutTests/fast/profiler/profile-with-no-title-expected.txt b/LayoutTests/fast/profiler/profile-with-no-title-expected.txt
new file mode 100644 (file)
index 0000000..45c7995
--- /dev/null
@@ -0,0 +1,10 @@
+This page creates a profile without a title. 
+
+To run this test manually, load it in the browser then load the WebInspector and look at the profile. If there is a profile that is sufficient for this test.
+
+Profile title: org.webkit.profiles.user-initiated.1
+Thread_1 (no file) (line 0)
+   (program) (no file) (line 4294967295)
+      endTest profiler-test-JS-resources.js (line 1)
+
+
diff --git a/LayoutTests/fast/profiler/profile-with-no-title.html b/LayoutTests/fast/profiler/profile-with-no-title.html
new file mode 100644 (file)
index 0000000..b04d27b
--- /dev/null
@@ -0,0 +1,28 @@
+<html>
+<head>
+<script src="resources/profiler-test-JS-resources.js"></script>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.setJavaScriptProfilingEnabled(true);
+}
+
+function startTest()
+{
+    console.profile();
+    endTest();
+}
+</script>
+</head>
+
+<body onload="startTest()">
+This page creates a profile without a title.
+<br>
+<br>
+To run this test manually, load it in the browser then load the WebInspector and look at
+the profile.  If there is a profile that is sufficient for this test.
+<div id="output"></div>
+<script>
+</script>
+</body>
+</html>
index 9b9c27a2312b7381a671dd00de1b30ca746686a0..9c5f269a8416d0ac2e6f1dfc4fd59811657c816d 100644 (file)
@@ -1,3 +1,13 @@
+2009-03-03  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        <rdar://problem/6639110> console.profile() doesn't work without a title
+
+        * page/Console.cpp:
+        (WebCore::Console::profile): If there is no title assume this is a user
+        initiated profile and give it the next incremented title name.
+
 2009-03-03  Timothy Hatcher  <timothy@apple.com>
 
         Fix a regression that broke dirxml and caused an ASSERT in debug builds. Also simplified
index 49109a8f7319e8ed526c2e3ebb0c2adc1b0cab2b..eccc40705e55467c1f99b3a599c0f77ec20dd839 100644 (file)
@@ -271,13 +271,15 @@ void Console::profile(const JSC::UString& title, ScriptCallStack* callStack)
     if (!page)
         return;
 
-    if (title.isNull())
-        return;
-
     // FIXME: log a console message when profiling is disabled.
     if (!page->inspectorController()->profilerEnabled())
         return;
 
+    if (title.isNull()) {   // no title so give it the next user intiated profile title.
+        page->inspectorController()->startUserInitiatedProfiling(0);
+        return;
+    }
+
     JSC::Profiler::profiler()->startProfiling(callStack->state(), title);
 }