Title: [111697] trunk/Source/WebCore
Revision
111697
Author
loi...@chromium.org
Date
2012-03-22 08:04:38 -0700 (Thu, 22 Mar 2012)

Log Message

Web Inspector: HeapProfiler: Heap snapshot worker has to report the errors to the front-end
https://bugs.webkit.org/show_bug.cgi?id=81804

Sometimes the worker process of HeapSnapshot does some wrong thing and throw an Exception.
At this momemnt we have no way to see the error in the front-end.

Reviewed by Yury Semikhatsky.

* English.lproj/localizedStrings.js:
* inspector/front-end/HeapSnapshotProxy.js: check the exception field and dump it into front-end's console.
(WebInspector.HeapSnapshotWorker.prototype._messageReceived):
* inspector/front-end/HeapSnapshotWorkerDispatcher.js: catch the exception and transfer it's text to requester's side.
(WebInspector.HeapSnapshotWorkerDispatcher.prototype.dispatchMessage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111696 => 111697)


--- trunk/Source/WebCore/ChangeLog	2012-03-22 14:56:33 UTC (rev 111696)
+++ trunk/Source/WebCore/ChangeLog	2012-03-22 15:04:38 UTC (rev 111697)
@@ -1,3 +1,19 @@
+2012-03-21  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: HeapProfiler: Heap snapshot worker has to report the errors to the front-end
+        https://bugs.webkit.org/show_bug.cgi?id=81804
+
+        Sometimes the worker process of HeapSnapshot does some wrong thing and throw an Exception.
+        At this momemnt we have no way to see the error in the front-end.
+
+        Reviewed by Yury Semikhatsky.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/HeapSnapshotProxy.js: check the exception field and dump it into front-end's console.
+        (WebInspector.HeapSnapshotWorker.prototype._messageReceived):
+        * inspector/front-end/HeapSnapshotWorkerDispatcher.js: catch the exception and transfer it's text to requester's side.
+        (WebInspector.HeapSnapshotWorkerDispatcher.prototype.dispatchMessage):
+
 2012-03-22  Carlos Garcia Campos  <cgar...@bb-webkit-rel-64.local.igalia.com>
 
         [GTK] Use the angle-bracket form to include wtf headers

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js


(Binary files differ)

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js (111696 => 111697)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js	2012-03-22 14:56:33 UTC (rev 111696)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js	2012-03-22 15:04:38 UTC (rev 111697)
@@ -188,6 +188,13 @@
     _messageReceived: function(event)
     {
         var data = ""
+        if (event.data.error) {
+            if (event.data.errorMethodName)
+                WebInspector.log(WebInspector.UIString("An error happend when a call for method '%s' was requested", event.data.errorMethodName));
+            WebInspector.log(event.data.errorCallStack);
+            delete this._callbacks[data.callId];
+            return;
+        }
         if (!this._callbacks[data.callId])
             return;
         var callback = this._callbacks[data.callId];

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotWorkerDispatcher.js (111696 => 111697)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotWorkerDispatcher.js	2012-03-22 14:56:33 UTC (rev 111696)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotWorkerDispatcher.js	2012-03-22 15:04:38 UTC (rev 111697)
@@ -48,38 +48,44 @@
     dispatchMessage: function(event)
     {
         var data = ""
-        switch (data.disposition) {
-            case "create": {
-                var constructorFunction = this._findFunction(data.methodName);
-                this._objects[data.objectId] = new constructorFunction();
-                this._postMessage({callId: data.callId});
-                break;
+        var response = {callId: data.callId};
+        try {
+            switch (data.disposition) {
+                case "create": {
+                    var constructorFunction = this._findFunction(data.methodName);
+                    this._objects[data.objectId] = new constructorFunction();
+                    break;
+                }
+                case "dispose": {
+                    delete this._objects[data.objectId];
+                    break;
+                }
+                case "getter": {
+                    var object = this._objects[data.objectId];
+                    var result = object[data.methodName];
+                    response.result = result;
+                    break;
+                }
+                case "factory": {
+                    var object = this._objects[data.objectId];
+                    var result = object[data.methodName].apply(object, data.methodArguments);
+                    if (result)
+                        this._objects[data.newObjectId] = result;
+                    response.result = !!result;
+                    break;
+                }
+                case "method": {
+                    var object = this._objects[data.objectId];
+                    response.result = object[data.methodName].apply(object, data.methodArguments);
+                    break;
+                }
             }
-            case "dispose": {
-                delete this._objects[data.objectId];
-                this._postMessage({callId: data.callId});
-                break;
-            }
-            case "getter": {
-                var object = this._objects[data.objectId];
-                var result = object[data.methodName];
-                this._postMessage({callId: data.callId, result: result});
-                break;
-            }
-            case "factory": {
-                var object = this._objects[data.objectId];
-                var result = object[data.methodName].apply(object, data.methodArguments);
-                if (result)
-                    this._objects[data.newObjectId] = result;
-                this._postMessage({callId: data.callId, result: !!result});
-                break;
-            }
-            case "method": {
-                var object = this._objects[data.objectId];
-                var result = object[data.methodName].apply(object, data.methodArguments);
-                this._postMessage({callId: data.callId, result: result});
-                break;
-            }
+        } catch (e) {
+            response.error = e.toString();
+            response.errorCallStack = e.stack;
+            if (data.methodName)
+                response.errorMethodName = data.methodName;
         }
+        this._postMessage(response);
     }
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to