Commit e0a82aa9 authored by dglazkov@chromium.org's avatar dglazkov@chromium.org

2009-04-21 Dave Moore <davemoore@google.com>

        Reviewed by Dimitri Glazkov.

        https://bugs.webkit.org/show_bug.cgi?id=25309
        Better use AtomicStrings when calling from the V8
        bindings into WebCore code.

        * bindings/v8/custom/V8DOMWindowCustom.cpp:
        * bindings/v8/custom/V8HTMLCollectionCustom.cpp:
        * bindings/v8/custom/V8HTMLFormElementCustom.cpp:
        * bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp:

git-svn-id: svn://svn.chromium.org/blink/trunk@42714 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b2872fe3
2009-04-21 Dave Moore <davemoore@google.com>
Reviewed by Dimitri Glazkov.
https://bugs.webkit.org/show_bug.cgi?id=25309
Better use AtomicStrings when calling from the V8
bindings into WebCore code.
* bindings/v8/custom/V8DOMWindowCustom.cpp:
* bindings/v8/custom/V8HTMLCollectionCustom.cpp:
* bindings/v8/custom/V8HTMLFormElementCustom.cpp:
* bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp:
2009-04-21 Chris Fleizach <cfleizach@apple.com> 2009-04-21 Chris Fleizach <cfleizach@apple.com>
Reviewed by Darin Adler. Reviewed by Darin Adler.
...@@ -540,9 +540,6 @@ INDEXED_PROPERTY_GETTER(DOMWindow) ...@@ -540,9 +540,6 @@ INDEXED_PROPERTY_GETTER(DOMWindow)
NAMED_PROPERTY_GETTER(DOMWindow) NAMED_PROPERTY_GETTER(DOMWindow)
{ {
INC_STATS("DOM.DOMWindow.NamedPropertyGetter"); INC_STATS("DOM.DOMWindow.NamedPropertyGetter");
// The key must be a string.
if (!name->IsString())
return notHandledByInterceptor();
v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This()); v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This());
if (holder.IsEmpty()) if (holder.IsEmpty())
...@@ -552,14 +549,13 @@ NAMED_PROPERTY_GETTER(DOMWindow) ...@@ -552,14 +549,13 @@ NAMED_PROPERTY_GETTER(DOMWindow)
if (!window) if (!window)
return notHandledByInterceptor(); return notHandledByInterceptor();
String propName = toWebCoreString(name);
Frame* frame = window->frame(); Frame* frame = window->frame();
// window is detached from a frame. // window is detached from a frame.
if (!frame) if (!frame)
return notHandledByInterceptor(); return notHandledByInterceptor();
// Search sub-frames. // Search sub-frames.
AtomicString propName = v8StringToAtomicWebCoreString(name);
Frame* child = frame->tree()->child(propName); Frame* child = frame->tree()->child(propName);
if (child) if (child)
return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, child->domWindow()); return V8Proxy::ToV8Object(V8ClassIndex::DOMWINDOW, child->domWindow());
...@@ -622,7 +618,7 @@ NAMED_PROPERTY_GETTER(DOMWindow) ...@@ -622,7 +618,7 @@ NAMED_PROPERTY_GETTER(DOMWindow)
// TODO(ager): We probably should implement the Has method // TODO(ager): We probably should implement the Has method
// for the interceptor instead of using the default Has method // for the interceptor instead of using the default Has method
// that calls Get. // that calls Get.
context->Global()->Set(v8String(propName), v8::Undefined()); context->Global()->Set(name, v8::Undefined());
V8Proxy* proxy = V8Proxy::retrieve(window->frame()); V8Proxy* proxy = V8Proxy::retrieve(window->frame());
ASSERT(proxy); ASSERT(proxy);
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
namespace WebCore { namespace WebCore {
static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, String name) static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, AtomicString name)
{ {
Vector<RefPtr<Node> > namedItems; Vector<RefPtr<Node> > namedItems;
collection->namedItems(name, namedItems); collection->namedItems(name, namedItems);
...@@ -85,7 +85,7 @@ NAMED_PROPERTY_GETTER(HTMLCollection) ...@@ -85,7 +85,7 @@ NAMED_PROPERTY_GETTER(HTMLCollection)
// Finally, search the DOM structure. // Finally, search the DOM structure.
HTMLCollection* imp = V8Proxy::ToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, info.Holder()); HTMLCollection* imp = V8Proxy::ToNativeObject<HTMLCollection>(V8ClassIndex::HTMLCOLLECTION, info.Holder());
return getNamedItems(imp, toWebCoreString(name)); return getNamedItems(imp, v8StringToAtomicWebCoreString(name));
} }
CALLBACK_FUNC_DECL(HTMLCollectionItem) CALLBACK_FUNC_DECL(HTMLCollectionItem)
......
...@@ -42,7 +42,7 @@ NAMED_PROPERTY_GETTER(HTMLFormElement) ...@@ -42,7 +42,7 @@ NAMED_PROPERTY_GETTER(HTMLFormElement)
{ {
INC_STATS("DOM.HTMLFormElement.NamedPropertyGetter"); INC_STATS("DOM.HTMLFormElement.NamedPropertyGetter");
HTMLFormElement* imp = V8Proxy::DOMWrapperToNode<HTMLFormElement>(info.Holder()); HTMLFormElement* imp = V8Proxy::DOMWrapperToNode<HTMLFormElement>(info.Holder());
String v = toWebCoreString(name); AtomicString v = v8StringToAtomicWebCoreString(name);
// Call getNamedElements twice, first time check if it has a value // Call getNamedElements twice, first time check if it has a value
// and let HTMLFormElement update its cache. // and let HTMLFormElement update its cache.
......
...@@ -48,7 +48,7 @@ NAMED_PROPERTY_GETTER(HTMLFrameSetElement) ...@@ -48,7 +48,7 @@ NAMED_PROPERTY_GETTER(HTMLFrameSetElement)
{ {
INC_STATS("DOM.HTMLFrameSetElement.NamedPropertyGetter"); INC_STATS("DOM.HTMLFrameSetElement.NamedPropertyGetter");
HTMLFrameSetElement* imp = V8Proxy::DOMWrapperToNode<HTMLFrameSetElement>(info.Holder()); HTMLFrameSetElement* imp = V8Proxy::DOMWrapperToNode<HTMLFrameSetElement>(info.Holder());
Node* frameNode = imp->children()->namedItem(toWebCoreString(name)); Node* frameNode = imp->children()->namedItem(v8StringToAtomicWebCoreString(name));
if (frameNode && frameNode->hasTagName(HTMLNames::frameTag)) { if (frameNode && frameNode->hasTagName(HTMLNames::frameTag)) {
Document* doc = static_cast<HTMLFrameElement*>(frameNode)->contentDocument(); Document* doc = static_cast<HTMLFrameElement*>(frameNode)->contentDocument();
if (!doc) if (!doc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment