Changeset 101591 in webkit
- Timestamp:
- Nov 30, 2011 7:23:05 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r101590 r101591 1 2011-11-30 Kentaro Hara <haraken@chromium.org> 2 3 Implement the StorageEvent constructor 4 https://bugs.webkit.org/show_bug.cgi?id=71685 5 6 Reviewed by Adam Barth. 7 8 storage-event-constructor.html checks the behavior of the StorageEvent constructor. 9 10 * fast/dom/constructed-objects-prototypes-expected.txt: Added window.StorageEvent. 11 * fast/events/constructors/storage-event-constructor-expected.txt: Added. 12 * fast/events/constructors/storage-event-constructor.html: Added. 13 1 14 2011-11-30 Hayato Ito <hayato@chromium.org> 2 15 -
trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt
r101183 r101591 40 40 PASS (new inner.ProgressEvent()).isInner is true 41 41 PASS (new inner.ProgressEvent()).constructor.isInner is true 42 PASS (new inner.StorageEvent()).isInner is true 43 PASS (new inner.StorageEvent()).constructor.isInner is true 42 44 PASS (new inner.WebGLContextEvent()).isInner is true 43 45 PASS (new inner.WebGLContextEvent()).constructor.isInner is true -
trunk/Source/WebCore/ChangeLog
r101587 r101591 1 2011-11-30 Kentaro Hara <haraken@chromium.org> 2 3 Implement the StorageEvent constructor 4 https://bugs.webkit.org/show_bug.cgi?id=71685 5 6 Reviewed by Adam Barth. 7 8 This patch makes StorageEvent constractable. 9 The spec: http://www.whatwg.org/specs/web-apps/current-work/#storageevent 10 11 Test: fast/events/constructors/storage-event-constructor.html 12 13 * bindings/js/JSDictionary.cpp: 14 (WebCore::JSDictionary::tryGetProperty): 15 (WebCore::JSDictionary::convertValue): Returns a Storage object corresponding to a given key. 16 * bindings/js/JSDictionary.h: 17 (WebCore::JSDictionary::tryGetProperty): 18 * bindings/v8/OptionsObject.cpp: 19 (WebCore::OptionsObject::get): Ditto. 20 * bindings/v8/OptionsObject.h: 21 * storage/StorageEvent.cpp: Added an implementation of the StorageEvent constructor. 22 (WebCore::StorageEventInit::StorageEventInit): 23 (WebCore::StorageEvent::create): 24 (WebCore::StorageEvent::StorageEvent): 25 * storage/StorageEvent.h: Added a definition of StorageEventInit. 26 (WebCore::StorageEvent::key): 27 (WebCore::StorageEvent::oldValue): 28 (WebCore::StorageEvent::newValue): 29 (WebCore::StorageEvent::url): 30 (WebCore::StorageEvent::storageArea): 31 * storage/StorageEvent.idl: Added [ConstructorTemplate=Event] IDL. 32 1 33 2011-11-30 Naveen Bobbili <qghc36@motorola.com> 2 34 -
trunk/Source/WebCore/bindings/js/JSDictionary.cpp
r99261 r101591 31 31 #include "JSMessagePortCustom.h" 32 32 #include "JSNode.h" 33 #include "JSStorage.h" 33 34 #include "JSTrackCustom.h" 34 35 #include "SerializedScriptValue.h" … … 44 45 Identifier identifier(m_exec, propertyName); 45 46 PropertySlot slot(m_initializerObject); 46 47 47 48 if (!m_initializerObject->getPropertySlot(m_exec, identifier, slot)) 48 49 return NoPropertyFound; … … 119 120 } 120 121 122 void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<Storage>& result) 123 { 124 result = toStorage(value); 125 } 126 121 127 void JSDictionary::convertValue(ExecState* exec, JSValue value, MessagePortArray& result) 122 128 { -
trunk/Source/WebCore/bindings/js/JSDictionary.h
r100628 r101591 38 38 class ScriptValue; 39 39 class SerializedScriptValue; 40 class Storage; 40 41 class TrackBase; 41 42 … … 82 83 static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<EventTarget>& result); 83 84 static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<Node>& result); 85 static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<Storage>& result); 84 86 static void convertValue(JSC::ExecState*, JSC::JSValue, MessagePortArray& result); 85 87 #if ENABLE(VIDEO_TRACK) … … 105 107 if (m_exec->hadException()) 106 108 return false; 107 109 108 110 setter(context, result); 109 111 break; -
trunk/Source/WebCore/bindings/v8/OptionsObject.cpp
r101118 r101591 30 30 #include "V8Binding.h" 31 31 #include "V8DOMWindow.h" 32 #include "V8Storage.h" 32 33 #include "V8Utilities.h" 33 34 #include <wtf/MathExtras.h> … … 207 208 } 208 209 210 bool OptionsObject::get(const String& key, RefPtr<Storage>& value) const 211 { 212 v8::Local<v8::Value> v8Value; 213 if (!getKey(key, v8Value)) 214 return false; 215 216 Storage* source = 0; 217 if (v8Value->IsObject()) { 218 v8::Handle<v8::Object> wrapper = v8::Handle<v8::Object>::Cast(v8Value); 219 v8::Handle<v8::Object> storage = V8DOMWrapper::lookupDOMWrapper(V8Storage::GetTemplate(), wrapper); 220 if (!storage.IsEmpty()) 221 source = V8Storage::toNative(storage); 222 } 223 value = source; 224 return true; 225 } 226 209 227 bool OptionsObject::get(const String& key, MessagePortArray& value) const 210 228 { -
trunk/Source/WebCore/bindings/v8/OptionsObject.h
r99992 r101591 39 39 class DOMWindow; 40 40 class IDBKeyRange; 41 class Storage; 41 42 class TrackBase; 42 43 … … 60 61 bool get(const String&, unsigned long long&) const; 61 62 bool get(const String&, RefPtr<DOMWindow>&) const; 63 bool get(const String&, RefPtr<Storage>&) const; 62 64 bool get(const String&, MessagePortArray&) const; 63 65 #if ENABLE(VIDEO_TRACK) -
trunk/Source/WebCore/storage/StorageEvent.cpp
r98044 r101591 32 32 namespace WebCore { 33 33 34 StorageEventInit::StorageEventInit() 35 { 36 } 37 34 38 PassRefPtr<StorageEvent> StorageEvent::create() 35 39 { … … 50 54 } 51 55 56 PassRefPtr<StorageEvent> StorageEvent::create(const AtomicString& type, const StorageEventInit& initializer) 57 { 58 return adoptRef(new StorageEvent(type, initializer)); 59 } 60 52 61 StorageEvent::StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea) 53 62 : Event(type, false, false) … … 57 66 , m_url(url) 58 67 , m_storageArea(storageArea) 68 { 69 } 70 71 StorageEvent::StorageEvent(const AtomicString& type, const StorageEventInit& initializer) 72 : Event(type, initializer) 73 , m_key(initializer.key) 74 , m_oldValue(initializer.oldValue) 75 , m_newValue(initializer.newValue) 76 , m_url(initializer.url) 77 , m_storageArea(initializer.storageArea) 59 78 { 60 79 } -
trunk/Source/WebCore/storage/StorageEvent.h
r98044 r101591 32 32 namespace WebCore { 33 33 34 34 class Storage; 35 35 36 class StorageEvent : public Event { 37 public: 38 static PassRefPtr<StorageEvent> create(); 39 static PassRefPtr<StorageEvent> create(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); 40 virtual ~StorageEvent(); 36 struct StorageEventInit : public EventInit { 37 StorageEventInit(); 41 38 42 const String& key() const { return m_key; } 43 const String& oldValue() const { return m_oldValue; } 44 const String& newValue() const { return m_newValue; } 45 const String& url() const { return m_url; } 46 Storage* storageArea() const { return m_storageArea.get(); } 39 String key; 40 String oldValue; 41 String newValue; 42 String url; 43 RefPtr<Storage> storageArea; 44 }; 47 45 48 void initStorageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); 46 class StorageEvent : public Event { 47 public: 48 static PassRefPtr<StorageEvent> create(); 49 static PassRefPtr<StorageEvent> create(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); 50 static PassRefPtr<StorageEvent> create(const AtomicString&, const StorageEventInit&); 51 virtual ~StorageEvent(); 49 52 50 // Needed once we support init<blank>EventNS 51 // void initStorageEventNS(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString oldValueArg, in DOMString newValueArg, in DOMString urlArg, Storage storageAreaArg); 53 const String& key() const { return m_key; } 54 const String& oldValue() const { return m_oldValue; } 55 const String& newValue() const { return m_newValue; } 56 const String& url() const { return m_url; } 57 Storage* storageArea() const { return m_storageArea.get(); } 52 58 53 virtual const AtomicString& interfaceName() const;59 void initStorageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); 54 60 55 private: 56 StorageEvent(); 57 StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); 61 // Needed once we support init<blank>EventNS 62 // void initStorageEventNS(in DOMString namespaceURI, in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString keyArg, in DOMString oldValueArg, in DOMString newValueArg, in DOMString urlArg, Storage storageAreaArg); 58 63 59 String m_key; 60 String m_oldValue; 61 String m_newValue; 62 String m_url; 63 RefPtr<Storage> m_storageArea; 64 }; 64 virtual const AtomicString& interfaceName() const; 65 66 private: 67 StorageEvent(); 68 StorageEvent(const AtomicString& type, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea); 69 StorageEvent(const AtomicString&, const StorageEventInit&); 70 71 String m_key; 72 String m_oldValue; 73 String m_newValue; 74 String m_url; 75 RefPtr<Storage> m_storageArea; 76 }; 65 77 66 78 } // namespace WebCore -
trunk/Source/WebCore/storage/StorageEvent.idl
r101453 r101591 26 26 module storage { 27 27 28 interface StorageEvent : Event { 29 readonly attribute DOMString key; 30 readonly attribute [ConvertNullStringTo=Null] DOMString oldValue; 31 readonly attribute [ConvertNullStringTo=Null] DOMString newValue; 32 readonly attribute DOMString url; 33 readonly attribute Storage storageArea; 28 interface [ 29 ConstructorTemplate=Event 30 ] StorageEvent : Event { 31 readonly attribute [InitializedByConstructor] DOMString key; 32 readonly attribute [InitializedByConstructor, ConvertNullStringTo=Null] DOMString oldValue; 33 readonly attribute [InitializedByConstructor, ConvertNullStringTo=Null] DOMString newValue; 34 readonly attribute [InitializedByConstructor] DOMString url; 35 readonly attribute [InitializedByConstructor] Storage storageArea; 36 34 37 void initStorageEvent(in [Optional=CallWithDefaultValue] DOMString typeArg, 35 38 in [Optional=CallWithDefaultValue] boolean canBubbleArg,
Note: See TracChangeset
for help on using the changeset viewer.