Title: [138494] trunk
- Revision
- 138494
- Author
- [email protected]
- Date
- 2012-12-27 01:53:14 -0800 (Thu, 27 Dec 2012)
Log Message
Web Inspector: console.profileEnd() crashes if called without arguments
https://bugs.webkit.org/show_bug.cgi?id=105759
Patch by Eugene Klyuchnikov <[email protected]> on 2012-12-27
Reviewed by Vsevolod Vlasov.
Source/WebCore:
Test: inspector/profiler/cpu-profiler-parameterless-profile-end-crash.html
API allows to finish profile without specifying its name.
Profiler tracks profiles stack and finishes outermost profile.
Finished profile title will be used instead of user-specified one.
* bindings/v8/ScriptProfiler.cpp:
(WebCore::ScriptProfiler::stop): Use title provided by profiler.
LayoutTests:
Added tests to check that browser do not crash.
* inspector/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt: Added.
* inspector/profiler/cpu-profiler-parameterless-profile-end-crash.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (138493 => 138494)
--- trunk/LayoutTests/ChangeLog 2012-12-27 09:12:44 UTC (rev 138493)
+++ trunk/LayoutTests/ChangeLog 2012-12-27 09:53:14 UTC (rev 138494)
@@ -1,3 +1,15 @@
+2012-12-27 Eugene Klyuchnikov <[email protected]>
+
+ Web Inspector: console.profileEnd() crashes if called without arguments
+ https://bugs.webkit.org/show_bug.cgi?id=105759
+
+ Reviewed by Vsevolod Vlasov.
+
+ Added tests to check that browser do not crash.
+
+ * inspector/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt: Added.
+ * inspector/profiler/cpu-profiler-parameterless-profile-end-crash.html: Added.
+
2012-12-27 Vsevolod Vlasov <[email protected]>
Unreviewed chromium test expectations update.
Added: trunk/LayoutTests/inspector/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt (0 => 138494)
--- trunk/LayoutTests/inspector/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt 2012-12-27 09:53:14 UTC (rev 138494)
@@ -0,0 +1,6 @@
+Tests that "console.profileEnd()" do not cause crash.
+Bug 105759.
+
+Profiles count: 2
+Titled profile found.
+
Added: trunk/LayoutTests/inspector/profiler/cpu-profiler-parameterless-profile-end-crash.html (0 => 138494)
--- trunk/LayoutTests/inspector/profiler/cpu-profiler-parameterless-profile-end-crash.html (rev 0)
+++ trunk/LayoutTests/inspector/profiler/cpu-profiler-parameterless-profile-end-crash.html 2012-12-27 09:53:14 UTC (rev 138494)
@@ -0,0 +1,49 @@
+<html>
+<head>
+<script>
+
+if (window.testRunner)
+ testRunner.dumpAsText();
+if (window.internals)
+ internals.setJavaScriptProfilingEnabled(true);
+
+function pageFunction()
+{
+ console.profile(); // Untitled
+ console.profile("titled");
+ console.profileEnd();
+ console.profileEnd();
+}
+
+function startTest()
+{
+ pageFunction();
+ printResult();
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+function printResult()
+{
+ var preElement = document.createElement("pre");
+ preElement.appendChild(document.createTextNode("\n"));
+
+ var profiles = console.profiles;
+ preElement.appendChild(document.createTextNode("Profiles count: " + profiles.length + "\n"));
+ for (var i = 0; i < profiles.length; ++i) {
+ if (profiles[i].title === "titled")
+ preElement.appendChild(document.createTextNode("Titled profile found.\n"));
+ }
+ document.getElementById("output").appendChild(preElement);
+}
+
+</script>
+</head>
+<body _onload_="startTest()">
+<p>
+Tests that "console.profileEnd()" do not cause crash.<br>
+<a href="" 105759.</a><br>
+<div id="output"></div>
+</p>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (138493 => 138494)
--- trunk/Source/WebCore/ChangeLog 2012-12-27 09:12:44 UTC (rev 138493)
+++ trunk/Source/WebCore/ChangeLog 2012-12-27 09:53:14 UTC (rev 138494)
@@ -1,3 +1,19 @@
+2012-12-27 Eugene Klyuchnikov <[email protected]>
+
+ Web Inspector: console.profileEnd() crashes if called without arguments
+ https://bugs.webkit.org/show_bug.cgi?id=105759
+
+ Reviewed by Vsevolod Vlasov.
+
+ Test: inspector/profiler/cpu-profiler-parameterless-profile-end-crash.html
+
+ API allows to finish profile without specifying its name.
+ Profiler tracks profiles stack and finishes outermost profile.
+ Finished profile title will be used instead of user-specified one.
+
+ * bindings/v8/ScriptProfiler.cpp:
+ (WebCore::ScriptProfiler::stop): Use title provided by profiler.
+
2012-12-26 No'am Rosenthal <[email protected]>
[Texmap] Instead of having multiple shaders sources with lots of duplication, we should have one shader source with MACRO variants
Modified: trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp (138493 => 138494)
--- trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp 2012-12-27 09:12:44 UTC (rev 138493)
+++ trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp 2012-12-27 09:53:14 UTC (rev 138494)
@@ -80,16 +80,19 @@
const v8::CpuProfile* profile = "" ?
v8::CpuProfiler::StopProfiling(deprecatedV8String(title), state->context()->GetSecurityToken()) :
v8::CpuProfiler::StopProfiling(deprecatedV8String(title));
+ if (!profile)
+ return 0;
+ String profileTitle = toWebCoreString(profile->GetTitle());
double idleTime = 0.0;
ProfileNameIdleTimeMap* profileNameIdleTimeMap = ScriptProfiler::currentProfileNameIdleTimeMap();
- ProfileNameIdleTimeMap::iterator profileIdleTime = profileNameIdleTimeMap->find(title);
+ ProfileNameIdleTimeMap::iterator profileIdleTime = profileNameIdleTimeMap->find(profileTitle);
if (profileIdleTime != profileNameIdleTimeMap->end()) {
idleTime = profileIdleTime->value * 1000.0;
profileNameIdleTimeMap->remove(profileIdleTime);
}
- return profile ? ScriptProfile::create(profile, idleTime) : 0;
+ return ScriptProfile::create(profile, idleTime);
}
PassRefPtr<ScriptProfile> ScriptProfiler::stopForPage(Page*, const String& title)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes