Title: [108965] trunk/Source/WebCore
Revision
108965
Author
[email protected]
Date
2012-02-27 00:42:23 -0800 (Mon, 27 Feb 2012)

Log Message

Web Inspector: crash in fake workers
https://bugs.webkit.org/show_bug.cgi?id=79637

Notify front-end about worker creation/destruction synchronously instead of
posting a task.

Reviewed by Pavel Feldman.

* inspector/InspectorAgent.cpp:
(WebCore):
(WebCore::InspectorAgent::didCreateWorker):
(WebCore::InspectorAgent::didDestroyWorker):
* inspector/InspectorAgent.h:
(InspectorAgent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108964 => 108965)


--- trunk/Source/WebCore/ChangeLog	2012-02-27 08:40:13 UTC (rev 108964)
+++ trunk/Source/WebCore/ChangeLog	2012-02-27 08:42:23 UTC (rev 108965)
@@ -1,3 +1,20 @@
+2012-02-26  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: crash in fake workers
+        https://bugs.webkit.org/show_bug.cgi?id=79637
+
+        Notify front-end about worker creation/destruction synchronously instead of
+        posting a task.
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/InspectorAgent.cpp:
+        (WebCore):
+        (WebCore::InspectorAgent::didCreateWorker):
+        (WebCore::InspectorAgent::didDestroyWorker):
+        * inspector/InspectorAgent.h:
+        (InspectorAgent):
+
 2012-02-26  Adam Barth  <[email protected]>
 
         Unreviewed.

Modified: trunk/Source/WebCore/inspector/InspectorAgent.cpp (108964 => 108965)


--- trunk/Source/WebCore/inspector/InspectorAgent.cpp	2012-02-27 08:40:13 UTC (rev 108964)
+++ trunk/Source/WebCore/inspector/InspectorAgent.cpp	2012-02-27 08:42:23 UTC (rev 108965)
@@ -159,50 +159,6 @@
 }
 
 #if ENABLE(WORKERS)
-class PostWorkerNotificationToFrontendTask : public ScriptExecutionContext::Task {
-public:
-    static PassOwnPtr<PostWorkerNotificationToFrontendTask> create(PassRefPtr<InspectorWorkerResource> worker, InspectorAgent::WorkerAction action)
-    {
-        return adoptPtr(new PostWorkerNotificationToFrontendTask(worker, action));
-    }
-
-private:
-    PostWorkerNotificationToFrontendTask(PassRefPtr<InspectorWorkerResource> worker, InspectorAgent::WorkerAction action)
-        : m_worker(worker)
-        , m_action(action)
-    {
-    }
-
-    virtual void performTask(ScriptExecutionContext* scriptContext)
-    {
-        if (scriptContext->isDocument()) {
-            if (InspectorAgent* inspectorAgent = static_cast<Document*>(scriptContext)->page()->inspectorController()->m_inspectorAgent)
-                inspectorAgent->postWorkerNotificationToFrontend(*m_worker, m_action);
-        }
-    }
-
-private:
-    RefPtr<InspectorWorkerResource> m_worker;
-    InspectorAgent::WorkerAction m_action;
-};
-
-void InspectorAgent::postWorkerNotificationToFrontend(const InspectorWorkerResource& worker, InspectorAgent::WorkerAction action)
-{
-    if (!m_frontend || !m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled))
-        return;
-
-#if ENABLE(_javascript__DEBUGGER)
-    switch (action) {
-    case InspectorAgent::WorkerCreated:
-        m_frontend->inspector()->didCreateWorker(worker.id(), worker.url(), worker.isSharedWorker());
-        break;
-    case InspectorAgent::WorkerDestroyed:
-        m_frontend->inspector()->didDestroyWorker(worker.id());
-        break;
-    }
-#endif
-}
-
 void InspectorAgent::didCreateWorker(intptr_t id, const String& url, bool isSharedWorker)
 {
     if (!developerExtrasEnabled())
@@ -210,8 +166,10 @@
 
     RefPtr<InspectorWorkerResource> workerResource(InspectorWorkerResource::create(id, url, isSharedWorker));
     m_workers.set(id, workerResource);
+#if ENABLE(_javascript__DEBUGGER)
     if (m_inspectedPage && m_frontend && m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled))
-        m_inspectedPage->mainFrame()->document()->postTask(PostWorkerNotificationToFrontendTask::create(workerResource, InspectorAgent::WorkerCreated));
+        m_frontend->inspector()->didCreateWorker(id, url, isSharedWorker);
+#endif
 }
 
 void InspectorAgent::didDestroyWorker(intptr_t id)
@@ -222,8 +180,10 @@
     WorkersMap::iterator workerResource = m_workers.find(id);
     if (workerResource == m_workers.end())
         return;
+#if ENABLE(_javascript__DEBUGGER)
     if (m_inspectedPage && m_frontend && m_state->getBoolean(InspectorAgentState::inspectorAgentEnabled))
-        m_inspectedPage->mainFrame()->document()->postTask(PostWorkerNotificationToFrontendTask::create(workerResource->second, InspectorAgent::WorkerDestroyed));
+        m_frontend->inspector()->didDestroyWorker(id);
+#endif
     m_workers.remove(workerResource);
 }
 #endif // ENABLE(WORKERS)

Modified: trunk/Source/WebCore/inspector/InspectorAgent.h (108964 => 108965)


--- trunk/Source/WebCore/inspector/InspectorAgent.h	2012-02-27 08:40:13 UTC (rev 108964)
+++ trunk/Source/WebCore/inspector/InspectorAgent.h	2012-02-27 08:42:23 UTC (rev 108965)
@@ -83,9 +83,6 @@
     void emitCommitLoadIfNeeded();
 
 #if ENABLE(WORKERS)
-    enum WorkerAction { WorkerCreated, WorkerDestroyed };
-
-    void postWorkerNotificationToFrontend(const InspectorWorkerResource&, WorkerAction);
     void didCreateWorker(intptr_t, const String& url, bool isSharedWorker);
     void didDestroyWorker(intptr_t);
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to