Diff
Modified: trunk/Source/WebCore/ChangeLog (132666 => 132667)
--- trunk/Source/WebCore/ChangeLog 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/ChangeLog 2012-10-26 16:09:57 UTC (rev 132667)
@@ -1,3 +1,23 @@
+2012-10-26 Erik Arvidsson <[email protected]>
+
+ Replaceable attributes should also have readonly
+ https://bugs.webkit.org/show_bug.cgi?id=91768
+
+ Reviewed by Adam Barth.
+
+ This updates the code generators for JSC and V8 to handle this case correctly.
+
+ * Modules/intents/DOMWindowIntents.idl:
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+ * bindings/scripts/test/ObjC/DOMTestObj.h:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ * bindings/scripts/test/TestObj.idl:
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ * page/DOMWindow.idl:
+ * workers/WorkerContext.idl:
+
2012-10-26 Nico Weber <[email protected]>
Clear m_orientation in FrameData::clear() for skia
Modified: trunk/Source/WebCore/Modules/intents/DOMWindowIntents.idl (132666 => 132667)
--- trunk/Source/WebCore/Modules/intents/DOMWindowIntents.idl 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/Modules/intents/DOMWindowIntents.idl 2012-10-26 16:09:57 UTC (rev 132667)
@@ -30,6 +30,6 @@
] interface DOMWindowIntents {
attribute IntentConstructor WebKitIntent;
- [Replaceable] attribute DeliveredIntent webkitIntent;
+ [Replaceable] readonly attribute DeliveredIntent webkitIntent;
};
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (132666 => 132667)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2012-10-26 16:09:57 UTC (rev 132667)
@@ -314,6 +314,12 @@
return 0;
}
+sub IsReadonly
+{
+ my $attribute = shift;
+ return $attribute->type =~ /readonly/ && !$attribute->signature->extendedAttributes->{"Replaceable"};
+}
+
sub AddTypedefForScriptProfileType
{
my $type = shift;
@@ -807,7 +813,7 @@
# Check if we have any writable properties
my $hasReadWriteProperties = 0;
foreach (@{$dataNode->attributes}) {
- if ($_->type !~ /^readonly\ attribute$/ && !$_->isStatic) {
+ if (!IsReadonly($_) && !$_->isStatic) {
$hasReadWriteProperties = 1;
}
}
@@ -921,7 +927,7 @@
push(@headerContent, " JSC::JSValue " . $methodName . "(JSC::ExecState*) const;\n");
push(@headerContent, "#endif\n") if $conditionalString;
}
- if (($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCustomSetter"}) && $attribute->type !~ /^readonly/) {
+ if (($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCustomSetter"}) && !IsReadonly($attribute)) {
push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue);\n");
push(@headerContent, "#endif\n") if $conditionalString;
@@ -1144,7 +1150,7 @@
push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
my $getter = GetAttributeGetterName($interfaceName, $className, $attribute);
push(@headerContent, "JSC::JSValue ${getter}(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);\n");
- unless ($attribute->type =~ /readonly/) {
+ if (!IsReadonly($attribute)) {
my $setter = GetAttributeSetterName($interfaceName, $className, $attribute);
push(@headerContent, "void ${setter}(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);\n");
}
@@ -1218,14 +1224,14 @@
my @specials = ();
push(@specials, "DontDelete") unless $attribute->signature->extendedAttributes->{"Deletable"};
push(@specials, "DontEnum") if $attribute->signature->extendedAttributes->{"NotEnumerable"};
- push(@specials, "ReadOnly") if $attribute->type =~ /readonly/;
+ push(@specials, "ReadOnly") if IsReadonly($attribute);
my $special = (@specials > 0) ? join(" | ", @specials) : "0";
push(@hashSpecials, $special);
my $getter = GetAttributeGetterName($interfaceName, $className, $attribute);
push(@hashValue1, $getter);
- if ($attribute->type =~ /readonly/) {
+ if (IsReadonly($attribute)) {
push(@hashValue2, "0");
} else {
my $setter = GetAttributeSetterName($interfaceName, $className, $attribute);
@@ -1462,14 +1468,14 @@
my @specials = ();
push(@specials, "DontDelete") unless $attribute->signature->extendedAttributes->{"Deletable"};
- push(@specials, "ReadOnly") if $attribute->type =~ /readonly/;
+ push(@specials, "ReadOnly") if IsReadonly($attribute);
my $special = (@specials > 0) ? join(" | ", @specials) : "0";
push(@hashSpecials, $special);
my $getter = GetAttributeGetterName($interfaceName, $className, $attribute);
push(@hashValue1, $getter);
- if ($attribute->type =~ /readonly/) {
+ if (IsReadonly($attribute)) {
push(@hashValue2, "0");
} else {
my $setter = GetAttributeSetterName($interfaceName, $className, $attribute);
@@ -1974,7 +1980,7 @@
# Check if we have any writable attributes
my $hasReadWriteProperties = 0;
foreach my $attribute (@{$dataNode->attributes}) {
- $hasReadWriteProperties = 1 if $attribute->type !~ /^readonly/ && !$attribute->isStatic;
+ $hasReadWriteProperties = 1 if !IsReadonly($attribute) && !$attribute->isStatic;
}
my $hasSetter = $hasReadWriteProperties
@@ -2033,7 +2039,7 @@
if ($hasReadWriteProperties) {
foreach my $attribute (@{$dataNode->attributes}) {
- if ($attribute->type !~ /^readonly/) {
+ if (!IsReadonly($attribute)) {
my $name = $attribute->signature->name;
my $type = $codeGenerator->StripModule($attribute->signature->type);
my $putFunctionName = GetAttributeSetterName($interfaceName, $className, $attribute);
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (132666 => 132667)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm 2012-10-26 16:09:57 UTC (rev 132667)
@@ -758,6 +758,13 @@
return $dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"Constructor"} || $dataNode->extendedAttributes->{"ConstructorTemplate"};
}
+sub IsReadonly
+{
+ my $attribute = shift;
+ my $attrExt = $attribute->signature->extendedAttributes;
+ return ($attribute->type =~ /readonly/ || $attrExt->{"V8ReadOnly"}) && !$attrExt->{"Replaceable"};
+}
+
sub GenerateDomainSafeFunctionGetter
{
my $function = shift;
@@ -1011,10 +1018,10 @@
# Special case for readonly or Replaceable attributes (with a few exceptions). This attempts to ensure that JS wrappers don't get
# garbage-collected prematurely when their lifetime is strongly tied to their owner. We accomplish this by inserting a reference to
# the newly created wrapper into an internal field of the holder object.
- if (!IsNodeSubType($dataNode) && $attrName ne "self" && (IsWrapperType($returnType) && ($attribute->type =~ /^readonly/ || $attribute->signature->extendedAttributes->{"Replaceable"} || $attrName eq "location")
+ if (!IsNodeSubType($dataNode) && $attrName ne "self" && IsWrapperType($returnType) && (IsReadonly($attribute) || $attribute->signature->extendedAttributes->{"Replaceable"} || $attrName eq "location")
&& $returnType ne "EventTarget" && $returnType ne "SerializedScriptValue" && $returnType ne "DOMWindow"
&& $returnType ne "MessagePortArray"
- && $returnType !~ /SVG/ && $returnType !~ /HTML/ && !IsDOMNodeType($returnType))) {
+ && $returnType !~ /SVG/ && $returnType !~ /HTML/ && !IsDOMNodeType($returnType)) {
my $arrayType = $codeGenerator->GetArrayType($returnType);
if ($arrayType) {
@@ -2196,7 +2203,7 @@
$accessControl = "v8::ALL_CAN_WRITE";
} elsif ($attrExt->{"DoNotCheckSecurity"}) {
$accessControl = "v8::ALL_CAN_READ";
- if (!($attribute->type =~ /^readonly/) && !($attrExt->{"V8ReadOnly"})) {
+ if (!IsReadonly($attribute)) {
$accessControl .= " | v8::ALL_CAN_WRITE";
}
}
@@ -2273,7 +2280,7 @@
}
# Read only attributes
- if ($attribute->type =~ /^readonly/ || $attrExt->{"V8ReadOnly"}) {
+ if (IsReadonly($attribute)) {
$setter = "0";
}
@@ -2652,8 +2659,7 @@
$hasReplaceable = 1;
} elsif (!$attribute->signature->extendedAttributes->{"CustomSetter"} &&
!$attribute->signature->extendedAttributes->{"V8CustomSetter"} &&
- $attribute->type !~ /^readonly/ &&
- !$attribute->signature->extendedAttributes->{"V8ReadOnly"}) {
+ !IsReadonly($attribute)) {
GenerateNormalAttrSetter($attribute, $dataNode, $implClassName, $interfaceName);
}
}
Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (132666 => 132667)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp 2012-10-26 16:09:57 UTC (rev 132667)
@@ -912,11 +912,11 @@
PROP_REPLACEABLE_ATTRIBUTE,
g_param_spec_long("replaceable-attribute", /* name */
"test_obj_replaceable-attribute", /* short description */
- "read-write glong TestObj.replaceable-attribute", /* longer - could do with some extra doc stuff here */
+ "read-only glong TestObj.replaceable-attribute", /* longer - could do with some extra doc stuff here */
G_MINLONG, /* min */
G_MAXLONG, /* max */
0, /* default */
- WEBKIT_PARAM_READWRITE));
+ WEBKIT_PARAM_READABLE));
}
Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (132666 => 132667)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h 2012-10-26 16:09:57 UTC (rev 132667)
@@ -115,7 +115,7 @@
@property(readonly) int descriptionName;
@property int idName;
@property(readonly, copy) NSString *hashName;
-@property int replaceableAttribute;
+@property(readonly) int replaceableAttribute;
- (void)voidMethod;
- (void)voidMethodWithArgs:(int)longArg strArg:(NSString *)strArg objArg:(DOMTestObj *)objArg;
Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (132666 => 132667)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm 2012-10-26 16:09:57 UTC (rev 132667)
@@ -718,12 +718,6 @@
return IMPL->replaceableAttribute();
}
-- (void)setReplaceableAttribute:(int)newReplaceableAttribute
-{
- WebCore::JSMainThreadNullState state;
- IMPL->setReplaceableAttribute(newReplaceableAttribute);
-}
-
- (void)voidMethod
{
WebCore::JSMainThreadNullState state;
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (132666 => 132667)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2012-10-26 16:09:57 UTC (rev 132667)
@@ -261,7 +261,7 @@
const unsigned short CONST_VALUE_14 = 0x1abc;
[Reflect=CONST_IMPL] const unsigned short CONST_JAVASCRIPT = 15;
- [Replaceable] attribute long replaceableAttribute;
+ [Replaceable] readonly attribute long replaceableAttribute;
void variadicStringMethod(in DOMString head, in DOMString... tail);
void variadicDoubleMethod(in double head, in double... tail);
Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (132666 => 132667)
--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp 2012-10-26 16:09:57 UTC (rev 132667)
@@ -2073,7 +2073,7 @@
{"id", TestObjV8Internal::idAttrGetter, TestObjV8Internal::idAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'hash' (Type: 'readonly attribute' ExtAttr: '')
{"hash", TestObjV8Internal::hashAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
- // Attribute 'replaceableAttribute' (Type: 'attribute' ExtAttr: 'Replaceable')
+ // Attribute 'replaceableAttribute' (Type: 'readonly attribute' ExtAttr: 'Replaceable')
{"replaceableAttribute", TestObjV8Internal::replaceableAttributeAttrGetter, TestObjV8Internal::TestObjReplaceableAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
};
Modified: trunk/Source/WebCore/page/DOMWindow.idl (132666 => 132667)
--- trunk/Source/WebCore/page/DOMWindow.idl 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/page/DOMWindow.idl 2012-10-26 16:09:57 UTC (rev 132667)
@@ -42,21 +42,21 @@
InterfaceName=Window
] interface DOMWindow {
// DOM Level 0
- attribute [Replaceable] Screen screen;
- attribute [Replaceable, DoNotCheckSecurityOnGetter] History history;
- attribute [Replaceable] BarInfo locationbar;
- attribute [Replaceable] BarInfo menubar;
- attribute [Replaceable] BarInfo personalbar;
- attribute [Replaceable] BarInfo scrollbars;
- attribute [Replaceable] BarInfo statusbar;
- attribute [Replaceable] BarInfo toolbar;
- attribute [Replaceable] Navigator navigator;
- attribute [Replaceable] Navigator clientInformation;
+ [Replaceable] readonly attribute Screen screen;
+ [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute History history;
+ [Replaceable] readonly attribute BarInfo locationbar;
+ [Replaceable] readonly attribute BarInfo menubar;
+ [Replaceable] readonly attribute BarInfo personalbar;
+ [Replaceable] readonly attribute BarInfo scrollbars;
+ [Replaceable] readonly attribute BarInfo statusbar;
+ [Replaceable] readonly attribute BarInfo toolbar;
+ [Replaceable] readonly attribute Navigator navigator;
+ [Replaceable] readonly attribute Navigator clientInformation;
readonly attribute Crypto crypto;
#if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP
attribute [DoNotCheckSecurity, CustomSetter, V8Unforgeable] Location location;
#endif
- attribute [Replaceable, CustomGetter, V8CustomSetter] Event event;
+ [Replaceable, CustomGetter, V8CustomSetter] readonly attribute Event event;
DOMSelection getSelection();
@@ -90,18 +90,18 @@
in [Optional=DefaultIsUndefined] boolean searchInFrames,
in [Optional=DefaultIsUndefined] boolean showDialog);
- attribute [Replaceable] boolean offscreenBuffering;
+ [Replaceable] readonly attribute boolean offscreenBuffering;
- attribute [Replaceable] long outerHeight;
- attribute [Replaceable] long outerWidth;
- attribute [Replaceable] long innerHeight;
- attribute [Replaceable] long innerWidth;
- attribute [Replaceable] long screenX;
- attribute [Replaceable] long screenY;
- attribute [Replaceable] long screenLeft;
- attribute [Replaceable] long screenTop;
- attribute [Replaceable] long scrollX;
- attribute [Replaceable] long scrollY;
+ [Replaceable] readonly attribute long outerHeight;
+ [Replaceable] readonly attribute long outerWidth;
+ [Replaceable] readonly attribute long innerHeight;
+ [Replaceable] readonly attribute long innerWidth;
+ [Replaceable] readonly attribute long screenX;
+ [Replaceable] readonly attribute long screenY;
+ [Replaceable] readonly attribute long screenLeft;
+ [Replaceable] readonly attribute long screenTop;
+ [Replaceable] readonly attribute long scrollX;
+ [Replaceable] readonly attribute long scrollY;
readonly attribute long pageXOffset;
readonly attribute long pageYOffset;
@@ -115,7 +115,7 @@
readonly attribute [DoNotCheckSecurity] boolean closed;
- attribute [Replaceable, DoNotCheckSecurityOnGetter] unsigned long length;
+ [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute unsigned long length;
attribute DOMString name;
@@ -127,13 +127,13 @@
#endif
// Self referential attributes
- attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow self;
- readonly attribute [DoNotCheckSecurity, V8Unforgeable] DOMWindow window;
- attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow frames;
+ [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute DOMWindow self;
+ [DoNotCheckSecurity, V8Unforgeable] readonly attribute DOMWindow window;
+ [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute DOMWindow frames;
- attribute [Replaceable, DoNotCheckSecurityOnGetter, V8CustomSetter] DOMWindow opener;
- attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow parent;
- readonly attribute [DoNotCheckSecurityOnGetter, V8Unforgeable] DOMWindow top;
+ [Replaceable, DoNotCheckSecurityOnGetter, V8CustomSetter] readonly attribute DOMWindow opener;
+ [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute DOMWindow parent;
+ [DoNotCheckSecurityOnGetter, V8Unforgeable] readonly attribute DOMWindow top;
// DOM Level 2 AbstractView Interface
readonly attribute Document document;
@@ -154,7 +154,7 @@
in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString pseudoElement);
#endif
- attribute [Replaceable] double devicePixelRatio;
+ [Replaceable] readonly attribute double devicePixelRatio;
WebKitPoint webkitConvertPointFromPageToNode(in [Optional=DefaultIsUndefined] Node node,
in [Optional=DefaultIsUndefined] WebKitPoint p);
@@ -175,7 +175,7 @@
readonly attribute long orientation;
#endif
- attribute [Replaceable] Console console;
+ [Replaceable] readonly attribute Console console;
// cross-document messaging
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
@@ -198,7 +198,7 @@
#endif
#if defined(ENABLE_WEB_TIMING) && ENABLE_WEB_TIMING
- attribute [Replaceable] Performance performance;
+ [Replaceable] readonly attribute Performance performance;
#endif
// Timers
Modified: trunk/Source/WebCore/workers/WorkerContext.idl (132666 => 132667)
--- trunk/Source/WebCore/workers/WorkerContext.idl 2012-10-26 15:58:42 UTC (rev 132666)
+++ trunk/Source/WebCore/workers/WorkerContext.idl 2012-10-26 16:09:57 UTC (rev 132667)
@@ -39,15 +39,15 @@
// WorkerGlobalScope
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
- attribute [Replaceable] WorkerContext self;
+ [Replaceable] readonly attribute WorkerContext self;
#endif
- attribute [Replaceable] WorkerLocation location;
+ [Replaceable] readonly attribute WorkerLocation location;
void close();
attribute EventListener onerror;
// WorkerUtils
[Custom] void importScripts(/*[Variadic] in DOMString urls */);
- [Replaceable] attribute WorkerNavigator navigator;
+ [Replaceable] readonly attribute WorkerNavigator navigator;
// Timers
[Custom] long setTimeout(in TimeoutHandler handler, in long timeout);