[webkit-changes] cvs commit: WebCore/layout-tests/fast/js exception-linenums.html

Darin darin at opensource.apple.com
Wed Jun 22 09:38:03 PDT 2005


darin       05/06/22 09:38:03

  Modified:    .        ChangeLog
               khtml/ecma kjs_css.cpp
               layout-tests/fast/js exception-linenums.html
  Added:       layout-tests/fast/dom
                        css-set-property-exception-expected.txt
                        css-set-property-exception.html
  Log:
          Reviewed by John Sullivan.
  
          Test cases added:
          * layout-tests/fast/dom/css-set-property-exception-expected.txt: Added.
          * layout-tests/fast/dom/css-set-property-exception.html: Added.
  
          - fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3616>
            RSS search field, Dashboard widgets failing due to CSS exception
  
          * khtml/ecma/kjs_css.cpp: (KJS::DOMCSSStyleDeclaration::tryPut):
          Ignore exceptions when setting properties.
  
          * layout-tests/fast/js/exception-linenums.html: Changed test case that
          involved setting style to one that involved setting another property that
          raises an exception when you try to set it (setting prefix on a text node).
  
  Revision  Changes    Path
  1.4299    +18 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4298
  retrieving revision 1.4299
  diff -u -r1.4298 -r1.4299
  --- ChangeLog	22 Jun 2005 15:30:00 -0000	1.4298
  +++ ChangeLog	22 Jun 2005 16:37:59 -0000	1.4299
  @@ -1,5 +1,23 @@
   2005-06-22  Darin Adler  <darin at apple.com>
   
  +        Reviewed by John Sullivan.
  +
  +        Test cases added:
  +        * layout-tests/fast/dom/css-set-property-exception-expected.txt: Added.
  +        * layout-tests/fast/dom/css-set-property-exception.html: Added.
  +
  +        - fixed <http://bugzilla.opendarwin.org/show_bug.cgi?id=3616>
  +          RSS search field, Dashboard widgets failing due to CSS exception
  +
  +        * khtml/ecma/kjs_css.cpp: (KJS::DOMCSSStyleDeclaration::tryPut):
  +        Ignore exceptions when setting properties.
  +
  +        * layout-tests/fast/js/exception-linenums.html: Changed test case that
  +        involved setting style to one that involved setting another property that
  +        raises an exception when you try to set it (setting prefix on a text node).
  +
  +2005-06-22  Darin Adler  <darin at apple.com>
  +
           Change proposed by Eric Seidel.
   
           * WebCore.pbproj/project.pbxproj: Fix build rule to match the one in JavaScriptCore.
  
  
  
  1.26      +11 -2     WebCore/khtml/ecma/kjs_css.cpp
  
  Index: kjs_css.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/ecma/kjs_css.cpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- kjs_css.cpp	22 Jun 2005 00:48:44 -0000	1.25
  +++ kjs_css.cpp	22 Jun 2005 16:38:02 -0000	1.26
  @@ -216,8 +216,17 @@
         kdDebug(6070) << "DOMCSSStyleDeclaration: prop=" << prop << " propvalue=" << propvalue << endl;
   #endif
         styleDecl.removeProperty(prop, exception);
  -      if (!exception && !propvalue.isEmpty())
  -        styleDecl.setProperty(prop, DOMString(propvalue), "", exception); // ### is "" ok for priority?
  +      if (!exception && !propvalue.isEmpty()) {
  +        // We have to ignore exceptions here, because of the following unfortunate situation:
  +        //   1) Older versions ignored exceptions here by accident, because the put function
  +        //      that translated exceptions did not translate CSS exceptions.
  +        //   2) Gecko does not raise an exception in this case, although WinIE does.
  +        //   3) At least some Dashboard widgets are depending on this behavior.
  +        // It would be nice to fix this some day, perhaps with some kind of "quirks mode",
  +        // but it's likely that the Dashboard widgets are already using a strict mode DOCTYPE.
  +        int ignoreException = 0;
  +        styleDecl.setProperty(prop, DOMString(propvalue), "", ignoreException);
  +      }
       } else {
         DOMObject::tryPut(exec, propertyName, value, attr);
       }
  
  
  
  1.1                  WebCore/layout-tests/fast/dom/css-set-property-exception-expected.txt
  
  Index: css-set-property-exception-expected.txt
  ===================================================================
  This test checks to see whether you get exceptions when setting a property with a "bad value". We preserve our historic behavior of never raising an exception when you set a CSS property using JavaScript property syntax. But we do raise exceptions when setting a property with setProperty.
  
  The results below should show four successes, followed by two exceptions.
  
  This is the test element.
  
  Successfully set display to "block"; value is now "block".
  Successfully set display to ""; value is now "".
  Successfully set display to null; value is now "".
  Successfully set display to "block" with setProperty; value is now "block".
  Got exception trying to set display to "" with setProperty; value is now "".
  Got exception trying to set display to null with setProperty; value is now "".
  
  
  
  
  1.1                  WebCore/layout-tests/fast/dom/css-set-property-exception.html
  
  Index: css-set-property-exception.html
  ===================================================================
  <html>
  <head>
  <script>
  function log(message)
  {
      var item = document.createElement("li");
      item.appendChild(document.createTextNode(message));
      document.getElementById("console").appendChild(item);
  }
  function test()
  {
      if (window.layoutTestController)
          layoutTestController.dumpAsText();
  
      var e = document.getElementById('e');
  
      e.style.display = "none";
      try {
          e.style.display = "block";
          log("Successfully set display to \"block\"; value is now \"" + e.style.display + "\".");
      } catch (exception) {
          log("Got exception trying to set display to \"block\"; value is now \"" + e.style.display + "\".");
      }
  
      e.style.display = "none";
      try {
          e.style.display = "";
          log("Successfully set display to \"\"; value is now \"" + e.style.display + "\".");
      } catch (exception) {
          log("Got exception trying to set display to \"\"; value is now \"" + e.style.display + "\".");
      }
  
      e.style.display = "none";
      try {
          e.style.display = null;
          log("Successfully set display to null; value is now \"" + e.style.display + "\".");
      } catch (exception) {
          log("Got exception trying to set display to null; value is now \"" + e.style.display + "\".");
      }
  
      e.style.display = "none";
      try {
          e.style.setProperty("display", "block", "");
          log("Successfully set display to \"block\" with setProperty; value is now \"" + e.style.display + "\".");
      } catch (exception) {
          log("Got exception trying to set display to \"block\" with setProperty; value is now \"" + e.style.display + "\".");
      }
  
      e.style.display = "none";
      try {
          e.style.setProperty("display", "", "");
          log("Successfully set display to \"\" with setProperty; value is now \"" + e.style.display + "\".");
      } catch (exception) {
          log("Got exception trying to set display to \"\" with setProperty; value is now \"" + e.style.display + "\".");
      }
  
      e.style.display = "none";
      try {
          e.style.setProperty("display", null, "");
          log("Successfully set display to null with setProperty; value is now \"" + e.style.display + "\".");
      } catch (exception) {
          log("Got exception trying to set display to null with setProperty; value is now \"" + e.style.display + "\".");
      }
  }
  </script>
  </head>
  <body onload="test();">
  <p>This test checks to see whether you get exceptions when setting a property with a "bad value".
  We preserve our historic behavior of never raising an exception when you set a CSS property using JavaScript property syntax.
  But we do raise exceptions when setting a property with setProperty.</p>
  <p>The results below should show four successes, followed by two exceptions.</p>
  <hr>
  <p id="e">This is the test element.</p>
  <hr>
  <ol id="console"></ol>
  </body>
  </html>
  
  
  
  1.2       +1 -1      WebCore/layout-tests/fast/js/exception-linenums.html
  
  Index: exception-linenums.html
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/fast/js/exception-linenums.html,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- exception-linenums.html	10 Jun 2005 18:02:57 -0000	1.1
  +++ exception-linenums.html	22 Jun 2005 16:38:03 -0000	1.2
  @@ -42,7 +42,7 @@
   
                   try {
                       // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONVALUE
  -                    document.documentElement.style.backgroundColor = 'as';
  +                    document.documentElement.appendChild('').prefix = '';
                       expectedException();
                   } catch (e) {
                       writeException(e);
  
  
  



More information about the webkit-changes mailing list