Commit 3a43ae35 authored by rniwa@webkit.org's avatar rniwa@webkit.org

DoYouEvenBench: Make it work on Internet Explorer 11 Release Preview

https://bugs.webkit.org/show_bug.cgi?id=122406

Reviewed by Darin Adler.

On Internet Explorer 11, $(elem).closest('li').data('id') fails to find the containig li of elem once
the first item is marked complete or deleted until we get back to the event loop in the jQuery/TodoMVC.
Worked around this limitation by overriding app.getTodo to use each item's id computed in advance.

Also use $.text instead of execCommand('InsertText') in FlightJS/MailClient since Internet Explorer
doesn't support execCommand('InsertText'). Also select the recipient to avoid exceptions.

* DoYouEvenBench/benchmark.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157009 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7f635956
2013-10-06 Ryosuke Niwa <rniwa@webkit.org>
DoYouEvenBench: Make it work on Internet Explorer 11 Release Preview
https://bugs.webkit.org/show_bug.cgi?id=122406
Reviewed by Darin Adler.
On Internet Explorer 11, $(elem).closest('li').data('id') fails to find the containig li of elem once
the first item is marked complete or deleted until we get back to the event loop in the jQuery/TodoMVC.
Worked around this limitation by overriding app.getTodo to use each item's id computed in advance.
Also use $.text instead of execCommand('InsertText') in FlightJS/MailClient since Internet Explorer
doesn't support execCommand('InsertText'). Also select the recipient to avoid exceptions.
* DoYouEvenBench/benchmark.html:
2013-10-05 Ryosuke Niwa <rniwa@webkit.org>
DoYouEvenBench: Add Facebook's React TodoMVC test case
......
......@@ -125,19 +125,42 @@ BenchmarkRunner.suite({
for (var i = 0; i < numberOfItemsToAdd; i++) {
newTodo.value = 'Something to do ' + i;
app.create.call(newTodo, fakeEvent);
}
}
}],
['CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
var app = contentWindow.app;
var checkboxes = contentDocument.querySelectorAll('.toggle');
var $ = contentWindow.$;
itemIndexToId = new Array(checkboxes.length);
for (var i = 0; i < checkboxes.length; i++)
app.toggle.call(checkboxes[i]);
itemIndexToId[i] = $(checkboxes[i]).closest('li').data('id');
app.getTodo = function (element, callback) {
var self = this;
var id = itemIndexToId[this.currentItemIndex];
$.each(this.todos, function (j, val) {
if (val.id === id) {
callback.apply(self, arguments);
return false;
}
});
}
for (var i = 0; i < checkboxes.length; i++) {
app.currentItemIndex = i;
app.toggle.call(checkboxes[i]);
}
}],
['DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
contentDocument.querySelector('#clear-completed').click();
var app = contentWindow.app;
var deleteButtons = contentDocument.querySelectorAll('.destroy');
for (var i = 0; i < deleteButtons.length; i++)
app.destroy.call(deleteButtons[i]);
for (var i = 0; i < deleteButtons.length; i++) {
app.currentItemIndex = i;
app.destroy.call(deleteButtons[i]);
}
}],
]
});
......@@ -252,14 +275,15 @@ BenchmarkRunner.suite({
['Sending' + actionCount + 'NewEmails', function (newTodo, contentWindow, contentDocument) {
for (var i = 0; i < actionCount; i++) {
contentDocument.getElementById('new_mail').click();
contentDocument.getElementById('recipient_select').selectedIndex = 1;
var subject = contentDocument.getElementById('compose_subject');
var message = contentDocument.getElementById('compose_message');
subject.focus();
contentWindow.$(subject).trigger('keydown');
contentDocument.execCommand('InsertText', false, 'Hello');
contentWindow.$(subject).text('Hello');
message.focus();
contentWindow.$(message).trigger('keydown');
contentDocument.execCommand('InsertText', false, 'Hello,\n\nThis is a test message.\n\n- WebKitten');
contentWindow.$(message).text('Hello,\n\nThis is a test message.\n\n- WebKitten');
contentDocument.getElementById('send_composed').click();
}
}],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment