diff options
Diffstat (limited to 'WebCore/bindings/v8/custom/V8HistoryCustom.cpp')
-rw-r--r-- | WebCore/bindings/v8/custom/V8HistoryCustom.cpp | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp index 6075ec5..ad2b9a9 100644 --- a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp @@ -43,7 +43,10 @@ namespace WebCore { v8::Handle<v8::Value> V8History::pushStateCallback(const v8::Arguments& args) { - RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0]); + bool didThrow = false; + RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0], didThrow); + if (didThrow) + return v8::Undefined(); v8::TryCatch tryCatch; String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]); @@ -64,7 +67,10 @@ v8::Handle<v8::Value> V8History::pushStateCallback(const v8::Arguments& args) v8::Handle<v8::Value> V8History::replaceStateCallback(const v8::Arguments& args) { - RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0]); + bool didThrow = false; + RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0], didThrow); + if (didThrow) + return v8::Undefined(); v8::TryCatch tryCatch; String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]); @@ -83,33 +89,18 @@ v8::Handle<v8::Value> V8History::replaceStateCallback(const v8::Arguments& args) return throwError(ec); } -bool V8History::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value> data) +bool V8History::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value>) { - ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY); // Only allow same origin access. History* history = V8History::toNative(host); return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), history->frame(), false); } -bool V8History::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value> data) +bool V8History::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>) { - ASSERT(V8ClassIndex::FromInt(data->Int32Value()) == V8ClassIndex::HISTORY); // Only allow same origin access. History* history = V8History::toNative(host); return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), history->frame(), false); } -v8::Handle<v8::Value> toV8(History* impl) -{ - if (!impl) - return v8::Null(); - v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl); - if (wrapper.IsEmpty()) { - wrapper = V8History::wrap(impl); - if (!wrapper.IsEmpty()) - V8DOMWrapper::setHiddenWindowReference(impl->frame(), V8DOMWindow::historyIndex, wrapper); - } - return wrapper; -} - } // namespace WebCore |