DoYouEvenBench: Make it work on Internet Explorer 11 Release Preview
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Oct 2013 22:07:48 +0000 (22:07 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 6 Oct 2013 22:07:48 +0000 (22:07 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@157009 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/DoYouEvenBench/benchmark.html

index f9f0128..52f39db 100644 (file)
@@ -1,3 +1,19 @@
+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
index 5cb1de8..bb55289 100644 (file)
@@ -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();
             }
         }],