Skip to content
Permalink
Browse files
2011-02-22 Ilya Tikhonovsky <loislo@chromium.org>
        Reviewed by NOBODY (OOPS!).

        Web Inspector: flakyness of inspector tests.
        https://bugs.webkit.org/show_bug.cgi?id=54729

        As far as we have the protocol with sequence numbers we can simplify test harness support
        and drop out chomium specific methods.

        Source/WebCore:
        * inspector/CodeGeneratorInspector.pm:
        * inspector/front-end/TestController.js:
        (WebInspector.TestController):
        (WebInspector.TestController.prototype.notifyDone):
        (WebInspector.TestController.prototype.runAfterPendingDispatches):
        (WebInspector.TestController.prototype._evaluateForTestInFrontend):
        * inspector/front-end/inspector.js:
        (WebInspector.dispatch):

        Source/WebKit/chromium:
        * src/js/DevTools.js:

        LayoutTests:
        * http/tests/inspector/inspector-test.js:
        (initialize_InspectorTest.InspectorTest.runAfterPendingDispatches):

        Tools:
        * DumpRenderTree/DumpRenderTree.gypi:
        * DumpRenderTree/chromium/DRTDevToolsAgent.cpp:
        (DRTDevToolsAgent::sendMessageToInspectorFrontend):
        (DRTDevToolsAgent::runtimePropertyChanged):
        (DRTDevToolsAgent::asyncCall):
        (DRTDevToolsAgent::call):
        * DumpRenderTree/chromium/DRTDevToolsAgent.h:
        * DumpRenderTree/chromium/DRTDevToolsCallArgs.cpp: Removed.
        * DumpRenderTree/chromium/DRTDevToolsCallArgs.h: Removed.
        * DumpRenderTree/chromium/DRTDevToolsClient.cpp:
        (DRTDevToolsClient::sendMessageToBackend):
        (DRTDevToolsClient::asyncCall):
        (DRTDevToolsClient::call):
        * DumpRenderTree/chromium/DRTDevToolsClient.h:





Canonical link: https://commits.webkit.org/69245@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
loislo committed Feb 22, 2011
1 parent 2d76ea6 commit 0205d75f1e93389ff51c51835adb3ef92f00e0a6
@@ -1,3 +1,16 @@
2011-02-22 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: flakyness of inspector tests.
https://bugs.webkit.org/show_bug.cgi?id=54729

As far as we have the protocol with sequence numbers we can simplify test harness support
and drop out chomium specific methods.

* http/tests/inspector/inspector-test.js:
(initialize_InspectorTest.InspectorTest.runAfterPendingDispatches):

2011-02-22 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.
@@ -129,8 +129,7 @@ InspectorTest.pageReloaded = function()
InspectorTest.runAfterPendingDispatches = function(callback)
{
callback = InspectorTest.safeWrap(callback);

WebInspector.TestController.prototype.runAfterPendingDispatches(callback);
InspectorBackend.runAfterPendingDispatches(callback);
}

InspectorTest.createKeyEvent = function(keyIdentifier)
@@ -1,3 +1,22 @@
2011-02-22 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: flakyness of inspector tests.
https://bugs.webkit.org/show_bug.cgi?id=54729

As far as we have the protocol with sequence numbers we can simplify test harness support
and drop out chomium specific methods.

* inspector/CodeGeneratorInspector.pm:
* inspector/front-end/TestController.js:
(WebInspector.TestController):
(WebInspector.TestController.prototype.notifyDone):
(WebInspector.TestController.prototype.runAfterPendingDispatches):
(WebInspector.TestController.prototype._evaluateForTestInFrontend):
* inspector/front-end/inspector.js:
(WebInspector.dispatch):

2011-02-22 Mario Sanchez Prada <msanchez@igalia.com>

