Changeset 201702 in webkit
- Timestamp:
- Jun 5, 2016 5:59:33 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201701 r201702 1 2016-06-05 Gavin & Ellie Barraclough <barraclough@apple.com> 2 3 Deprecate remaining uses of Lookup getStatic*, use HasStaticPropertyTable instead. 4 https://bugs.webkit.org/show_bug.cgi?id=158178 5 6 Reviewed by Darin Adler. 7 8 As of bug #158059 most JSC static table property access no longer requires getOwnPropertySlot to be 9 overridden. Port remaining calls to the getStatic* functions in Lookup.h over to the new mechanism. 10 11 Switch JSGlobalObject & WebCore DOM instance bindings to use HasStaticPropertyTable. 12 13 * fast/dom/unforgeable-attributes-expected.txt: 14 - Progression, similar to the getOwnPropertyDescriptor test below. Previously we 15 were reporting an error with a message appropriate to a disallowed value->value 16 redefinition. This is actually a disallowed accessor->value reconfiguration, now 17 reporting the correct error message for this. 18 * http/tests/security/cross-origin-window-property-access-expected.txt: 19 - Newly reporting previously missing CORS error. 20 * js/dom/getOwnPropertyDescriptor-expected.txt: 21 * js/resources/getOwnPropertyDescriptor.js: 22 - This test was previously incorrect - was expecting window.window property to 23 reflect as a value decriptor. This now reflect as an accesor descriptor. New 24 behaviour is correct per spec & matches Firefox. 25 1 26 2016-06-05 Antti Koivisto <antti@apple.com> 2 27 -
trunk/LayoutTests/fast/dom/unforgeable-attributes-expected.txt
r196520 r201702 19 19 PASS testObject.hasOwnProperty(testPropertyName) is true 20 20 PASS testObject.__proto__.hasOwnProperty(testPropertyName) is false 21 PASS Object.defineProperty(testObject, testPropertyName, { value: 'test' }) threw exception TypeError: Attempting to change value of a readonlyproperty..21 PASS Object.defineProperty(testObject, testPropertyName, { value: 'test' }) threw exception TypeError: Attempting to change access mechanism for an unconfigurable property.. 22 22 PASS Object.getOwnPropertyDescriptor(testObject, testPropertyName).configurable is false 23 23 … … 25 25 PASS testObject.hasOwnProperty(testPropertyName) is true 26 26 PASS testObject.__proto__.hasOwnProperty(testPropertyName) is false 27 PASS Object.defineProperty(testObject, testPropertyName, { value: 'test' }) threw exception TypeError: Attempting to change value of a readonlyproperty..27 PASS Object.defineProperty(testObject, testPropertyName, { value: 'test' }) threw exception TypeError: Attempting to change access mechanism for an unconfigurable property.. 28 28 PASS Object.getOwnPropertyDescriptor(testObject, testPropertyName).configurable is false 29 29 -
trunk/LayoutTests/http/tests/security/cross-origin-window-property-access-expected.txt
r196690 r201702 1 CONSOLE MESSAGE: line 1: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match. 1 2 CONSOLE MESSAGE: line 1: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match. 2 3 CONSOLE MESSAGE: line 1: Blocked a frame with origin "http://127.0.0.1:8000" from accessing a frame with origin "http://localhost:8000". Protocols, domains, and ports must match. … … 11 12 12 13 13 PASS Object.getOwnPropertyDescriptor(window, "document").get.call(crossOriginWindow) threw exception TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(window, "document").get.call').14 PASS Object.getOwnPropertyDescriptor(window, "document").get.call(crossOriginWindow) returned undefined. 14 15 PASS Object.getOwnPropertyDescriptor(window, "name").get.call(crossOriginWindow) returned undefined. 15 16 PASS Object.getOwnPropertyDescriptor(window, "menubar").get.call(crossOriginWindow) returned undefined. -
trunk/LayoutTests/js/dom/getOwnPropertyDescriptor-expected.txt
r197205 r201702 115 115 PASS Object.getOwnPropertyDescriptor(global, 'Infinity').enumerable is false 116 116 PASS Object.getOwnPropertyDescriptor(global, 'Infinity').configurable is false 117 PASS Object.getOwnPropertyDescriptor(global, 'window').value is global 118 PASS Object.getOwnPropertyDescriptor(global, 'window').hasOwnProperty('get') is false 119 PASS Object.getOwnPropertyDescriptor(global, 'window').hasOwnProperty('set') is false 117 PASS Object.getOwnPropertyDescriptor(global, 'window').get is globalWindowGetter 118 PASS Object.getOwnPropertyDescriptor(global, 'window').set is undefined 119 PASS Object.getOwnPropertyDescriptor(global, 'window').hasOwnProperty('value') is false 120 PASS Object.getOwnPropertyDescriptor(global, 'window').hasOwnProperty('writable') is false 120 121 PASS Object.getOwnPropertyDescriptor(global, 'window').enumerable is true 121 122 PASS Object.getOwnPropertyDescriptor(global, 'window').configurable is false -
trunk/LayoutTests/js/resources/getOwnPropertyDescriptor.js
r197205 r201702 42 42 descriptorShouldBe("global", "'NaN'", {writable: false, enumerable: false, configurable: false, value:"NaN"}); 43 43 descriptorShouldBe("global", "'Infinity'", {writable: false, enumerable: false, configurable: false, value:"Infinity"}); 44 descriptorShouldBe("global", "'window'", {writable: false, enumerable: true, configurable: false, value:"global"}); 44 var globalWindowGetter = Object.getOwnPropertyDescriptor(global, 'window').get; 45 descriptorShouldBe("global", "'window'", {get: 'globalWindowGetter', set: undefined, enumerable: true, configurable: false}); 45 46 descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: false, configurable: true, value:"XMLHttpRequest"}); 46 47 descriptorShouldBe("global", "0", {writable: true, enumerable: false, configurable: false, value:"global[0]"}); -
trunk/Source/JavaScriptCore/ChangeLog
r201678 r201702 1 2016-06-03 Gavin & Ellie Barraclough <barraclough@apple.com> 2 3 Deprecate remaining uses of Lookup getStatic*, use HasStaticPropertyTable instead. 4 https://bugs.webkit.org/show_bug.cgi?id=158178 5 6 Reviewed by Darin Adler. 7 8 As of bug #158059 most JSC static table property access no longer requires getOwnPropertySlot to be 9 overridden. Port remaining calls to the getStatic* functions in Lookup.h over to the new mechanism. 10 11 Part 1: Switch JSGlobalObject & JSDOMWindow to use HasStaticPropertyTable. 12 13 * runtime/JSGlobalObject.cpp: 14 (JSC::JSGlobalObject::getOwnPropertySlot): 15 - Override is still required for symbol table, 16 but regular property access is now via Base::getOwnPropertySlot. 17 * runtime/JSGlobalObject.h: 18 - add HasStaticPropertyTable to structureFlags. 19 1 20 2016-06-03 Benjamin Poulain <bpoulain@apple.com> 2 21 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r201654 r201702 1179 1179 bool JSGlobalObject::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot) 1180 1180 { 1181 JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); 1182 if (getStaticPropertySlot<JSGlobalObject, Base>(exec, globalObjectTable, thisObject, propertyName, slot)) 1181 if (Base::getOwnPropertySlot(object, exec, propertyName, slot)) 1183 1182 return true; 1184 return symbolTableGet( thisObject, propertyName, slot);1183 return symbolTableGet(jsCast<JSGlobalObject*>(object), propertyName, slot); 1185 1184 } 1186 1185 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r201619 r201702 388 388 public: 389 389 typedef JSSegmentedVariableObject Base; 390 static const unsigned StructureFlags = Base::StructureFlags | OverridesGetOwnPropertySlot | OverridesGetPropertyNames | OverridesToThis;390 static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable | OverridesGetOwnPropertySlot | OverridesGetPropertyNames | OverridesToThis; 391 391 392 392 static JSGlobalObject* create(VM& vm, Structure* structure) -
trunk/Source/WebCore/ChangeLog
r201701 r201702 1 2016-06-03 Gavin & Ellie Barraclough <barraclough@apple.com> 2 3 Deprecate remaining uses of Lookup getStatic*, use HasStaticPropertyTable instead. 4 https://bugs.webkit.org/show_bug.cgi?id=158178 5 6 Reviewed by Darin Adler. 7 8 As of bug #158059 most JSC static table property access no longer requires getOwnPropertySlot to be 9 overridden. Port remaining calls to the getStatic* functions in Lookup.h over to the new mechanism. 10 11 Part 1: Switch JSGlobalObject & JSDOMWindow to use HasStaticPropertyTable. 12 13 * bindings/js/JSDOMWindowCustom.cpp: 14 (WebCore::JSDOMWindow::getOwnPropertySlot): 15 - getStaticPropertySlot -> Base::getOwnPropertySlot. 16 * bindings/js/JSPluginElementFunctions.h: 17 (WebCore::pluginElementCustomGetOwnPropertySlot): 18 - Switch call from getStaticValueSlot to Type::getOwnPropertySlot. 19 For any element where Type::hasStaticPropertyTable is true the HasStaticPropertyTable 20 structure flag will also be set, so Type::getOwnPropertySlot will do the same thing. 21 * bindings/scripts/CodeGeneratorJS.pm: 22 (PrototypeHasStaticPropertyTable): 23 - Was PrototypeOverridesGetOwnPropertySlot; prototypes now never need override getOwnPropertySlot so renaming accordingly. 24 (GenerateImplementation): 25 - Removed generation of getOwnPropertySlot body for DOMGlobalObjects. 26 (GeneratePrototypeDeclaration): 27 - For DOMGlobalObjects, set HasStaticPropertyTable instead of OverridesGetOwnPropertySlot & removed getOwnPropertySlot declaration. 28 (PrototypeOverridesGetOwnPropertySlot): Deleted. 29 Renamed to PrototypeHasStaticPropertyTable. 30 * bindings/scripts/test/JS/JSTestGlobalObject.cpp: 31 * bindings/scripts/test/JS/JSTestGlobalObject.h: 32 - Updating bindings test results. 33 1 34 2016-06-05 Antti Koivisto <antti@apple.com> 2 35 -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
r201638 r201702 237 237 // (2) Regular own properties. 238 238 PropertySlot slotCopy = slot; 239 if ( getStaticPropertySlot<JSDOMWindow, Base>(exec, *JSDOMWindow::info()->staticPropHashTable, thisObject, propertyName, slot)) {239 if (Base::getOwnPropertySlot(thisObject, exec, propertyName, slot)) { 240 240 // Detect when we're getting the property 'showModalDialog', this is disabled, and has its original value. 241 241 bool isShowModalDialogAndShouldHide = propertyName == exec->propertyNames().showModalDialog -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r201681 r201702 703 703 } 704 704 705 sub Prototype OverridesGetOwnPropertySlot705 sub PrototypeHasStaticPropertyTable 706 706 { 707 707 my $interface = shift; … … 2268 2268 } 2269 2269 2270 if (PrototypeOverridesGetOwnPropertySlot($interface)) { 2271 my $prototypePropertyCount = PrototypePropertyCount($interface); 2272 my $prototypeFunctionCount = PrototypeFunctionCount($interface); 2273 my $prototypeAttributeCount = $prototypePropertyCount - $prototypeFunctionCount; 2274 if (IsDOMGlobalObject($interface)) { 2275 push(@implContent, "bool ${className}Prototype::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)\n"); 2276 push(@implContent, "{\n"); 2277 push(@implContent, " VM& vm = state->vm();\n"); 2278 push(@implContent, " UNUSED_PARAM(vm);\n"); 2279 push(@implContent, " auto* thisObject = jsCast<${className}Prototype*>(object);\n"); 2280 2281 if ($numConstants eq 0 && $prototypePropertyCount eq 0) { 2282 push(@implContent, " return Base::getOwnPropertySlot(thisObject, state, propertyName, slot);\n"); 2283 } elsif ($numConstants eq 0 && $prototypeAttributeCount eq 0) { 2284 push(@implContent, " return getStaticFunctionSlot<JSObject>(state, ${className}PrototypeTable, thisObject, propertyName, slot);\n"); 2285 } elsif ($prototypePropertyCount eq 0) { 2286 push(@implContent, " return getStaticValueSlot<${className}Prototype, JSObject>(state, ${className}PrototypeTable, thisObject, propertyName, slot);\n"); 2287 } else { 2288 push(@implContent, " return getStaticPropertySlot<${className}Prototype, JSObject>(state, ${className}PrototypeTable, thisObject, propertyName, slot);\n"); 2289 } 2290 push(@implContent, "}\n\n"); 2291 } elsif ($numConstants > 0 || $numPrototypeProperties > 0) { 2292 push(@implContent, "void ${className}Prototype::finishCreation(VM& vm)\n"); 2293 push(@implContent, "{\n"); 2294 push(@implContent, " Base::finishCreation(vm);\n"); 2295 push(@implContent, " reifyStaticProperties(vm, ${className}PrototypeTableValues, *this);\n"); 2296 2297 my @runtimeEnabledProperties = @runtimeEnabledFunctions; 2298 push(@runtimeEnabledProperties, @runtimeEnabledAttributes); 2299 foreach my $functionOrAttribute (@runtimeEnabledProperties) { 2300 my $signature = $functionOrAttribute->signature; 2301 my $conditionalString = $codeGenerator->GenerateConditionalString($signature); 2302 push(@implContent, "#if ${conditionalString}\n") if $conditionalString; 2303 AddToImplIncludes("RuntimeEnabledFeatures.h"); 2304 my $enable_function = GetRuntimeEnableFunctionName($signature); 2305 my $name = $signature->name; 2306 push(@implContent, " if (!${enable_function}()) {\n"); 2307 push(@implContent, " Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(\"$name\"), strlen(\"$name\"));\n"); 2308 push(@implContent, " removeDirect(vm, propertyName);\n"); 2309 push(@implContent, " }\n"); 2310 push(@implContent, "#endif\n") if $conditionalString; 2311 } 2312 2313 my $firstPrivateFunction = 1; 2314 foreach my $function (@{$interface->functions}) { 2315 next unless ($function->signature->extendedAttributes->{"Private"}); 2316 AddToImplIncludes("WebCoreJSClientData.h"); 2317 push(@implContent, " JSVMClientData& clientData = *static_cast<JSVMClientData*>(vm.clientData);\n") if $firstPrivateFunction; 2318 $firstPrivateFunction = 0; 2319 push(@implContent, " putDirect(vm, clientData.builtinNames()." . $function->signature->name . "PrivateName(), JSFunction::create(vm, globalObject(), 0, String(), " . GetFunctionName($interface, $className, $function) . "), ReadOnly | DontEnum);\n"); 2320 } 2321 2322 if ($interface->iterable) { 2323 my $functionName = GetFunctionName($interface, $className, @{$interface->iterable->functions}[0]); 2324 push(@implContent, " putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\"[Symbol.Iterator]\"), $functionName), ReadOnly | DontEnum);\n"); 2325 } 2326 2327 push(@implContent, "}\n\n"); 2328 } else { 2329 push(@implContent, "void ${className}Prototype::finishCreation(VM& vm)\n"); 2330 push(@implContent, "{\n"); 2331 push(@implContent, " Base::finishCreation(vm);\n"); 2332 push(@implContent, "}\n\n"); 2333 } 2270 if (PrototypeHasStaticPropertyTable($interface) && !IsDOMGlobalObject($interface)) { 2271 push(@implContent, "void ${className}Prototype::finishCreation(VM& vm)\n"); 2272 push(@implContent, "{\n"); 2273 push(@implContent, " Base::finishCreation(vm);\n"); 2274 push(@implContent, " reifyStaticProperties(vm, ${className}PrototypeTableValues, *this);\n"); 2275 2276 my @runtimeEnabledProperties = @runtimeEnabledFunctions; 2277 push(@runtimeEnabledProperties, @runtimeEnabledAttributes); 2278 foreach my $functionOrAttribute (@runtimeEnabledProperties) { 2279 my $signature = $functionOrAttribute->signature; 2280 my $conditionalString = $codeGenerator->GenerateConditionalString($signature); 2281 push(@implContent, "#if ${conditionalString}\n") if $conditionalString; 2282 AddToImplIncludes("RuntimeEnabledFeatures.h"); 2283 my $enable_function = GetRuntimeEnableFunctionName($signature); 2284 my $name = $signature->name; 2285 push(@implContent, " if (!${enable_function}()) {\n"); 2286 push(@implContent, " Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(\"$name\"), strlen(\"$name\"));\n"); 2287 push(@implContent, " removeDirect(vm, propertyName);\n"); 2288 push(@implContent, " }\n"); 2289 push(@implContent, "#endif\n") if $conditionalString; 2290 } 2291 2292 my $firstPrivateFunction = 1; 2293 foreach my $function (@{$interface->functions}) { 2294 next unless ($function->signature->extendedAttributes->{"Private"}); 2295 AddToImplIncludes("WebCoreJSClientData.h"); 2296 push(@implContent, " JSVMClientData& clientData = *static_cast<JSVMClientData*>(vm.clientData);\n") if $firstPrivateFunction; 2297 $firstPrivateFunction = 0; 2298 push(@implContent, " putDirect(vm, clientData.builtinNames()." . $function->signature->name . "PrivateName(), JSFunction::create(vm, globalObject(), 0, String(), " . GetFunctionName($interface, $className, $function) . "), ReadOnly | DontEnum);\n"); 2299 } 2300 2301 if ($interface->iterable) { 2302 my $functionName = GetFunctionName($interface, $className, @{$interface->iterable->functions}[0]); 2303 push(@implContent, " putDirect(vm, vm.propertyNames->iteratorSymbol, JSFunction::create(vm, globalObject(), 0, ASCIILiteral(\"[Symbol.Iterator]\"), $functionName), ReadOnly | DontEnum);\n"); 2304 } 2305 2306 push(@implContent, "}\n\n"); 2334 2307 } 2335 2308 … … 4840 4813 push(@$outputArray, " }\n"); 4841 4814 4842 if (PrototypeOverridesGetOwnPropertySlot($interface)) { 4843 push(@$outputArray, "\n"); 4815 if (PrototypeHasStaticPropertyTable($interface)) { 4844 4816 if (IsDOMGlobalObject($interface)) { 4845 push(@$outputArray, " static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);\n"); 4846 $structureFlags{"JSC::OverridesGetOwnPropertySlot"} = 1; 4817 $structureFlags{"JSC::HasStaticPropertyTable"} = 1; 4847 4818 } else { 4819 push(@$outputArray, "\n"); 4848 4820 push(@$outputArray, " void finishCreation(JSC::VM&);\n"); 4849 4821 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp
r201387 r201702 109 109 const ClassInfo JSTestGlobalObjectPrototype::s_info = { "TestGlobalObjectPrototype", &Base::s_info, &JSTestGlobalObjectPrototypeTable, CREATE_METHOD_TABLE(JSTestGlobalObjectPrototype) }; 110 110 111 bool JSTestGlobalObjectPrototype::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)112 {113 VM& vm = state->vm();114 UNUSED_PARAM(vm);115 auto* thisObject = jsCast<JSTestGlobalObjectPrototype*>(object);116 return getStaticPropertySlot<JSTestGlobalObjectPrototype, JSObject>(state, JSTestGlobalObjectPrototypeTable, thisObject, propertyName, slot);117 }118 119 111 const ClassInfo JSTestGlobalObject::s_info = { "TestGlobalObject", &Base::s_info, &JSTestGlobalObjectTable, CREATE_METHOD_TABLE(JSTestGlobalObject) }; 120 112 -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.h
r200934 r201702 112 112 { 113 113 } 114 115 static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);116 114 public: 117 static const unsigned StructureFlags = JSC:: OverridesGetOwnPropertySlot| Base::StructureFlags;115 static const unsigned StructureFlags = JSC::HasStaticPropertyTable | Base::StructureFlags; 118 116 }; 119 117
Note: See TracChangeset
for help on using the changeset viewer.