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

Side by Side Diff: third_party/WebKit/Source/modules/storage/Storage.cpp

Issue 2321073002: binding: Let indexed interceptor falls through to named interceptor. (Closed)
Patch Set: Updated global-interface-listing expectations. Created 4 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 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 26 matching lines...) Expand all
37 } 37 }
38 38
39 Storage::Storage(LocalFrame* frame, StorageArea* storageArea) 39 Storage::Storage(LocalFrame* frame, StorageArea* storageArea)
40 : DOMWindowProperty(frame) 40 : DOMWindowProperty(frame)
41 , m_storageArea(storageArea) 41 , m_storageArea(storageArea)
42 { 42 {
43 ASSERT(m_frame); 43 ASSERT(m_frame);
44 ASSERT(m_storageArea); 44 ASSERT(m_storageArea);
45 } 45 }
46 46
47 String Storage::anonymousIndexedGetter(unsigned index, ExceptionState& exception State)
48 {
49 return anonymousNamedGetter(AtomicString::number(index), exceptionState);
50 }
51
52 String Storage::anonymousNamedGetter(const AtomicString& name, ExceptionState& e xceptionState) 47 String Storage::anonymousNamedGetter(const AtomicString& name, ExceptionState& e xceptionState)
53 { 48 {
54 bool found = contains(name, exceptionState); 49 bool found = contains(name, exceptionState);
55 if (exceptionState.hadException() || !found) 50 if (exceptionState.hadException() || !found)
56 return String(); 51 return String();
57 String result = getItem(name, exceptionState); 52 String result = getItem(name, exceptionState);
58 if (exceptionState.hadException()) 53 if (exceptionState.hadException())
59 return String(); 54 return String();
60 return result; 55 return result;
61 } 56 }
62 57
63 bool Storage::anonymousNamedSetter(const AtomicString& name, const AtomicString& value, ExceptionState& exceptionState) 58 bool Storage::anonymousNamedSetter(const AtomicString& name, const AtomicString& value, ExceptionState& exceptionState)
64 { 59 {
65 setItem(name, value, exceptionState); 60 setItem(name, value, exceptionState);
66 return true; 61 return true;
67 } 62 }
68 63
69 bool Storage::anonymousIndexedSetter(unsigned index, const AtomicString& value, ExceptionState& exceptionState)
70 {
71 return anonymousNamedSetter(AtomicString::number(index), value, exceptionSta te);
72 }
73
74 DeleteResult Storage::anonymousNamedDeleter(const AtomicString& name, ExceptionS tate& exceptionState) 64 DeleteResult Storage::anonymousNamedDeleter(const AtomicString& name, ExceptionS tate& exceptionState)
75 { 65 {
76 bool found = contains(name, exceptionState); 66 bool found = contains(name, exceptionState);
77 if (!found) 67 if (!found)
78 return DeleteUnknownProperty; 68 return DeleteUnknownProperty;
79 if (exceptionState.hadException()) 69 if (exceptionState.hadException())
80 return DeleteReject; 70 return DeleteReject;
81 removeItem(name, exceptionState); 71 removeItem(name, exceptionState);
82 if (exceptionState.hadException()) 72 if (exceptionState.hadException())
83 return DeleteReject; 73 return DeleteReject;
84 return DeleteSuccess; 74 return DeleteSuccess;
85 } 75 }
86 76
87 DeleteResult Storage::anonymousIndexedDeleter(unsigned index, ExceptionState& ex ceptionState)
88 {
89 DeleteResult result = anonymousNamedDeleter(AtomicString::number(index), exc eptionState);
90 return result == DeleteUnknownProperty ? DeleteSuccess : result;
91 }
92
93 void Storage::namedPropertyEnumerator(Vector<String>& names, ExceptionState& exc eptionState) 77 void Storage::namedPropertyEnumerator(Vector<String>& names, ExceptionState& exc eptionState)
94 { 78 {
95 unsigned length = this->length(exceptionState); 79 unsigned length = this->length(exceptionState);
96 if (exceptionState.hadException()) 80 if (exceptionState.hadException())
97 return; 81 return;
98 names.resize(length); 82 names.resize(length);
99 for (unsigned i = 0; i < length; ++i) { 83 for (unsigned i = 0; i < length; ++i) {
100 String key = this->key(i, exceptionState); 84 String key = this->key(i, exceptionState);
101 if (exceptionState.hadException()) 85 if (exceptionState.hadException())
102 return; 86 return;
(...skipping 15 matching lines...) Expand all
118 return true; 102 return true;
119 } 103 }
120 104
121 DEFINE_TRACE(Storage) 105 DEFINE_TRACE(Storage)
122 { 106 {
123 visitor->trace(m_storageArea); 107 visitor->trace(m_storageArea);
124 DOMWindowProperty::trace(visitor); 108 DOMWindowProperty::trace(visitor);
125 } 109 }
126 110
127 } // namespace blink 111 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/storage/Storage.h ('k') | third_party/WebKit/Source/modules/storage/Storage.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698