Reviewed by Martin Robinson.
@@ -711,6 +711,7 @@ $licenseTemplate
InspectorBackendStub = function()
{
this._lastCallbackId = 1;
this._pendingResponsesCount = 0;
this._callbacks = {};
this._domainDispatchers = {};
$JSStubs
@@ -720,22 +721,11 @@ InspectorBackendStub.prototype = {
_wrap: function(callback)
{
var callbackId = this._lastCallbackId++;
++this._pendingResponsesCount;
this._callbacks[callbackId] = callback || function() {};
return callbackId;
},
_processResponse: function(callbackId, args)
{
var callback = this._callbacks[callbackId];
callback.apply(null, args);
delete this._callbacks[callbackId];
},
_removeResponseCallbackEntry: function(callbackId)
{
delete this._callbacks[callbackId];
},
_registerDelegate: function(commandInfo)
{
var commandObject = JSON.parse(commandInfo);
@@ -799,11 +789,16 @@ InspectorBackendStub.prototype = {
if ("seq" in messageObject) { // just a response for some request
if (messageObject.success)
this._processResponse(messageObject.seq, arguments);
else {
this._removeResponseCallbackEntry(messageObject.seq)
this._callbacks[messageObject.seq].apply(null, arguments);
else
this.reportProtocolError(messageObject);
}
--this._pendingResponsesCount;
delete this._callbacks[messageObject.seq];
if (this._scripts && !this._pendingResponsesCount)
this.runAfterPendingDispatches();
return;
}
@@ -826,7 +821,22 @@ InspectorBackendStub.prototype = {
console.error("Protocol Error: InspectorBackend request with seq = " + messageObject.seq + " failed.");
for (var i = 0; i < messageObject.errors.length; ++i)
console.error(" " + messageObject.errors[i]);
this._removeResponseCallbackEntry(messageObject.seq);
},
runAfterPendingDispatches: function(script)
{
if (!this._scripts)
this._scripts = [];
if (script)
this._scripts.push(script);
if (!this._pendingResponsesCount) {
var scripts = this._scripts;
this._scripts = []
for (var id = 0; id < scripts.length; ++id)
scripts[id].call(this);
}
}
}
@@ -28,40 +28,20 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

WebInspector.TestController = function(callId)
WebInspector.TestController = function()
{
this._callId = callId;
this._waitUntilDone = false;
this.results = [];
}

WebInspector.TestController.prototype = {
waitUntilDone: function()
notifyDone: function(callId, result)
{
this._waitUntilDone = true;
},

notifyDone: function(result)
{
if (typeof result === "undefined" && this.results.length)
result = this.results;
var message = typeof result === "undefined" ? "\"<undefined>\"" : JSON.stringify(result);
InspectorAgent.didEvaluateForTestInFrontend(this._callId, message);
},

runAfterPendingDispatches: function(callback)
{
if (WebInspector.pendingDispatches === 0) {
callback();
return;
}
setTimeout(this.runAfterPendingDispatches.bind(this), 0, callback);
InspectorAgent.didEvaluateForTestInFrontend(callId, message);
}
}

WebInspector.evaluateForTestInFrontend = function(callId, script)
{
var controller = new WebInspector.TestController(callId);
function invokeMethod()
{
try {
@@ -71,11 +51,10 @@ WebInspector.evaluateForTestInFrontend = function(callId, script)
else
result = window.eval(script);

if (!controller._waitUntilDone)
controller.notifyDone(result);
WebInspector.TestController.prototype.notifyDone(callId, result);
} catch (e) {
controller.notifyDone(e.toString());
WebInspector.testController.prototype.notifyDone(callId, e.toString());
}
}
controller.runAfterPendingDispatches(invokeMethod);
InspectorBackend.runAfterPendingDispatches(invokeMethod);
}
@@ -592,13 +592,7 @@ window.addEventListener("DOMContentLoaded", windowLoaded, false);
WebInspector.dispatch = function(message) {
// We'd like to enforce asynchronous interaction between the inspector controller and the frontend.
// This is important to LayoutTests.
function delayDispatch()
{
InspectorBackend.dispatch(message);
WebInspector.pendingDispatches--;
}
WebInspector.pendingDispatches++;
setTimeout(delayDispatch, 0);
setTimeout(InspectorBackend.dispatch.bind(InspectorBackend), 0, message);
}

WebInspector.dispatchMessageFromBackend = function(messageObject)
@@ -1,3 +1,15 @@
2011-02-22 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: flakyness of inspector tests.
https://bugs.webkit.org/show_bug.cgi?id=54729

As far as we have the protocol with sequence numbers we can simplify test harness support
and drop out chomium specific methods.

* src/js/DevTools.js:

2011-02-21 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Pavel Feldman.
@@ -130,26 +130,6 @@ WebInspector.openLinkExternallyLabel = function()



///////////////////////////////////////////
// Chromium layout test harness support. //
///////////////////////////////////////////

WebInspector.runAfterPendingDispatchesQueue = [];

WebInspector.TestController.prototype.runAfterPendingDispatches = function(callback)
{
WebInspector.runAfterPendingDispatchesQueue.push(callback);
};

WebInspector.queuesAreEmpty = function()
{
var copy = this.runAfterPendingDispatchesQueue.slice();
this.runAfterPendingDispatchesQueue = [];
for (var i = 0; i < copy.length; ++i)
copy[i].call(this);
};


/////////////////////////////
// Chromium theme support. //
/////////////////////////////
@@ -1,3 +1,28 @@
2011-02-22 Ilya Tikhonovsky <loislo@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: flakyness of inspector tests.
https://bugs.webkit.org/show_bug.cgi?id=54729

As far as we have the protocol with sequence numbers we can simplify test harness support
and drop out chomium specific methods.

* DumpRenderTree/DumpRenderTree.gypi:
* DumpRenderTree/chromium/DRTDevToolsAgent.cpp:
(DRTDevToolsAgent::sendMessageToInspectorFrontend):
(DRTDevToolsAgent::runtimePropertyChanged):
(DRTDevToolsAgent::asyncCall):
(DRTDevToolsAgent::call):
* DumpRenderTree/chromium/DRTDevToolsAgent.h:
* DumpRenderTree/chromium/DRTDevToolsCallArgs.cpp: Removed.
* DumpRenderTree/chromium/DRTDevToolsCallArgs.h: Removed.
* DumpRenderTree/chromium/DRTDevToolsClient.cpp:
(DRTDevToolsClient::sendMessageToBackend):
(DRTDevToolsClient::asyncCall):
(DRTDevToolsClient::call):
* DumpRenderTree/chromium/DRTDevToolsClient.h:

2011-02-22 Andras Becsi <abecsi@webkit.org>

Reviewed by Laszlo Gombos.
@@ -11,8 +11,6 @@
'chromium/CppVariant.h',
'chromium/DRTDevToolsAgent.cpp',
'chromium/DRTDevToolsAgent.h',
'chromium/DRTDevToolsCallArgs.cpp',
'chromium/DRTDevToolsCallArgs.h',
'chromium/DRTDevToolsClient.cpp',
'chromium/DRTDevToolsClient.h',
'chromium/DumpRenderTree.cpp',
@@ -31,12 +31,10 @@
#include "config.h"
#include "DRTDevToolsAgent.h"

#include "DRTDevToolsCallArgs.h"
#include "DRTDevToolsClient.h"

#include "WebCString.h"
#include "WebDevToolsAgent.h"
#include "WebString.h"
#include "WebView.h"
#include "webkit/support/webkit_support.h"

@@ -63,13 +61,13 @@ void DRTDevToolsAgent::setWebView(WebView* webView)
m_webView = webView;
}

void DRTDevToolsAgent::sendMessageToInspectorFrontend(const WebKit::WebString& data)
void DRTDevToolsAgent::sendMessageToInspectorFrontend(const WebString& data)
{
if (m_drtDevToolsClient)
m_drtDevToolsClient->asyncCall(DRTDevToolsCallArgs(data));
m_drtDevToolsClient->asyncCall(data);
}

void DRTDevToolsAgent::runtimePropertyChanged(const WebKit::WebString& name, const WebKit::WebString& value)
void DRTDevToolsAgent::runtimePropertyChanged(const WebString& name, const WebString& value)
{
// FIXME: Implement.
}
@@ -84,18 +82,16 @@ WebDevToolsAgentClient::WebKitClientMessageLoop* DRTDevToolsAgent::createClientM
return webkit_support::CreateDevToolsMessageLoop();
}

void DRTDevToolsAgent::asyncCall(const DRTDevToolsCallArgs& args)
void DRTDevToolsAgent::asyncCall(const WebString& args)
{
postTask(new AsyncCallTask(this, args));
}

void DRTDevToolsAgent::call(const DRTDevToolsCallArgs &args)
void DRTDevToolsAgent::call(const WebString& args)
{
WebDevToolsAgent* agent = webDevToolsAgent();
if (agent)
agent->dispatchOnInspectorBackend(args.m_data);
if (DRTDevToolsCallArgs::callsCount() == 1 && m_drtDevToolsClient)
m_drtDevToolsClient->allMessagesProcessed();
agent->dispatchOnInspectorBackend(args);
}

void DRTDevToolsAgent::delayedFrontendLoaded()
@@ -31,17 +31,16 @@
#ifndef DRTDevToolsAgent_h
#define DRTDevToolsAgent_h

#include "DRTDevToolsCallArgs.h"
#include "Task.h"
#include "WebDevToolsAgentClient.h"
#include "WebString.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>

namespace WebKit {

class WebCString;
class WebDevToolsAgent;
class WebString;
class WebView;
struct WebDevToolsMessageData;

@@ -65,7 +64,7 @@ class DRTDevToolsAgent : public WebKit::WebDevToolsAgentClient {
virtual WebKit::WebCString debuggerScriptSource();
virtual WebKitClientMessageLoop* createClientMessageLoop();

void asyncCall(const DRTDevToolsCallArgs&);
void asyncCall(const WebKit::WebString& args);

void attach(DRTDevToolsClient*);
void detach();
@@ -76,18 +75,18 @@ class DRTDevToolsAgent : public WebKit::WebDevToolsAgentClient {
TaskList* taskList() { return &m_taskList; }

private:
void call(const DRTDevToolsCallArgs&);
void call(const WebKit::WebString& args);
void delayedFrontendLoaded();
static void dispatchMessageLoop();
WebKit::WebDevToolsAgent* webDevToolsAgent();

class AsyncCallTask: public MethodTask<DRTDevToolsAgent> {
public:
AsyncCallTask(DRTDevToolsAgent* object, const DRTDevToolsCallArgs& args)
AsyncCallTask(DRTDevToolsAgent* object, const WebKit::WebString& args)
: MethodTask<DRTDevToolsAgent>(object), m_args(args) {}
virtual void runIfValid() { m_object->call(m_args); }
private:
DRTDevToolsCallArgs m_args;
WebKit::WebString m_args;
};

struct DelayedFrontendLoadedTask: public MethodTask<DRTDevToolsAgent> {

0 comments on commit 0205d75

Please sign in to comment.