Index: LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js |
diff --git a/LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js b/LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js |
index 4f1af0deeadb85daa180bddae4f1f9a49721c624..c1b2fab9f0fc7f601e33cc8213b11bbe4de98776 100644 |
--- a/LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js |
+++ b/LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js |
@@ -28,8 +28,18 @@ InspectorTest.takeHeapSnapshot = function(callback) |
var profileId = messageObject["params"]["header"]["uid"]; |
InspectorTest.sendCommand("HeapProfiler.getHeapSnapshot", { "uid": profileId }, didGetHeapSnapshot); |
+ var chunks = []; |
+ InspectorTest.eventHandler["HeapProfiler.addHeapSnapshotChunk"] = function(messageObject) |
+ { |
+ chunks.push(messageObject["params"]["chunk"]); |
+ } |
+ |
function didGetHeapSnapshot(messageObject) |
{ |
+ var serializedSnapshot = chunks.join(""); |
+ var parsed = JSON.parse(serializedSnapshot); |
+ var snapshot = new WebInspector.JSHeapSnapshot(parsed, new WebInspector.HeapSnapshotProgress()); |
+ callback(snapshot); |
InspectorTest.log("SUCCESS: didGetHeapSnapshot"); |
InspectorTest.sendCommand("HeapProfiler.removeProfile", { "uid": profileId }, didRemoveSnapshot); |
} |
@@ -38,21 +48,6 @@ InspectorTest.takeHeapSnapshot = function(callback) |
{ |
InspectorTest.completeTest(); |
} |
- |
- } |
- |
- var chunks = []; |
- InspectorTest.eventHandler["HeapProfiler.addHeapSnapshotChunk"] = function(messageObject) |
- { |
- chunks.push(messageObject["params"]["chunk"]); |
- } |
- |
- InspectorTest.eventHandler["HeapProfiler.finishHeapSnapshot"] = function(messageObject) |
- { |
- var serializedSnapshot = chunks.join(""); |
- var parsed = JSON.parse(serializedSnapshot); |
- var snapshot = new WebInspector.JSHeapSnapshot(parsed, new WebInspector.HeapSnapshotProgress()); |
- callback(snapshot); |
} |
InspectorTest.sendCommand("HeapProfiler.takeHeapSnapshot", {}); |