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

Side by Side Diff: Source/core/dom/DOMStringMap.h

Issue 106853005: Implement platform deleters per spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 30 matching lines...) Expand all
41 public: 41 public:
42 virtual ~DOMStringMap(); 42 virtual ~DOMStringMap();
43 43
44 virtual void ref() = 0; 44 virtual void ref() = 0;
45 virtual void deref() = 0; 45 virtual void deref() = 0;
46 46
47 virtual void getNames(Vector<String>&) = 0; 47 virtual void getNames(Vector<String>&) = 0;
48 virtual String item(const String& name) = 0; 48 virtual String item(const String& name) = 0;
49 virtual bool contains(const String& name) = 0; 49 virtual bool contains(const String& name) = 0;
50 virtual void setItem(const String& name, const String& value, ExceptionState &) = 0; 50 virtual void setItem(const String& name, const String& value, ExceptionState &) = 0;
51 virtual void deleteItem(const String& name, ExceptionState&) = 0; 51 virtual bool deleteItem(const String& name) = 0;
52 bool anonymousNamedSetter(const String& name, const String& value, Exception State& exceptionState) 52 bool anonymousNamedSetter(const String& name, const String& value, Exception State& exceptionState)
53 { 53 {
54 setItem(name, value, exceptionState); 54 setItem(name, value, exceptionState);
55 return true; 55 return true;
56 } 56 }
57 bool anonymousNamedDeleter(const AtomicString& name, ExceptionState&) 57 bool anonymousNamedDeleter(const AtomicString& name, bool& result)
58 { 58 {
59 // FIXME: Remove ExceptionState parameter. 59 result = deleteItem(name);
60
61 TrackExceptionState exceptionState;
62 deleteItem(name, exceptionState);
63 bool result = !exceptionState.hadException();
64 // DOMStringMap deleter should ignore exception.
65 // Behavior of Firefox and Opera are same.
66 // delete document.body.dataset["-foo"] // false instead of DOM Exceptio n 12
67 // LayoutTests/fast/dom/HTMLSelectElement/select-selectedIndex-multiple. html
68 return result; 60 return result;
69 } 61 }
70 void namedPropertyEnumerator(Vector<String>& names, ExceptionState&) 62 void namedPropertyEnumerator(Vector<String>& names, ExceptionState&)
71 { 63 {
72 getNames(names); 64 getNames(names);
73 } 65 }
74 bool namedPropertyQuery(const AtomicString&, ExceptionState&); 66 bool namedPropertyQuery(const AtomicString&, ExceptionState&);
75 67
76 String anonymousIndexedGetter(uint32_t index) 68 String anonymousIndexedGetter(uint32_t index)
77 { 69 {
78 return item(String::number(index)); 70 return item(String::number(index));
79 } 71 }
80 bool anonymousIndexedSetter(uint32_t index, const String& value, ExceptionSt ate& exceptionState) 72 bool anonymousIndexedSetter(uint32_t index, const String& value, ExceptionSt ate& exceptionState)
81 { 73 {
82 return anonymousNamedSetter(String::number(index), value, exceptionState ); 74 return anonymousNamedSetter(String::number(index), value, exceptionState );
83 } 75 }
84 bool anonymousIndexedDeleter(uint32_t index, ExceptionState& exceptionState) 76 bool anonymousIndexedDeleter(uint32_t index)
85 { 77 {
86 return anonymousNamedDeleter(AtomicString::number(index), exceptionState ); 78 bool result;
79 anonymousNamedDeleter(AtomicString::number(index), result);
80 return true;
haraken 2013/12/17 15:59:20 Don't we want to return |result| ?
sof 2013/12/17 16:20:08 4.7.4.1 (the indexed case) in the spec tells us th
87 } 81 }
88 82
89 virtual Element* element() = 0; 83 virtual Element* element() = 0;
90 84
91 protected: 85 protected:
92 DOMStringMap() 86 DOMStringMap()
93 { 87 {
94 ScriptWrappable::init(this); 88 ScriptWrappable::init(this);
95 } 89 }
96 }; 90 };
97 91
98 } // namespace WebCore 92 } // namespace WebCore
99 93
100 #endif // DOMStringMap_h 94 #endif // DOMStringMap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698