[Webkit-unassigned] [Bug 56981] CSSStyleSheet#insertRule doesn't work well with imported stylesheets

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu May 26 10:19:17 PDT 2011


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


Simon Fraser (smfr) <simon.fraser at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #94996|review?, commit-queue?      |review-, commit-queue-
               Flag|                            |




--- Comment #7 from Simon Fraser (smfr) <simon.fraser at apple.com>  2011-05-26 10:19:17 PST ---
(From update of attachment 94996)
View in context: https://bugs.webkit.org/attachment.cgi?id=94996&action=review

> LayoutTests/fast/css/import-and-insert-rule-no-update.html:39
> +        var testArea = document.getElementById("testArea");
> +        if (getComputedStyle(testArea).backgroundColor == "rgb(0, 128, 0)") {
> +            testArea.innerHTML = 'PASS';
> +            remainingTests = 0;
> +        } else {
> +            if (--remainingTests)
> +                testArea.innerHTML = 'FAIL, backgroundColor was ' + getComputedStyle(testArea).backgroundColor;
> +        }
> +    } catch (e) {
> +        testArea.innerHTML = 'FAIL, exception raised (' + e.message + ')';
> +        remainingTests = 0;
> +    }
> +    if (!remainingTests)
> +        window.setTimeout(test, 25);
> +    if (window.layoutTestController)
> +        layoutTestController.notifyDone();
> +}
> +
> +window.onload = function() {
> +    document.styleSheets[0].insertRule('@import "green.css";', 1);
> +    // We need to wait some time to let the stylesheet load before testing.
> +    window.setTimeout(test, 25);

This is a confusing way to wait for the stylesheet. I'd much prefer to centralize the wait logic in one function, which should call the "doTest" function when it detects that the load is complete.

Do you expect exceptions to fire here? We don't normally test for them.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list