~ubuntu-branches/ubuntu/lucid/webkit/lucid-security

« back to all changes in this revision

Viewing changes to WebCore/bindings/js/JSHistoryCustom.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2010-01-06 21:25:06 UTC
  • mfrom: (1.2.6 upstream) (4.3.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100106212506-gd0czn4zrwf1j19l
* New upstream release
- adds basic Content-Encoding support, thanks to soup
  (Closes: #529271)
- fixes over-advertising content types as supported by
  the media player (Closes: #559420)
* debian/control:
- updated libsoup build requirement (>= 2.28.2)
* debian/libwebkit-1.0-2.symbols:
- updated with new symbols
* debian/copyright:
- updated information since 1.1.17
* Imported patch from https://bugs.webkit.org/show_bug.cgi?id=30623
- I am shipping this patch because I believe it is correct, it is the
  way to go, it fixes a race, and it needs testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
 
96
96
bool JSHistory::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
97
97
{
98
 
    // When accessing History cross-domain, functions are always the native built-in ones.
99
 
    // See JSDOMWindow::getOwnPropertySlotDelegate for additional details.
100
 
    
101
 
    // Our custom code is only needed to implement the Window cross-domain scheme, so if access is
102
 
    // allowed, return false so the normal lookup will take place.
103
 
    String message;
104
 
    if (allowsAccessFromFrame(exec, impl()->frame(), message))
105
 
        return false;
106
 
    
 
98
    if (!impl()->frame()) {
 
99
        descriptor.setUndefined();
 
100
        return true;
 
101
    }
 
102
 
 
103
    // Throw out all cross domain access
 
104
    if (!allowsAccessFromFrame(exec, impl()->frame()))
 
105
        return true;
 
106
 
107
107
    // Check for the few functions that we allow, even when called cross-domain.
108
108
    const HashEntry* entry = JSHistoryPrototype::s_info.propHashTable(exec)->entry(exec, propertyName);
109
109
    if (entry) {
133
133
            return true;
134
134
        }
135
135
    }
136
 
    
137
 
    printErrorMessageForFrame(impl()->frame(), message);
 
136
 
138
137
    descriptor.setUndefined();
139
138
    return true;
140
139
}
163
162
    Base::getOwnPropertyNames(exec, propertyNames);
164
163
}
165
164
 
 
165
JSValue JSHistory::pushState(ExecState* exec, const ArgList& args)
 
166
{
 
167
    RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, args.at(0));
 
168
    if (exec->hadException())
 
169
        return jsUndefined();
 
170
 
 
171
    String title = valueToStringWithUndefinedOrNullCheck(exec, args.at(1));
 
172
    if (exec->hadException())
 
173
        return jsUndefined();
 
174
        
 
175
    String url;
 
176
    if (args.size() > 2) {
 
177
        url = valueToStringWithUndefinedOrNullCheck(exec, args.at(2));
 
178
        if (exec->hadException())
 
179
            return jsUndefined();
 
180
    }
 
181
 
 
182
    ExceptionCode ec = 0;
 
183
    impl()->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec);
 
184
    setDOMException(exec, ec);
 
185
 
 
186
    return jsUndefined();
 
187
}
 
188
 
 
189
JSValue JSHistory::replaceState(ExecState* exec, const ArgList& args)
 
190
{
 
191
    RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, args.at(0));
 
192
    if (exec->hadException())
 
193
        return jsUndefined();
 
194
 
 
195
    String title = valueToStringWithUndefinedOrNullCheck(exec, args.at(1));
 
196
    if (exec->hadException())
 
197
        return jsUndefined();
 
198
        
 
199
    String url;
 
200
    if (args.size() > 2) {
 
201
        url = valueToStringWithUndefinedOrNullCheck(exec, args.at(2));
 
202
        if (exec->hadException())
 
203
            return jsUndefined();
 
204
    }
 
205
 
 
206
    ExceptionCode ec = 0;
 
207
    impl()->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
 
208
    setDOMException(exec, ec);
 
209
 
 
210
    return jsUndefined();
 
211
}
 
212
 
166
213
} // namespace WebCore