| Index: Source/bindings/tests/results/V8TestInterface.cpp
|
| diff --git a/Source/bindings/tests/results/V8TestInterface.cpp b/Source/bindings/tests/results/V8TestInterface.cpp
|
| index 6a089b901261abaa5bfc76b62f0f55ae53e059d2..931aaa3f579dcd413da9cd37412f332414a54db1 100644
|
| --- a/Source/bindings/tests/results/V8TestInterface.cpp
|
| +++ b/Source/bindings/tests/results/V8TestInterface.cpp
|
| @@ -16,6 +16,7 @@
|
| #include "bindings/tests/v8/V8Node.h"
|
| #include "bindings/tests/v8/V8TestInterface.h"
|
| #include "bindings/tests/v8/V8TestInterfaceEmpty.h"
|
| +#include "bindings/v8/BindingSecurity.h"
|
| #include "bindings/v8/ExceptionState.h"
|
| #include "bindings/v8/ScriptValue.h"
|
| #include "bindings/v8/V8AbstractEventListener.h"
|
| @@ -25,6 +26,7 @@
|
| #include "bindings/v8/V8ObjectConstructor.h"
|
| #include "core/dom/ContextFeatures.h"
|
| #include "core/dom/Document.h"
|
| +#include "core/frame/DOMWindow.h"
|
| #include "platform/TraceEvent.h"
|
| #include "wtf/GetPtr.h"
|
| #include "wtf/RefPtr.h"
|
| @@ -795,17 +797,27 @@ static void TestInterfaceImplementationReplaceableAttributeSetterCallback(v8::Lo
|
|
|
| static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodTestInterfaceEmptyArg", "TestInterface", info.Holder(), info.GetIsolate());
|
| if (UNLIKELY(info.Length() < 1)) {
|
| - throwMinimumArityTypeErrorForMethod("voidMethodTestInterfaceEmptyArg", "TestInterface", 1, info.Length(), info.GetIsolate());
|
| + throwMinimumArityTypeError(exceptionState, 1, info.Length());
|
| return;
|
| }
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| TestInterfaceEmpty* testInterfaceEmptyArg;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate())) {
|
| - throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate());
|
| + exceptionState.throwTypeError("parameter 1 is not of type 'TestInterfaceEmpty'.");
|
| + exceptionState.throwIfNeeded();
|
| return;
|
| }
|
| TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
|
| @@ -822,11 +834,20 @@ static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall
|
|
|
| static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodDoubleArgFloatArg", "TestInterface", info.Holder(), info.GetIsolate());
|
| if (UNLIKELY(info.Length() < 2)) {
|
| - throwMinimumArityTypeErrorForMethod("voidMethodDoubleArgFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate());
|
| + throwMinimumArityTypeError(exceptionState, 2, info.Length());
|
| return;
|
| }
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| double doubleArg;
|
| float floatArg;
|
| {
|
| @@ -834,12 +855,14 @@ static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8:
|
| V8RethrowTryCatchScope rethrow(block);
|
| TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberValue()));
|
| if (!std::isfinite(doubleArg)) {
|
| - throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFloatArg", "TestInterface", "double parameter 1 is non-finite."), info.GetIsolate());
|
| + exceptionState.throwTypeError("double parameter 1 is non-finite.");
|
| + exceptionState.throwIfNeeded();
|
| return;
|
| }
|
| TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[1]->NumberValue()));
|
| if (!std::isfinite(floatArg)) {
|
| - throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFloatArg", "TestInterface", "float parameter 2 is non-finite."), info.GetIsolate());
|
| + exceptionState.throwTypeError("float parameter 2 is non-finite.");
|
| + exceptionState.throwIfNeeded();
|
| return;
|
| }
|
| }
|
| @@ -855,11 +878,20 @@ static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback
|
|
|
| static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface", info.Holder(), info.GetIsolate());
|
| if (UNLIKELY(info.Length() < 2)) {
|
| - throwMinimumArityTypeErrorForMethod("voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate());
|
| + throwMinimumArityTypeError(exceptionState, 2, info.Length());
|
| return;
|
| }
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| double unrestrictedDoubleArg;
|
| float unrestrictedFloatArg;
|
| {
|
| @@ -880,7 +912,16 @@ static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(co
|
|
|
| static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| impl->voidMethod();
|
| }
|
|
|
| @@ -893,7 +934,16 @@ static void voidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
|
|
|
| static void voidMethodMethodForMainWorld(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| impl->voidMethod();
|
| }
|
|
|
| @@ -906,7 +956,16 @@ static void voidMethodMethodCallbackForMainWorld(const v8::FunctionCallbackInfo<
|
|
|
| static void implementsVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| impl->implementsVoidMethod();
|
| }
|
|
|
| @@ -925,6 +984,14 @@ static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val
|
| return;
|
| }
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| V8StringResource<> strArg;
|
| TestInterfaceEmpty* testInterfaceEmptyArg;
|
| {
|
| @@ -963,6 +1030,15 @@ static void implementsCustomVoidMethodMethodCallback(const v8::FunctionCallbackI
|
|
|
| static void implementsStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsStaticVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| TestInterfaceImplementation::implementsStaticVoidMethod();
|
| }
|
|
|
| @@ -975,7 +1051,16 @@ static void implementsStaticVoidMethodMethodCallback(const v8::FunctionCallbackI
|
|
|
| static void implements2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "implements2VoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| TestImplements2::implements2VoidMethod(*impl);
|
| }
|
|
|
| @@ -988,7 +1073,16 @@ static void implements2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v
|
|
|
| static void implements3VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "implements3VoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| TestImplements3Implementation::implements3VoidMethod(*impl);
|
| }
|
|
|
| @@ -1001,6 +1095,15 @@ static void implements3VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v
|
|
|
| static void implements3StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "implements3StaticVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| TestImplements3Implementation::implements3StaticVoidMethod();
|
| }
|
|
|
| @@ -1014,7 +1117,16 @@ static void implements3StaticVoidMethodMethodCallback(const v8::FunctionCallback
|
| #if ENABLE(PARTIAL_CONDITION)
|
| static void partialVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| TestPartialInterface::partialVoidMethod(*impl);
|
| }
|
| #endif // ENABLE(PARTIAL_CONDITION)
|
| @@ -1031,6 +1143,15 @@ static void partialVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::V
|
| #if ENABLE(PARTIAL_CONDITION)
|
| static void partialStaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialStaticVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| TestPartialInterface::partialStaticVoidMethod();
|
| }
|
| #endif // ENABLE(PARTIAL_CONDITION)
|
| @@ -1053,6 +1174,14 @@ static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va
|
| return;
|
| }
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| int longArg;
|
| {
|
| v8::TryCatch block;
|
| @@ -1077,6 +1206,14 @@ static void partialCallWithExecutionContextRaisesExceptionVoidMethodMethod(const
|
| {
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialCallWithExecutionContextRaisesExceptionVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
|
| TestPartialInterface::partialCallWithExecutionContextRaisesExceptionVoidMethod(scriptContext, *impl, exceptionState);
|
| if (exceptionState.hadException()) {
|
| @@ -1098,11 +1235,20 @@ static void partialCallWithExecutionContextRaisesExceptionVoidMethodMethodCallba
|
| #if ENABLE(PARTIAL_CONDITION)
|
| static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoidMethodPartialCallbackTypeArg", "TestInterface", info.Holder(), info.GetIsolate());
|
| if (UNLIKELY(info.Length() < 1)) {
|
| - throwMinimumArityTypeErrorForMethod("partialVoidMethodPartialCallbackTypeArg", "TestInterface", 1, info.Length(), info.GetIsolate());
|
| + throwMinimumArityTypeError(exceptionState, 1, info.Length());
|
| return;
|
| }
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| ScriptValue partialCallbackTypeArg;
|
| {
|
| v8::TryCatch block;
|
| @@ -1124,7 +1270,16 @@ static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::Func
|
|
|
| static void partial2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2VoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| TestPartialInterfaceImplementation::partial2VoidMethod(*impl);
|
| }
|
|
|
| @@ -1137,6 +1292,15 @@ static void partial2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::
|
|
|
| static void partial2StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| + ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2StaticVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
|
| + if (DOMWindow* window = impl->toDOMWindow()) {
|
| + if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), window->frame(), exceptionState)) {
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + if (!window->document())
|
| + return;
|
| + }
|
| TestPartialInterfaceImplementation::partial2StaticVoidMethod();
|
| }
|
|
|
|
|