Bug 44930

Summary: [V8] Custom binding for "dataset"
Product: WebKit Reporter: Kent Tamura <tkent>
Component: WebCore JavaScriptAssignee: Kent Tamura <tkent>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, japhet, levin, yurys
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: All   
URL: http://crbug.com/48133
Attachments:
Description Flags
Patch none

Description Kent Tamura 2010-08-30 23:01:50 PDT
[V8] Custom binding for "dataset"
Comment 1 Kent Tamura 2010-08-30 23:21:37 PDT
Created attachment 66016 [details]
Patch
Comment 2 Adam Barth 2010-08-30 23:37:14 PDT
Comment on attachment 66016 [details]
Patch

> LayoutTests/platform/chromium/test_expectations.txt:2767
> -// v8 bindings for dataset need to be implemented.
> -BUG48133 :  fast/dom/dataset-xhtml.xhtml = TEXT
> -BUG48133 :  fast/dom/dataset.html = TEXT
Yay!

> WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp:67
> +v8::Handle<v8::Boolean> V8DOMStringMap::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
> +{
> +    INC_STATS("DOM.DOMStringMap.NamedPropertyDeleter");
> +    v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
Can this throw an exception?

> WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp:76
> +    ExceptionCode ec = 0;
> +    V8DOMStringMap::toNative(info.Holder())->deleteItem(toWebCoreString(name), ec);
> +    if (ec)
> +        throwError(ec);
Are we supposed to "return throwError(ec)" ?  That would be a less error-prone pattern.
Comment 3 Kent Tamura 2010-08-30 23:57:29 PDT
(In reply to comment #2)
> > WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp:67
> > +v8::Handle<v8::Boolean> V8DOMStringMap::namedPropertyDeleter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
> > +{
> > +    INC_STATS("DOM.DOMStringMap.NamedPropertyDeleter");
> > +    v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name);
> Can this throw an exception?

Do you mean throwing an exception for a case that prototype chain contains the name?
I'm not sure.  The behavior of the corresponding JSC binding is the same as this code.

> 
> > WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp:76
> > +    ExceptionCode ec = 0;
> > +    V8DOMStringMap::toNative(info.Holder())->deleteItem(toWebCoreString(name), ec);
> > +    if (ec)
> > +        throwError(ec);
> Are we supposed to "return throwError(ec)" ?  That would be a less error-prone pattern.

Unfortunately, it will make a build error.

../../WebKit/chromium/v8/include/v8.h: In constructor ‘v8::Handle<T>::Handle(v8::Handle<S>) [with S = v8::Primitive, T = v8::Boolean]’:
/Volumes/d2/WebKit/WebCore/WebCore.gyp/../bindings/v8/custom/V8DOMStringMapCustom.cpp:76:   instantiated from here
../../WebKit/chromium/v8/include/v8.h:212: error: invalid conversion from ‘v8::Primitive*’ to ‘v8::Boolean*’
Comment 4 Adam Barth 2010-08-30 23:59:46 PDT
> > Are we supposed to "return throwError(ec)" ?  That would be a less error-prone pattern.
> 
> Unfortunately, it will make a build error.

Yeah, we'd have to change a bunch of code to make it work.  Something to think about in a future patch.
Comment 5 Kent Tamura 2010-08-31 01:11:13 PDT
Landed: http://trac.webkit.org/changeset/66467