Changeset 35041 in webkit


Ignore:
Timestamp:
Jul 7, 2008 2:29:56 PM (16 years ago)
Author:
weinig@apple.com
Message:

WebCore:

2008-07-07 Sam Weinig <sam@webkit.org>

Reviewed by Geoffrey Garen.

Fix for https://bugs.webkit.org/show_bug.cgi?id=19928
querySelectorAll should throw an exception if a NSResolver is passed in.

  • Throw an NOT_SUPPORTED_ERR if a non-null or undefined parameter is passed as the second argument to querySelector or querySelectorAll.

Test: fast/dom/SelectorAPI/not-supported-NSResolver.html

  • bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::querySelector): (WebCore::JSDocument::querySelectorAll):
  • bindings/js/JSElementCustom.cpp: (WebCore::JSElement::querySelector): (WebCore::JSElement::querySelectorAll):
  • dom/Document.idl:
  • dom/Element.idl:

LayoutTests:

2008-07-07 Sam Weinig <sam@webkit.org>

Reviewed by Geoffrey Garen.

Fix for https://bugs.webkit.org/show_bug.cgi?id=19928
querySelectorAll should throw an exception if a NSResolver is passed in.

  • fast/dom/SelectorAPI/not-supported-NSResolver-expected.txt: Added.
  • fast/dom/SelectorAPI/not-supported-NSResolver.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r35040 r35041  
     12008-07-07  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=19928
     6        querySelectorAll should throw an exception if a NSResolver is passed in.
     7
     8        * fast/dom/SelectorAPI/not-supported-NSResolver-expected.txt: Added.
     9        * fast/dom/SelectorAPI/not-supported-NSResolver.html: Added.
     10
    1112008-07-07  Brady Eidson  <beidson@apple.com>
    212
  • trunk/WebCore/ChangeLog

    r35040 r35041  
     12008-07-07  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=19928
     6        querySelectorAll should throw an exception if a NSResolver is passed in.
     7
     8        - Throw an NOT_SUPPORTED_ERR if a non-null or undefined parameter is passed
     9          as the second argument to querySelector or querySelectorAll.
     10
     11        Test: fast/dom/SelectorAPI/not-supported-NSResolver.html
     12
     13        * bindings/js/JSDocumentCustom.cpp:
     14        (WebCore::JSDocument::querySelector):
     15        (WebCore::JSDocument::querySelectorAll):
     16        * bindings/js/JSElementCustom.cpp:
     17        (WebCore::JSElement::querySelector):
     18        (WebCore::JSElement::querySelectorAll):
     19        * dom/Document.idl:
     20        * dom/Element.idl:
     21
    1222008-07-07  Brady Eidson  <beidson@apple.com>
    223
  • trunk/WebCore/bindings/js/JSDocumentCustom.cpp

    r34659 r35041  
    2222
    2323#include "DOMWindow.h"
     24#include "ExceptionCode.h"
    2425#include "Frame.h"
    2526#include "FrameLoader.h"
     
    2829#include "JSHTMLDocument.h"
    2930#include "JSLocation.h"
     31#include "JSNodeList.h"
    3032#include "Location.h"
     33#include "NodeList.h"
    3134#include "ScriptController.h"
    3235
     
    7376}
    7477
     78JSValue* JSDocument::querySelector(ExecState* exec, const ArgList& args)
     79{
     80    if (!args[1]->isUndefinedOrNull()) {
     81        setDOMException(exec, NOT_SUPPORTED_ERR);
     82        return jsUndefined();
     83    }
     84
     85    Document* imp = impl();
     86    ExceptionCode ec = 0;
     87    JSValue* result = toJS(exec, imp->querySelector(valueToStringWithUndefinedOrNullCheck(exec, args[0]), ec));
     88    setDOMException(exec, ec);
     89    return result;
     90}
     91
     92JSValue* JSDocument::querySelectorAll(ExecState* exec, const ArgList& args)
     93{
     94    if (!args[1]->isUndefinedOrNull()) {
     95        setDOMException(exec, NOT_SUPPORTED_ERR);
     96        return jsUndefined();
     97    }
     98
     99    Document* imp = impl();
     100    ExceptionCode ec = 0;
     101    JSValue* result = toJS(exec, imp->querySelectorAll(valueToStringWithUndefinedOrNullCheck(exec, args[0]), ec));
     102    setDOMException(exec, ec);
     103    return result;
     104}
     105
    75106JSValue* toJS(ExecState* exec, Document* doc)
    76107{
  • trunk/WebCore/bindings/js/JSElementCustom.cpp

    r34659 r35041  
    3737#include "JSAttr.h"
    3838#include "JSHTMLElementWrapperFactory.h"
     39#include "JSNodeList.h"
     40#include "NodeList.h"
    3941
    4042#if ENABLE(SVG)
     
    126128}
    127129
    128    
     130JSValue* JSElement::querySelector(ExecState* exec, const ArgList& args)
     131{
     132    if (!args[1]->isUndefinedOrNull()) {
     133        setDOMException(exec, NOT_SUPPORTED_ERR);
     134        return jsUndefined();
     135    }
     136
     137    Element* imp = impl();
     138    ExceptionCode ec = 0;
     139    JSValue* result = toJS(exec, imp->querySelector(valueToStringWithUndefinedOrNullCheck(exec, args[0]), ec));
     140    setDOMException(exec, ec);
     141    return result;
     142}
     143
     144JSValue* JSElement::querySelectorAll(ExecState* exec, const ArgList& args)
     145{
     146    if (!args[1]->isUndefinedOrNull()) {
     147        setDOMException(exec, NOT_SUPPORTED_ERR);
     148        return jsUndefined();
     149    }
     150
     151    Element* imp = impl();
     152    ExceptionCode ec = 0;
     153    JSValue* result = toJS(exec, imp->querySelectorAll(valueToStringWithUndefinedOrNullCheck(exec, args[0]), ec));
     154    setDOMException(exec, ec);
     155    return result;
     156}
     157
    129158JSValue* toJSNewlyCreated(ExecState* exec, Element* element)
    130159{
  • trunk/WebCore/dom/Document.idl

    r34741 r35041  
    234234
    235235        // HTML 5
    236         NodeList            getElementsByClassName(in DOMString tagname);
    237 
    238         // DocumentSelector - Selector API
    239         Element            querySelector(in [ConvertUndefinedOrNullToNullString] DOMString selectors)
    240             raises(DOMException);
    241         NodeList            querySelectorAll(in [ConvertUndefinedOrNullToNullString] DOMString selectors)
     236        NodeList getElementsByClassName(in DOMString tagname);
     237
     238        // NodeSelector - Selector API
     239        [Custom] Element querySelector(in [ConvertUndefinedOrNullToNullString] DOMString selectors)
     240            raises(DOMException);
     241        [Custom] NodeList querySelectorAll(in [ConvertUndefinedOrNullToNullString] DOMString selectors)
    242242            raises(DOMException);
    243243    };
  • trunk/WebCore/dom/Element.idl

    r34543 r35041  
    104104        NodeList getElementsByClassName(in DOMString name);
    105105
    106         // ElementSelector - Selector API
    107         Element            querySelector(in [ConvertUndefinedOrNullToNullString] DOMString selectors)
     106        // NodeSelector - Selector API
     107        [Custom] Element querySelector(in [ConvertUndefinedOrNullToNullString] DOMString selectors)
    108108            raises(DOMException);
    109         NodeList            querySelectorAll(in [ConvertUndefinedOrNullToNullString] DOMString selectors)
     109        [Custom] NodeList querySelectorAll(in [ConvertUndefinedOrNullToNullString] DOMString selectors)
    110110            raises(DOMException);
    111111
Note: See TracChangeset for help on using the changeset viewer.