[webkit-changes] cvs commit: WebCore/layout-tests/fast/events init-event-null-view-expected.txt init-event-null-view.html

Darin darin at opensource.apple.com
Mon Aug 8 15:29:40 PDT 2005


darin       05/08/08 15:29:39

  Modified:    .        ChangeLog
               khtml/xml dom2_eventsimpl.cpp
  Added:       layout-tests/fast/events init-event-null-view-expected.txt
                        init-event-null-view.html
  Log:
          Reviewed by John.
  
          - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4298
            JS crash with DOM2 mouse event with incorrect view
  
          Test cases added:
          * layout-tests/fast/events/init-event-null-view-expected.txt: Added.
          * layout-tests/fast/events/init-event-null-view.html: Added.
  
          * khtml/xml/dom2_eventsimpl.cpp: (MouseRelatedEventImpl::computeLayerPos): Added nil check.
  
  Revision  Changes    Path
  1.4543    +13 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4542
  retrieving revision 1.4543
  diff -u -r1.4542 -r1.4543
  --- ChangeLog	8 Aug 2005 21:11:52 -0000	1.4542
  +++ ChangeLog	8 Aug 2005 22:29:35 -0000	1.4543
  @@ -1,3 +1,16 @@
  +2005-08-08  Darin Adler  <darin at apple.com>
  +
  +        Reviewed by John.
  +
  +        - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=4298
  +          JS crash with DOM2 mouse event with incorrect view
  +
  +        Test cases added:
  +        * layout-tests/fast/events/init-event-null-view-expected.txt: Added.
  +        * layout-tests/fast/events/init-event-null-view.html: Added.
  +
  +        * khtml/xml/dom2_eventsimpl.cpp: (MouseRelatedEventImpl::computeLayerPos): Added nil check.
  +
   2005-08-08  David Hyatt  <hyatt at apple.com>
   
   	This patch implements support for <input type=radio> in the engine and removes the NSView-based
  
  
  
  1.35      +11 -5     WebCore/khtml/xml/dom2_eventsimpl.cpp
  
  Index: dom2_eventsimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom2_eventsimpl.cpp,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- dom2_eventsimpl.cpp	31 May 2005 05:48:41 -0000	1.34
  +++ dom2_eventsimpl.cpp	8 Aug 2005 22:29:39 -0000	1.35
  @@ -35,6 +35,8 @@
   
   using namespace DOM;
   
  +using khtml::RenderObject;
  +
   EventImpl::EventImpl()
   {
       m_type = 0;
  @@ -412,14 +414,18 @@
       m_layerX = m_clientX;
       m_layerY = m_clientY;
   
  -    DocumentImpl *doc = view()->document();
  -
  -    if (!doc || !doc->renderer()) {
  +    AbstractViewImpl *av = view();
  +    if (!av)
  +        return;
  +    DocumentImpl *doc = av->document();
  +    if (!doc)
   	return;
  -    }
  +    RenderObject *docRenderer = doc->renderer();
  +    if (!docRenderer)
  +        return;
   
       khtml::RenderObject::NodeInfo renderInfo(true, false);
  -    doc->renderer()->layer()->hitTest(renderInfo, m_clientX, m_clientY);
  +    docRenderer->layer()->hitTest(renderInfo, m_clientX, m_clientY);
   
       NodeImpl *node = renderInfo.innerNonSharedNode();
       while (node && !node->renderer()) {
  
  
  
  1.1                  WebCore/layout-tests/fast/events/init-event-null-view-expected.txt
  
  Index: init-event-null-view-expected.txt
  ===================================================================
  This is a regression test for bug 4298. Without the bug fix it causes a crash.
  
  Successfully created a mouse event object without a view and didn't crash.
  
  
  
  
  
  1.1                  WebCore/layout-tests/fast/events/init-event-null-view.html
  
  Index: init-event-null-view.html
  ===================================================================
  <head>
  <script>
  function print(message)
  {
      var paragraph = document.createElement("p");
      paragraph.appendChild(document.createTextNode(message));
      document.getElementById("console").appendChild(paragraph);
  }
  function test()
  {
      if (window.layoutTestController)
          layoutTestController.dumpAsText();
  
      var ev = document.createEvent("MouseEvent");
      ev.initMouseEvent("click", true, true, null, 1, 1, 1, 1, 1, false, false, false, false, 0, document);
      print("Successfully created a mouse event object without a view and didn't crash.");
  }
  </script>
  </head>
  <body onload="test()" id="root">
  <p>This is a regression test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=4298">bug 4298</a>. Without the bug fix it causes a crash.</p>
  <hr>
  <p><div id=console></div></p>
  </body>
  
  
  



More information about the webkit-changes mailing list