96
96
bool JSHistory::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
98
// When accessing History cross-domain, functions are always the native built-in ones.
99
// See JSDOMWindow::getOwnPropertySlotDelegate for additional details.
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.
104
if (allowsAccessFromFrame(exec, impl()->frame(), message))
98
if (!impl()->frame()) {
99
descriptor.setUndefined();
103
// Throw out all cross domain access
104
if (!allowsAccessFromFrame(exec, impl()->frame()))
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);
163
162
Base::getOwnPropertyNames(exec, propertyNames);
165
JSValue JSHistory::pushState(ExecState* exec, const ArgList& args)
167
RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, args.at(0));
168
if (exec->hadException())
169
return jsUndefined();
171
String title = valueToStringWithUndefinedOrNullCheck(exec, args.at(1));
172
if (exec->hadException())
173
return jsUndefined();
176
if (args.size() > 2) {
177
url = valueToStringWithUndefinedOrNullCheck(exec, args.at(2));
178
if (exec->hadException())
179
return jsUndefined();
182
ExceptionCode ec = 0;
183
impl()->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec);
184
setDOMException(exec, ec);
186
return jsUndefined();
189
JSValue JSHistory::replaceState(ExecState* exec, const ArgList& args)
191
RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, args.at(0));
192
if (exec->hadException())
193
return jsUndefined();
195
String title = valueToStringWithUndefinedOrNullCheck(exec, args.at(1));
196
if (exec->hadException())
197
return jsUndefined();
200
if (args.size() > 2) {
201
url = valueToStringWithUndefinedOrNullCheck(exec, args.at(2));
202
if (exec->hadException())
203
return jsUndefined();
206
ExceptionCode ec = 0;
207
impl()->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
208
setDOMException(exec, ec);
210
return jsUndefined();
166
213
} // namespace WebCore