Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Side by Side Diff: Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp

Issue 8015008: Merge 95489 - [V8] document.all gets confused about its prototype chain (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 V8DOMStringMap::toNative(info.Holder())->getNames(names); 59 V8DOMStringMap::toNative(info.Holder())->getNames(names);
60 v8::Handle<v8::Array> properties = v8::Array::New(names.size()); 60 v8::Handle<v8::Array> properties = v8::Array::New(names.size());
61 for (size_t i = 0; i < names.size(); ++i) 61 for (size_t i = 0; i < names.size(); ++i)
62 properties->Set(v8::Integer::New(i), v8String(names[i])); 62 properties->Set(v8::Integer::New(i), v8String(names[i]));
63 return properties; 63 return properties;
64 } 64 }
65 65
66 v8::Handle<v8::Boolean> V8DOMStringMap::namedPropertyDeleter(v8::Local<v8::Strin g> name, const v8::AccessorInfo& info) 66 v8::Handle<v8::Boolean> V8DOMStringMap::namedPropertyDeleter(v8::Local<v8::Strin g> name, const v8::AccessorInfo& info)
67 { 67 {
68 INC_STATS("DOM.DOMStringMap.NamedPropertyDeleter"); 68 INC_STATS("DOM.DOMStringMap.NamedPropertyDeleter");
69 v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototype Chain(name); 69
70 if (!value.IsEmpty()) 70 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
71 return v8::False(); 71 return v8::False();
72 if (info.Holder()->HasRealNamedCallbackProperty(name)) 72 if (info.Holder()->HasRealNamedCallbackProperty(name))
73 return v8::False(); 73 return v8::False();
74 74
75 ExceptionCode ec = 0; 75 ExceptionCode ec = 0;
76 V8DOMStringMap::toNative(info.Holder())->deleteItem(toWebCoreString(name), e c); 76 V8DOMStringMap::toNative(info.Holder())->deleteItem(toWebCoreString(name), e c);
77 if (ec) 77 if (ec)
78 throwError(ec); 78 throwError(ec);
79 return v8::True(); 79 return v8::True();
80 } 80 }
81 81
82 v8::Handle<v8::Value> V8DOMStringMap::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) 82 v8::Handle<v8::Value> V8DOMStringMap::namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
83 { 83 {
84 INC_STATS("DOM.DOMStringMap.NamedPropertySetter"); 84 INC_STATS("DOM.DOMStringMap.NamedPropertySetter");
85 v8::Handle<v8::Value> property = info.Holder()->GetRealNamedPropertyInProtot ypeChain(name); 85
86 if (!property.IsEmpty()) 86 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
87 return value; 87 return value;
88 if (info.Holder()->HasRealNamedCallbackProperty(name)) 88 if (info.Holder()->HasRealNamedCallbackProperty(name))
89 return value; 89 return value;
90 90
91 ExceptionCode ec = 0; 91 ExceptionCode ec = 0;
92 V8DOMStringMap::toNative(info.Holder())->setItem(toWebCoreString(name), toWe bCoreString(value), ec); 92 V8DOMStringMap::toNative(info.Holder())->setItem(toWebCoreString(name), toWe bCoreString(value), ec);
93 if (ec) 93 if (ec)
94 return throwError(ec); 94 return throwError(ec);
95 return value; 95 return value;
96 } 96 }
97 97
98 v8::Handle<v8::Value> toV8(DOMStringMap* impl) 98 v8::Handle<v8::Value> toV8(DOMStringMap* impl)
99 { 99 {
100 if (!impl) 100 if (!impl)
101 return v8::Null(); 101 return v8::Null();
102 v8::Handle<v8::Object> wrapper = V8DOMStringMap::wrap(impl); 102 v8::Handle<v8::Object> wrapper = V8DOMStringMap::wrap(impl);
103 // Add a hidden reference from the element to the DOMStringMap. 103 // Add a hidden reference from the element to the DOMStringMap.
104 Element* element = impl->element(); 104 Element* element = impl->element();
105 if (!wrapper.IsEmpty() && element) { 105 if (!wrapper.IsEmpty() && element) {
106 v8::Handle<v8::Value> elementValue = toV8(element); 106 v8::Handle<v8::Value> elementValue = toV8(element);
107 if (!elementValue.IsEmpty() && elementValue->IsObject()) 107 if (!elementValue.IsEmpty() && elementValue->IsObject())
108 V8DOMWrapper::setNamedHiddenReference(elementValue.As<v8::Object>(), "domStringMap", wrapper); 108 V8DOMWrapper::setNamedHiddenReference(elementValue.As<v8::Object>(), "domStringMap", wrapper);
109 } 109 }
110 return wrapper; 110 return wrapper;
111 } 111 }
112 112
113 } // namespace WebCore 113 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/bindings/v8/V8Collection.h ('k') | Source/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698