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

Unified Diff: Source/bindings/core/v8/custom/V8HistoryCustom.cpp

Issue 1007113002: The history.pushState/replaceState should check for minimum arity exception. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/history/state-object-few-arguements-exception-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/custom/V8HistoryCustom.cpp
diff --git a/Source/bindings/core/v8/custom/V8HistoryCustom.cpp b/Source/bindings/core/v8/custom/V8HistoryCustom.cpp
index d6c99e308391d3837c73bbca45b6ee586527e908..59412ab2156930c50daaec25f5600e8318a96a42 100644
--- a/Source/bindings/core/v8/custom/V8HistoryCustom.cpp
+++ b/Source/bindings/core/v8/custom/V8HistoryCustom.cpp
@@ -63,6 +63,13 @@ void V8History::stateAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Va
void V8History::pushStateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "pushState", "History", info.Holder(), info.GetIsolate());
+
+ if (info.Length() < 2) {
vivekg 2015/03/18 11:11:54 Please try this form: if (UNLIKELY(info.Length()
+ exceptionState.throwTypeError("Not enough arguments to History.pushState.");
+ exceptionState.throwIfNeeded();
+ return;
+ }
+
RefPtr<SerializedScriptValue> historyState = SerializedScriptValueFactory::instance().create(info[0], 0, 0, exceptionState, info.GetIsolate());
if (exceptionState.throwIfNeeded())
return;
@@ -79,6 +86,13 @@ void V8History::pushStateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
void V8History::replaceStateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "replaceState", "History", info.Holder(), info.GetIsolate());
+
+ if (info.Length() < 2) {
vivekg 2015/03/18 11:11:54 ditto
+ exceptionState.throwTypeError("Not enough arguments to History.replaceState.");
+ exceptionState.throwIfNeeded();
+ return;
+ }
+
RefPtr<SerializedScriptValue> historyState = SerializedScriptValueFactory::instance().create(info[0], 0, 0, exceptionState, info.GetIsolate());
if (exceptionState.throwIfNeeded())
return;
« no previous file with comments | « LayoutTests/fast/history/state-object-few-arguements-exception-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698