Changeset 66655 in webkit


Ignore:
Timestamp:
Sep 2, 2010 3:49:55 AM (14 years ago)
Author:
andreas.kling@nokia.com
Message:

2010-09-01 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Darin Adler.

DOM Selection: collapse() and selectAllChildren() should throw WRONG_DOCUMENT_ERR if node belongs to other document
https://bugs.webkit.org/show_bug.cgi?id=44595

Spec links:
http://www.whatwg.org/specs/web-apps/current-work/#dom-selection-collapse
http://www.whatwg.org/specs/web-apps/current-work/#dom-selection-selectallchildren

Test: fast/dom/Selection/wrong-document-err.html

  • page/DOMSelection.cpp: (WebCore::DOMSelection::collapse): (WebCore::DOMSelection::selectAllChildren):

2010-09-01 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Darin Adler.

DOM Selection: collapse() and selectAllChildren() should throw WRONG_DOCUMENT_ERR if node belongs to other document
https://bugs.webkit.org/show_bug.cgi?id=44595

Spec links:
http://www.whatwg.org/specs/web-apps/current-work/#dom-selection-collapse
http://www.whatwg.org/specs/web-apps/current-work/#dom-selection-selectallchildren

  • fast/dom/Selection/script-tests/wrong-document-err.js: Added.
  • fast/dom/Selection/wrong-document-err-expected.txt: Added.
  • fast/dom/Selection/wrong-document-err.html: Added.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r66649 r66655  
     12010-09-01  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        DOM Selection: collapse() and selectAllChildren() should throw WRONG_DOCUMENT_ERR if node belongs to other document
     6        https://bugs.webkit.org/show_bug.cgi?id=44595
     7
     8        Spec links:
     9        http://www.whatwg.org/specs/web-apps/current-work/#dom-selection-collapse
     10        http://www.whatwg.org/specs/web-apps/current-work/#dom-selection-selectallchildren
     11
     12        * fast/dom/Selection/script-tests/wrong-document-err.js: Added.
     13        * fast/dom/Selection/wrong-document-err-expected.txt: Added.
     14        * fast/dom/Selection/wrong-document-err.html: Added.
     15
    1162010-09-02  Tony Gentilcore  <tonyg@chromium.org>
    217
  • trunk/WebCore/ChangeLog

    r66653 r66655  
     12010-09-01  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        DOM Selection: collapse() and selectAllChildren() should throw WRONG_DOCUMENT_ERR if node belongs to other document
     6        https://bugs.webkit.org/show_bug.cgi?id=44595
     7
     8        Spec links:
     9        http://www.whatwg.org/specs/web-apps/current-work/#dom-selection-collapse
     10        http://www.whatwg.org/specs/web-apps/current-work/#dom-selection-selectallchildren
     11
     12        Test: fast/dom/Selection/wrong-document-err.html
     13
     14        * page/DOMSelection.cpp:
     15        (WebCore::DOMSelection::collapse):
     16        (WebCore::DOMSelection::selectAllChildren):
     17
    1182010-09-02  Eric Seidel  <eric@webkit.org>
    219
  • trunk/WebCore/page/DOMSelection.cpp

    r66590 r66655  
    201201void DOMSelection::collapse(Node* node, int offset, ExceptionCode& ec)
    202202{
    203     if (!m_frame)
    204         return;
     203    Document* selectionDocument = m_frame ? m_frame->document() : 0;
     204    Document* nodeDocument = node ? node->document() : 0;
     205
     206    if (selectionDocument != nodeDocument) {
     207        ec = WRONG_DOCUMENT_ERR;
     208        return;
     209    }
    205210
    206211    if (offset < 0) {
     
    208213        return;
    209214    }
     215
     216    if (!m_frame)
     217        return;
    210218
    211219    if (!isValidForPosition(node))
     
    489497        return;
    490498
     499    Document* selectionDocument = m_frame ? m_frame->document() : 0;
     500
     501    if (selectionDocument != n->document()) {
     502        ec = WRONG_DOCUMENT_ERR;
     503        return;
     504    }
     505
    491506    // This doesn't (and shouldn't) select text node characters.
    492507    setBaseAndExtent(n, 0, n, n->childNodeCount(), ec);
Note: See TracChangeset for help on using the changeset viewer.