From 46904191756ff10fd5c518c61403fbce55275b90 Mon Sep 17 00:00:00 2001 From: "haraken@chromium.org" Date: Sun, 19 Feb 2012 23:47:10 +0000 Subject: [PATCH] Rename [CheckDomainSecurity] to [CheckSecurity] https://bugs.webkit.org/show_bug.cgi?id=78874 Reviewed by Adam Barth. "Domain security" isn't a term that's used elsewhere. This patch renames IDL attributes as follows: - [CheckDomainSecurity] => [CheckSecurity] - [DoNotCheckDomainSecurity] => [DoNotCheckSecurity] - [DoNotCheckDomainSecurityOnGetter] => [DoNotCheckSecurityOnGetter] - [DoNotCheckDomainSecurityOnSetter] => [DoNotCheckSecurityOnSetter] No tests. No change in behavior. * bindings/scripts/CodeGeneratorJS.pm: (GenerateGetOwnPropertyDescriptorBody): (GenerateImplementation): * bindings/scripts/CodeGeneratorV8.pm: (GenerateHeader): (IsVisibleAcrossOrigins): (GenerateFunctionCallback): (GenerateSingleBatchedAttribute): (GenerateImplementation): (GenerateToV8Converters): * bindings/scripts/test/TestDomainSecurity.idl: * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: (WebCore::ConfigureV8TestActiveDOMObjectTemplate): * page/DOMWindow.idl: * page/History.idl: * page/Location.idl: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108201 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 34 ++++++++++++++++++ Source/WebCore/bindings/scripts/CodeGeneratorJS.pm | 18 +++++----- Source/WebCore/bindings/scripts/CodeGeneratorV8.pm | 28 +++++++-------- .../bindings/scripts/test/TestDomainSecurity.idl | 4 +-- .../scripts/test/V8/V8TestActiveDOMObject.cpp | 2 +- Source/WebCore/page/DOMWindow.idl | 40 +++++++++++----------- Source/WebCore/page/History.idl | 8 ++--- Source/WebCore/page/Location.idl | 4 +-- 8 files changed, 86 insertions(+), 52 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index a4a0aea..aa73c52 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,37 @@ +2012-02-19 Kentaro Hara + + Rename [CheckDomainSecurity] to [CheckSecurity] + https://bugs.webkit.org/show_bug.cgi?id=78874 + + Reviewed by Adam Barth. + + "Domain security" isn't a term that's used elsewhere. + This patch renames IDL attributes as follows: + + - [CheckDomainSecurity] => [CheckSecurity] + - [DoNotCheckDomainSecurity] => [DoNotCheckSecurity] + - [DoNotCheckDomainSecurityOnGetter] => [DoNotCheckSecurityOnGetter] + - [DoNotCheckDomainSecurityOnSetter] => [DoNotCheckSecurityOnSetter] + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateGetOwnPropertyDescriptorBody): + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateHeader): + (IsVisibleAcrossOrigins): + (GenerateFunctionCallback): + (GenerateSingleBatchedAttribute): + (GenerateImplementation): + (GenerateToV8Converters): + * bindings/scripts/test/TestDomainSecurity.idl: + * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: + (WebCore::ConfigureV8TestActiveDOMObjectTemplate): + * page/DOMWindow.idl: + * page/History.idl: + * page/Location.idl: + 2012-02-19 James Robinson Unreviewed, rolling out r108195. diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index e53e5c4..ac703cd 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -497,7 +497,7 @@ sub GenerateGetOwnPropertyDescriptorBody my $namespaceMaybe = ($inlined ? "JSC::" : ""); my @getOwnPropertyDescriptorImpl = (); - if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) { + if ($dataNode->extendedAttributes->{"CheckSecurity"}) { if ($interfaceName eq "DOMWindow") { push(@implContent, " if (!thisObject->allowsAccessFrom(exec))\n"); } else { @@ -1688,9 +1688,9 @@ sub GenerateImplementation $needsMarkChildren = 1; } - if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && - !$attribute->signature->extendedAttributes->{"DoNotCheckDomainSecurity"} && - !$attribute->signature->extendedAttributes->{"DoNotCheckDomainSecurityOnGetter"}) { + if ($dataNode->extendedAttributes->{"CheckSecurity"} && + !$attribute->signature->extendedAttributes->{"DoNotCheckSecurity"} && + !$attribute->signature->extendedAttributes->{"DoNotCheckSecurityOnGetter"}) { push(@implContent, " if (!castedThis->allowsAccessFrom(exec))\n"); push(@implContent, " return jsUndefined();\n"); } @@ -1803,7 +1803,7 @@ sub GenerateImplementation push(@implContent, "{\n"); push(@implContent, " ${className}* domObject = static_cast<$className*>(asObject(slotBase));\n"); - if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) { + if ($dataNode->extendedAttributes->{"CheckSecurity"}) { push(@implContent, " if (!domObject->allowsAccessFrom(exec))\n"); push(@implContent, " return jsUndefined();\n"); } @@ -1874,7 +1874,7 @@ sub GenerateImplementation push(@implContent, "void ${putFunctionName}(ExecState* exec, JSObject* thisObject, JSValue value)\n"); push(@implContent, "{\n"); - if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && !$attribute->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) { + if ($dataNode->extendedAttributes->{"CheckSecurity"} && !$attribute->signature->extendedAttributes->{"DoNotCheckSecurity"}) { if ($interfaceName eq "DOMWindow") { push(@implContent, " if (!static_cast<$className*>(thisObject)->allowsAccessFrom(exec))\n"); } else { @@ -1999,7 +1999,7 @@ sub GenerateImplementation push(@implContent, "void ${constructorFunctionName}(ExecState* exec, JSObject* thisObject, JSValue value)\n"); push(@implContent, "{\n"); - if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) { + if ($dataNode->extendedAttributes->{"CheckSecurity"}) { if ($interfaceName eq "DOMWindow") { push(@implContent, " if (!static_cast<$className*>(thisObject)->allowsAccessFrom(exec))\n"); } else { @@ -2090,8 +2090,8 @@ sub GenerateImplementation push(@implContent, " ASSERT_GC_OBJECT_INHERITS(castedThis, &${className}::s_info);\n") unless ($function->isStatic); - if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} and - !$function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"} and + if ($dataNode->extendedAttributes->{"CheckSecurity"} and + !$function->signature->extendedAttributes->{"DoNotCheckSecurity"} and !$function->isStatic) { push(@implContent, " if (!castedThis->allowsAccessFrom(exec))\n"); push(@implContent, " return JSValue::encode(jsUndefined());\n"); diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index bd6136d..7754e40 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -407,7 +407,7 @@ END GenerateHeaderCustomCall($dataNode); GenerateHeaderCustomInternalFieldIndices($dataNode); - if ($dataNode->extendedAttributes->{"CheckDomainSecurity"}) { + if ($dataNode->extendedAttributes->{"CheckSecurity"}) { push(@headerContent, < host, v8::Local key, v8::AccessType, v8::Local data); static bool indexedSecurityCheck(v8::Local host, uint32_t index, v8::AccessType, v8::Local data); @@ -675,7 +675,7 @@ sub IsNodeSubType sub IsVisibleAcrossOrigins { my $dataNode = shift; - return $dataNode->extendedAttributes->{"CheckDomainSecurity"} && !($dataNode->name eq "DOMWindow"); + return $dataNode->extendedAttributes->{"CheckSecurity"} && !($dataNode->name eq "DOMWindow"); } sub IsConstructable @@ -1387,9 +1387,9 @@ END } # Check domain security if needed - if (($dataNode->extendedAttributes->{"CheckDomainSecurity"} + if (($dataNode->extendedAttributes->{"CheckSecurity"} || $interfaceName eq "DOMWindow") - && !$function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) { + && !$function->signature->extendedAttributes->{"DoNotCheckSecurity"}) { # We have not find real use cases yet. push(@implContentDecls, <frame(), true)) @@ -1929,11 +1929,11 @@ sub GenerateSingleBatchedAttribute my $attrExt = $attribute->signature->extendedAttributes; my $accessControl = "v8::DEFAULT"; - if ($attrExt->{"DoNotCheckDomainSecurityOnGetter"}) { + if ($attrExt->{"DoNotCheckSecurityOnGetter"}) { $accessControl = "v8::ALL_CAN_READ"; - } elsif ($attrExt->{"DoNotCheckDomainSecurityOnSetter"}) { + } elsif ($attrExt->{"DoNotCheckSecurityOnSetter"}) { $accessControl = "v8::ALL_CAN_WRITE"; - } elsif ($attrExt->{"DoNotCheckDomainSecurity"}) { + } elsif ($attrExt->{"DoNotCheckSecurity"}) { $accessControl = "v8::ALL_CAN_READ"; if (!($attribute->type =~ /^readonly/) && !($attrExt->{"V8ReadOnly"})) { $accessControl .= " | v8::ALL_CAN_WRITE"; @@ -2333,7 +2333,7 @@ sub GenerateImplementation # If the function does not need domain security check, we need to # generate an access getter that returns different function objects # for different calling context. - if (($dataNode->extendedAttributes->{"CheckDomainSecurity"} || ($interfaceName eq "DOMWindow")) && $function->signature->extendedAttributes->{"DoNotCheckDomainSecurity"}) { + if (($dataNode->extendedAttributes->{"CheckSecurity"} || ($interfaceName eq "DOMWindow")) && $function->signature->extendedAttributes->{"DoNotCheckSecurity"}) { if (!$isCustom || $function->{overloadIndex} == 1) { GenerateDomainSafeFunctionGetter($function, $implClassName); } @@ -2393,8 +2393,8 @@ sub GenerateImplementation if ($attrExt->{"V8EnabledAtRuntime"} || RequiresCustomSignature($function) || $attrExt->{"V8DoNotCheckSignature"}) { next; } - if ($attrExt->{"DoNotCheckDomainSecurity"} && - ($dataNode->extendedAttributes->{"CheckDomainSecurity"} || $interfaceName eq "DOMWindow")) { + if ($attrExt->{"DoNotCheckSecurity"} && + ($dataNode->extendedAttributes->{"CheckSecurity"} || $interfaceName eq "DOMWindow")) { next; } if ($attrExt->{"NotEnumerable"} || $attrExt->{"V8ReadOnly"}) { @@ -2460,7 +2460,7 @@ END } my $access_check = ""; - if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && !($interfaceName eq "DOMWindow")) { + if ($dataNode->extendedAttributes->{"CheckSecurity"} && !($interfaceName eq "DOMWindow")) { $access_check = "instance->SetAccessCheckCallbacks(V8${interfaceName}::namedSecurityCheck, V8${interfaceName}::indexedSecurityCheck, v8::External::Wrap(&V8${interfaceName}::info));"; } @@ -2617,8 +2617,8 @@ END $conditional = "if (${enable_function}())\n "; } - if ($attrExt->{"DoNotCheckDomainSecurity"} && - ($dataNode->extendedAttributes->{"CheckDomainSecurity"} || $interfaceName eq "DOMWindow")) { + if ($attrExt->{"DoNotCheckSecurity"} && + ($dataNode->extendedAttributes->{"CheckSecurity"} || $interfaceName eq "DOMWindow")) { # Mark the accessor as ReadOnly and set it on the proto object so # it can be shadowed. This is really a hack to make it work. # There are several sceneria to call into the accessor: @@ -3045,7 +3045,7 @@ END # FIXME: We need a better way of recovering the correct prototype chain # for every sort of object. For now, we special-case cross-origin visible - # objects (i.e., those with CheckDomainSecurity). + # objects (i.e., those with CheckSecurity). if (IsVisibleAcrossOrigins($dataNode)) { push(@implContent, <frame()) { diff --git a/Source/WebCore/bindings/scripts/test/TestDomainSecurity.idl b/Source/WebCore/bindings/scripts/test/TestDomainSecurity.idl index 09d60bd..bbd46e0 100644 --- a/Source/WebCore/bindings/scripts/test/TestDomainSecurity.idl +++ b/Source/WebCore/bindings/scripts/test/TestDomainSecurity.idl @@ -28,10 +28,10 @@ module test { interface [ - CheckDomainSecurity + CheckSecurity ] TestActiveDOMObject { readonly attribute long excitingAttr; void excitingFunction(in Node nextChild); - [DoNotCheckDomainSecurity] void postMessage(in DOMString message); + [DoNotCheckSecurity] void postMessage(in DOMString message); }; } diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp index b87bb54..dc73c26 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestActiveDOMObject.cpp @@ -117,7 +117,7 @@ static v8::Persistent ConfigureV8TestActiveDOMObjectTempla v8::Handle excitingFunctionSignature = v8::Signature::New(desc, excitingFunctionArgc, excitingFunctionArgv); proto->Set(v8::String::New("excitingFunction"), v8::FunctionTemplate::New(TestActiveDOMObjectInternal::excitingFunctionCallback, v8::Handle(), excitingFunctionSignature)); - // Function 'postMessage' (ExtAttr: 'DoNotCheckDomainSecurity') + // Function 'postMessage' (ExtAttr: 'DoNotCheckSecurity') proto->SetAccessor(v8::String::New("postMessage"), TestActiveDOMObjectInternal::postMessageAttrGetter, 0, v8::Handle(), v8::ALL_CAN_READ, static_cast(v8::DontDelete | v8::ReadOnly)); // Custom toString template diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index f72f512..e94238d 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -27,7 +27,7 @@ module window { interface [ - CheckDomainSecurity, + CheckSecurity, JSCustomDefineOwnProperty, CustomDeleteProperty, CustomGetOwnPropertySlot, @@ -44,7 +44,7 @@ module window { ] DOMWindow { // DOM Level 0 attribute [Replaceable] Screen screen; - attribute [Replaceable, DoNotCheckDomainSecurityOnGetter, JSCustomGetter] History history; + attribute [Replaceable, DoNotCheckSecurityOnGetter, JSCustomGetter] History history; attribute [Replaceable] BarInfo locationbar; attribute [Replaceable] BarInfo menubar; attribute [Replaceable] BarInfo personalbar; @@ -55,7 +55,7 @@ module window { attribute [Replaceable] Navigator clientInformation; readonly attribute Crypto crypto; #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP - attribute [DoNotCheckDomainSecurity, JSCustom, V8CustomSetter, V8Unforgeable] Location location; + attribute [DoNotCheckSecurity, JSCustom, V8CustomSetter, V8Unforgeable] Location location; #endif attribute [Replaceable, CustomGetter, V8CustomSetter] Event event; @@ -64,9 +64,9 @@ module window { readonly attribute [CheckSecurityForNode] Element frameElement; - [DoNotCheckDomainSecurity] void focus(); - [DoNotCheckDomainSecurity] void blur(); - [DoNotCheckDomainSecurity, CallWith=ScriptExecutionContext] void close(); + [DoNotCheckSecurity] void focus(); + [DoNotCheckSecurity] void blur(); + [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void close(); void print(); void stop(); @@ -115,9 +115,9 @@ module window { void resizeBy(in [Optional=DefaultIsUndefined] float x, in [Optional=DefaultIsUndefined] float y); // FIXME: this should take longs not floats. void resizeTo(in [Optional=DefaultIsUndefined] float width, in [Optional=DefaultIsUndefined] float height); // FIXME: this should take longs not floats. - readonly attribute [DoNotCheckDomainSecurity] boolean closed; + readonly attribute [DoNotCheckSecurity] boolean closed; - attribute [Replaceable, DoNotCheckDomainSecurityOnGetter] unsigned long length; + attribute [Replaceable, DoNotCheckSecurityOnGetter] unsigned long length; attribute DOMString name; @@ -129,13 +129,13 @@ module window { #endif // Self referential attributes - attribute [Replaceable, DoNotCheckDomainSecurityOnGetter] DOMWindow self; - readonly attribute [DoNotCheckDomainSecurity, V8Unforgeable] DOMWindow window; - attribute [Replaceable, DoNotCheckDomainSecurityOnGetter] DOMWindow frames; + attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow self; + readonly attribute [DoNotCheckSecurity, V8Unforgeable] DOMWindow window; + attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow frames; - attribute [Replaceable, DoNotCheckDomainSecurityOnGetter, V8CustomSetter] DOMWindow opener; - attribute [Replaceable, DoNotCheckDomainSecurityOnGetter] DOMWindow parent; - attribute [Replaceable, DoNotCheckDomainSecurityOnGetter, V8Unforgeable, V8ReadOnly] DOMWindow top; + attribute [Replaceable, DoNotCheckSecurityOnGetter, V8CustomSetter] DOMWindow opener; + attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow parent; + attribute [Replaceable, DoNotCheckSecurityOnGetter, V8Unforgeable, V8ReadOnly] DOMWindow top; // DOM Level 2 AbstractView Interface readonly attribute Document document; @@ -191,18 +191,18 @@ module window { // cross-document messaging #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [DoNotCheckDomainSecurity, Custom] void postMessage(in SerializedScriptValue message, in DOMString targetOrigin) + [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in DOMString targetOrigin) raises(DOMException); - [DoNotCheckDomainSecurity, Custom] void postMessage(in SerializedScriptValue message, in DOMString targetOrigin, in Array messagePorts) + [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in DOMString targetOrigin, in Array messagePorts) raises(DOMException); - [DoNotCheckDomainSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin) + [DoNotCheckSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin) raises(DOMException); - [DoNotCheckDomainSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin, in Array transferList) + [DoNotCheckSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin, in Array transferList) raises(DOMException); #else // There's no good way to expose an array via the ObjC bindings, so for now just allow passing in a single port. - [DoNotCheckDomainSecurity, Custom] void postMessage(in SerializedScriptValue message, in [Optional] MessagePort messagePort, in DOMString targetOrigin) + [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in [Optional] MessagePort messagePort, in DOMString targetOrigin) raises(DOMException); #endif @@ -797,7 +797,7 @@ module window { #if defined(V8_BINDING) && V8_BINDING // window.toString() requires special handling in V8 - [V8DoNotCheckSignature, DoNotCheckDomainSecurity, Custom, NotEnumerable] DOMString toString(); + [V8DoNotCheckSignature, DoNotCheckSecurity, Custom, NotEnumerable] DOMString toString(); #endif // defined(V8_BINDING) }; diff --git a/Source/WebCore/page/History.idl b/Source/WebCore/page/History.idl index 25eac2a..6e8f6ab 100644 --- a/Source/WebCore/page/History.idl +++ b/Source/WebCore/page/History.idl @@ -27,7 +27,7 @@ module window { interface [ #if defined(V8_BINDING) && V8_BINDING - CheckDomainSecurity, + CheckSecurity, #endif JSCustomGetOwnPropertySlotAndDescriptor, CustomNamedSetter, @@ -39,9 +39,9 @@ module window { readonly attribute unsigned long length; readonly attribute [CachedAttribute, Custom] SerializedScriptValue state; - [DoNotCheckDomainSecurity, CallWith=ScriptExecutionContext] void back(); - [DoNotCheckDomainSecurity, CallWith=ScriptExecutionContext] void forward(); - [DoNotCheckDomainSecurity, CallWith=ScriptExecutionContext] void go(in [Optional=DefaultIsUndefined] long distance); + [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void back(); + [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void forward(); + [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void go(in [Optional=DefaultIsUndefined] long distance); [Custom, V8EnabledAtRuntime] void pushState(in any data, in DOMString title, in [Optional] DOMString url) raises(DOMException); diff --git a/Source/WebCore/page/Location.idl b/Source/WebCore/page/Location.idl index 1ac1370..4f196fc 100644 --- a/Source/WebCore/page/Location.idl +++ b/Source/WebCore/page/Location.idl @@ -30,7 +30,7 @@ module window { interface [ #if defined(V8_BINDING) && V8_BINDING - CheckDomainSecurity, + CheckSecurity, #endif JSCustomGetOwnPropertySlotAndDescriptor, CustomNamedSetter, @@ -44,7 +44,7 @@ module window { V8CustomToJSObject ] Location { #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP - attribute [DoNotCheckDomainSecurityOnSetter, CustomSetter, V8Unforgeable] DOMString href; + attribute [DoNotCheckSecurityOnSetter, CustomSetter, V8Unforgeable] DOMString href; #endif [Custom, V8Unforgeable] void assign(in [Optional=DefaultIsUndefined] DOMString url); -- 2.7.4