| Index: Source/bindings/scripts/code_generator_v8.pm
|
| diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
|
| index 2a44746ef9f787d384ebbc48afe53b586219eb95..da8c571201934d464f22521616874f01bb526447 100644
|
| --- a/Source/bindings/scripts/code_generator_v8.pm
|
| +++ b/Source/bindings/scripts/code_generator_v8.pm
|
| @@ -1276,6 +1276,7 @@ sub GenerateDomainSafeFunctionSetter
|
| {
|
| my $interface = shift;
|
|
|
| + my $interfaceName = $interface->name();
|
| my $implClassName = GetImplName($interface);
|
| my $v8ClassName = GetV8ClassName($interface);
|
|
|
| @@ -1288,7 +1289,7 @@ static void ${implClassName}OriginSafeMethodSetter(v8::Local<v8::String> name, v
|
| if (holder.IsEmpty())
|
| return;
|
| ${implClassName}* imp = ${v8ClassName}::toNative(holder);
|
| - ExceptionState exceptionState(info.Holder(), info.GetIsolate());
|
| + ExceptionState exceptionState(ExceptionState::SetterContext, *v8::String::Utf8Value(name), "${interfaceName}", info.Holder(), info.GetIsolate());
|
| if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)) {
|
| exceptionState.throwIfNeeded();
|
| return;
|
| @@ -1542,7 +1543,7 @@ END
|
| if ($useExceptions || $attribute->extendedAttributes->{"CheckSecurity"}) {
|
| AddToImplIncludes("bindings/v8/ExceptionMessages.h");
|
| AddToImplIncludes("bindings/v8/ExceptionState.h");
|
| - $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
|
| + $code .= " ExceptionState exceptionState(ExceptionState::GetterContext, \"${attrName}\", \"${interfaceName}\" ,info.Holder(), info.GetIsolate());\n";
|
| }
|
|
|
| # Generate security checks if necessary
|
| @@ -1800,6 +1801,7 @@ sub GenerateReplaceableAttributeSetter
|
| {
|
| my $interface = shift;
|
|
|
| + my $interfaceName = $interface->name();
|
| my $implClassName = GetImplName($interface);
|
| my $v8ClassName = GetV8ClassName($interface);
|
|
|
| @@ -1812,7 +1814,7 @@ END
|
| AddToImplIncludes("bindings/v8/BindingSecurity.h");
|
| $code .= <<END;
|
| ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder());
|
| - ExceptionState exceptionState(info.Holder(), info.GetIsolate());
|
| + ExceptionState exceptionState(ExceptionState::SetterContext, *v8::String::Utf8Value(name), "${interfaceName}", info.Holder(), info.GetIsolate());
|
| if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame(), exceptionState)) {
|
| exceptionState.throwIfNeeded();
|
| return;
|
| @@ -1926,6 +1928,13 @@ sub GenerateNormalAttributeSetter
|
| }
|
| $code .= "{\n";
|
|
|
| + my $raisesException = $attribute->extendedAttributes->{"RaisesException"};
|
| + my $useExceptions = 1 if $raisesException && ($raisesException eq "VALUE_IS_MISSING" or $raisesException eq "Setter");
|
| +
|
| + AddToImplIncludes("bindings/v8/ExceptionMessages.h");
|
| + AddToImplIncludes("bindings/v8/ExceptionState.h");
|
| + $code .= " ExceptionState exceptionState(ExceptionState::SetterContext, \"${attrName}\", \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
|
| +
|
| # If the "StrictTypeChecking" extended attribute is present, and the attribute's type is an
|
| # interface type, then if the incoming value does not implement that interface, a TypeError is
|
| # thrown rather than silently passing NULL to the C++ code.
|
| @@ -1935,7 +1944,8 @@ sub GenerateNormalAttributeSetter
|
| my $argType = $attribute->type;
|
| if (IsWrapperType($argType)) {
|
| $code .= " if (!isUndefinedOrNull(jsValue) && !V8${argType}::hasInstance(jsValue, info.GetIsolate(), worldType(info.GetIsolate()))) {\n";
|
| - $code .= " throwTypeError(ExceptionMessages::failedToSet(\"${attrName}\", \"${interfaceName}\", \"The provided value is not of type '${argType}'.\"), info.GetIsolate());\n";
|
| + $code .= " exceptionState.throwTypeError(\"The provided value is not of type '${argType}'.\");\n";
|
| + $code .= " exceptionState.throwIfNeeded();\n";
|
| $code .= " return;\n";
|
| $code .= " }\n";
|
| }
|
| @@ -1953,7 +1963,8 @@ END
|
| AddToImplIncludes("bindings/v8/ExceptionState.h");
|
| $code .= " $svgNativeType* wrapper = ${v8ClassName}::toNative(info.Holder());\n";
|
| $code .= " if (wrapper->isReadOnly()) {\n";
|
| - $code .= " setDOMException(NoModificationAllowedError, ExceptionMessages::failedToSet(\"${attrName}\", \"${interfaceName}\", \"The attribute is read-only.\"), info.GetIsolate());\n";
|
| + $code .= " exceptionState.throwDOMException(NoModificationAllowedError, \"The attribute is read-only.\");\n";
|
| + $code .= " exceptionState.throwIfNeeded();\n";
|
| $code .= " return;\n";
|
| $code .= " }\n";
|
| $code .= " $svgWrappedNativeType& impInstance = wrapper->propertyReference();\n";
|
| @@ -2045,22 +2056,14 @@ END
|
| if ($returnSvgNativeType) {
|
| $code .= <<END;
|
| if (!$expression) {
|
| - throwTypeError(ExceptionMessages::failedToSet(\"${attrName}\", \"${interfaceName}\", \"The provided value is not of type '$returnType'.\"), info.GetIsolate());
|
| + exceptionState.throwTypeError(\"The provided value is not of type '$returnType'.\");
|
| + exceptionState.throwIfNeeded();
|
| return;
|
| }
|
| END
|
| $expression = $expression . "->propertyReference()";
|
| }
|
|
|
| - my $raisesException = $attribute->extendedAttributes->{"RaisesException"};
|
| - my $useExceptions = 1 if $raisesException && ($raisesException eq "VALUE_IS_MISSING" or $raisesException eq "Setter");
|
| -
|
| - if ($useExceptions) {
|
| - AddToImplIncludes("bindings/v8/ExceptionMessages.h");
|
| - AddToImplIncludes("bindings/v8/ExceptionState.h");
|
| - $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
|
| - }
|
| -
|
| if ($attribute->type eq "EventHandler") {
|
| my $implementedBy = $attribute->extendedAttributes->{"ImplementedBy"};
|
| my $implementedByImplName;
|
| @@ -2331,6 +2334,7 @@ sub GenerateFunction
|
| my $implClassName = GetImplName($interface);
|
| my $v8ClassName = GetV8ClassName($interface);
|
| my $name = $function->name;
|
| + my $unoverloadedName = $function->name;
|
| my $implName = GetImplName($function);
|
| my $funcExt = $function->extendedAttributes;
|
|
|
| @@ -2349,6 +2353,8 @@ sub GenerateFunction
|
| $code .= "static void ${name}Method${forMainWorldSuffix}(const v8::FunctionCallbackInfo<v8::Value>& info)\n";
|
| $code .= "{\n";
|
|
|
| + $code .= " ExceptionState exceptionState(ExceptionState::ExecutionContext, \"${unoverloadedName}\", \"${interfaceName}\", info.Holder(), info.GetIsolate());\n";
|
| +
|
| if ($name eq "addEventListener" || $name eq "removeEventListener") {
|
| my $lookupType = ($name eq "addEventListener") ? "OrCreate" : "Only";
|
| my $passRefPtrHandling = ($name eq "addEventListener") ? "" : ".get()";
|
| @@ -2361,7 +2367,6 @@ sub GenerateFunction
|
| $code .= <<END;
|
| EventTarget* impl = ${v8ClassName}::toNative(info.Holder());
|
| if (DOMWindow* window = impl->toDOMWindow()) {
|
| - ExceptionState exceptionState(info.Holder(), info.GetIsolate());
|
| if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), exceptionState)) {
|
| exceptionState.throwIfNeeded();
|
| return;
|
| @@ -2409,7 +2414,8 @@ END
|
| AddToImplIncludes("core/dom/ExceptionCode.h");
|
| $code .= " $nativeClassName wrapper = ${v8ClassName}::toNative(info.Holder());\n";
|
| $code .= " if (wrapper->isReadOnly()) {\n";
|
| - $code .= " setDOMException(NoModificationAllowedError, ExceptionMessages::failedToExecute(\"${name}\", \"${interfaceName}\", \"The object is read-only.\"), info.GetIsolate());\n";
|
| + $code .= " exceptionState.throwDOMException(NoModificationAllowedError, \"The object is read-only.\");\n";
|
| + $code .= " exceptionState.throwIfNeeded();\n";
|
| $code .= " return;\n";
|
| $code .= " }\n";
|
| my $svgWrappedNativeType = GetSVGWrappedTypeNeedingTearOff($interfaceName);
|
| @@ -2424,13 +2430,6 @@ END
|
|
|
| $code .= GenerateCustomElementInvocationScopeIfNeeded($funcExt);
|
|
|
| - my $raisesExceptions = $function->extendedAttributes->{"RaisesException"} || ($interface->extendedAttributes->{"CheckSecurity"} && !$function->extendedAttributes->{"DoNotCheckSecurity"});
|
| - if ($raisesExceptions) {
|
| - AddToImplIncludes("bindings/v8/ExceptionMessages.h");
|
| - AddToImplIncludes("bindings/v8/ExceptionState.h");
|
| - $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsolate());\n";
|
| - }
|
| -
|
| # Check domain security if needed
|
| if ($interface->extendedAttributes->{"CheckSecurity"} && !$function->extendedAttributes->{"DoNotCheckSecurity"}) {
|
| # We have not find real use cases yet.
|
|
|