Changeset 91029 in webkit


Ignore:
Timestamp:
Jul 14, 2011 2:49:53 PM (13 years ago)
Author:
Adam Roben
Message:

Don't use Element.prototype.classList in TestFailures

Safari 5 doesn't support it.

Fixes <http://webkit.org/b/64550> Can't expand flaky tests on TestFailures page in Safari 5

Reviewed by Daniel Bates.

  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Utilities.js:

(Element.prototype.hasStyleClass):
(Element.prototype.addStyleClass):
(Element.prototype.removeStyleClass):
(Element.prototype.toggleStyleClass):
Added these helper functions which simulate classList functionality.

  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Utilities_unittests.js:

Added. Tests for the above.

  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:

(ViewController.prototype._domForPossiblyFlakyTests): Changed to use
toggleStyleClass/hasStyleClass instead of classList.

  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html:

Added Utilities_unittests.js, and reordered the tested files to be in
roughly dependency order (i.e., the lowest-level files are imported
and tested first).

Location:
trunk/Tools
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Utilities.js

    r90489 r91029  
    141141}
    142142
     143Element.prototype.hasStyleClass = function(klass) {
     144    var regex = new RegExp('\\b' + klass + '\\b');
     145    return regex.test(this.className);
     146}
     147
     148Element.prototype.addStyleClass = function(klass) {
     149    if (this.hasStyleClass(klass))
     150        return;
     151    this.className += ' ' + klass;
     152}
     153
     154Element.prototype.removeStyleClass = function(klass) {
     155    var regex = new RegExp('\\b' + klass + '\\b', 'g');
     156    this.className = this.className.replace(regex, '');
     157}
     158
     159Element.prototype.toggleStyleClass = function(klass) {
     160    if (this.hasStyleClass(klass))
     161        this.removeStyleClass(klass);
     162    else
     163        this.addStyleClass(klass);
     164}
     165
    143166Node.prototype.appendChildren = function(children) {
    144167    for (var i = 0; i < children.length; ++i)
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js

    r90922 r91029  
    437437
    438438            disclosureTriangle.addEventListener('click', function() {
    439                 item.classList.toggle('expanded');
    440                 if (!item.classList.contains('expanded')) {
     439                item.toggleStyleClass('expanded');
     440                if (!item.hasStyleClass('expanded')) {
    441441                    failureList.style.height = '';
    442442                    return;
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html

    r90922 r91029  
    1414<!-- FIXME: We should have tests for these files! -->
    1515<script src="Bugzilla.js"></script>
     16
    1617<script src="Utilities.js"></script>
     18<script src="Utilities_unittests.js"></script>
     19
     20<script src="NewBugForm.js"></script>
     21<script src="NewBugForm_unittests.js"></script>
     22
     23<script src="FlakyLayoutTestDetector.js"></script>
     24<script src="FlakyLayoutTestDetector_unittests.js"></script>
    1725
    1826<script src="Buildbot.js"></script>
    1927<script src="Buildbot_unittests.js"></script>
     28
    2029<script src="Builder.js"></script>
    2130<script src="Builder_unittests.js"></script>
    22 <script src="FlakyLayoutTestDetector.js"></script>
    23 <script src="FlakyLayoutTestDetector_unittests.js"></script>
    24 <script src="NewBugForm.js"></script>
    25 <script src="NewBugForm_unittests.js"></script>
     31
    2632<script src="TestFailureBugForm.js"></script>
    2733<script src="TestFailureBugForm_unittests.js"></script>
  • trunk/Tools/ChangeLog

    r91028 r91029  
     12011-07-14  Adam Roben  <aroben@apple.com>
     2
     3        Don't use Element.prototype.classList in TestFailures
     4
     5        Safari 5 doesn't support it.
     6
     7        Fixes <http://webkit.org/b/64550> Can't expand flaky tests on TestFailures page in Safari 5
     8
     9        Reviewed by Daniel Bates.
     10
     11        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Utilities.js:
     12        (Element.prototype.hasStyleClass):
     13        (Element.prototype.addStyleClass):
     14        (Element.prototype.removeStyleClass):
     15        (Element.prototype.toggleStyleClass):
     16        Added these helper functions which simulate classList functionality.
     17
     18        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Utilities_unittests.js:
     19        Added. Tests for the above.
     20
     21        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
     22        (ViewController.prototype._domForPossiblyFlakyTests): Changed to use
     23        toggleStyleClass/hasStyleClass instead of classList.
     24
     25        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/run-unittests.html:
     26        Added Utilities_unittests.js, and reordered the tested files to be in
     27        roughly dependency order (i.e., the lowest-level files are imported
     28        and tested first).
     29
    1302011-07-14  Eric Seidel  <eric@webkit.org>
    231
Note: See TracChangeset for help on using the changeset viewer.