Changeset 150276 in webkit
- Timestamp:
- May 17, 2013 11:16:41 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150268 r150276 1 2013-05-17 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 3 Add [EnabledAtRuntime] extended attribute support for global constructors 4 https://bugs.webkit.org/show_bug.cgi?id=116147 5 6 Reviewed by Geoffrey Garen. 7 8 Add [EnabledAtRuntime] extended attribute support for global constructors. 9 This patch adds [EnabledAtRuntime] extended attribute to SharedWorker and 10 WebSocket IDL interfaces so that their global constructors on the global 11 Window object can now be automatically generated. 12 13 The behavior on JavaScript side is unchanged. We simply leverage 14 RuntimeEnabledFeatures class and the new [EnabledAtRuntime] IDL extended 15 attribute to generate the code for global constructors getters instead 16 of using custom code. 17 18 No new tests, no behavior change for layout tests. 19 20 * GNUmakefile.list.am: 21 * Modules/websockets/WebSocket.cpp: Enable WebSockets at runtime by default. 22 * Modules/websockets/WebSocket.idl: 23 * Target.pri: 24 * UseJSC.cmake: 25 * WebCore.vcproj/WebCore.vcproj: 26 * WebCore.vcxproj/WebCore.vcxproj: 27 * WebCore.vcxproj/WebCore.vcxproj.filters: 28 * WebCore.xcodeproj/project.pbxproj: 29 * bindings/js/JSBindingsAllInOne.cpp: 30 * bindings/js/JSDOMWindowCustom.cpp: 31 (WebCore): 32 * bindings/js/JSDOMWindowWebSocketCustom.cpp: Removed. 33 * bindings/scripts/CodeGeneratorJS.pm: 34 (ToMethodName): 35 (GetRuntimeEnableFunctionName): 36 (GenerateImplementation): 37 * bindings/scripts/IDLAttributes.txt: 38 * page/DOMWindow.idl: 39 * workers/SharedWorker.idl: 40 1 41 2013-05-17 Darin Adler <darin@apple.com> 2 42 -
trunk/Source/WebCore/GNUmakefile.list.am
r150216 r150276 2395 2395 Source/WebCore/bindings/js/JSDOMWindowShell.h \ 2396 2396 Source/WebCore/bindings/js/JSDOMWindowWebAudioCustom.cpp \ 2397 Source/WebCore/bindings/js/JSDOMWindowWebSocketCustom.cpp \2398 2397 Source/WebCore/bindings/js/JSDOMWrapper.cpp \ 2399 2398 Source/WebCore/bindings/js/JSDOMWrapper.h \ -
trunk/Source/WebCore/Modules/websockets/WebSocket.cpp
r148968 r150276 127 127 } 128 128 129 static bool webSocketsAvailable = false;129 static bool webSocketsAvailable = true; 130 130 131 131 void WebSocket::setIsAvailable(bool available) -
trunk/Source/WebCore/Modules/websockets/WebSocket.idl
r149796 r150276 31 31 32 32 [ 33 NoInterfaceObject,33 EnabledAtRuntime, 34 34 Conditional=WEB_SOCKETS, 35 35 ActiveDOMObject, -
trunk/Source/WebCore/Target.pri
r150240 r150276 115 115 bindings/js/JSDOMWindowShell.cpp \ 116 116 bindings/js/JSDOMWindowWebAudioCustom.cpp \ 117 bindings/js/JSDOMWindowWebSocketCustom.cpp \118 117 bindings/js/JSDOMWrapper.cpp \ 119 118 bindings/js/JSDataViewCustom.cpp \ -
trunk/Source/WebCore/UseJSC.cmake
r149796 r150276 67 67 bindings/js/JSDOMWindowShell.cpp 68 68 bindings/js/JSDOMWindowWebAudioCustom.cpp 69 bindings/js/JSDOMWindowWebSocketCustom.cpp70 69 bindings/js/JSDOMWrapper.cpp 71 70 bindings/js/JSDeviceMotionEventCustom.cpp -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r150216 r150276 68295 68295 </File> 68296 68296 <File 68297 RelativePath="..\bindings\js\JSDOMWindowWebSocketCustom.cpp"68298 >68299 <FileConfiguration68300 Name="Debug|Win32"68301 ExcludedFromBuild="true"68302 >68303 <Tool68304 Name="VCCLCompilerTool"68305 />68306 </FileConfiguration>68307 <FileConfiguration68308 Name="Release|Win32"68309 ExcludedFromBuild="true"68310 >68311 <Tool68312 Name="VCCLCompilerTool"68313 />68314 </FileConfiguration>68315 <FileConfiguration68316 Name="Debug_Cairo_CFLite|Win32"68317 ExcludedFromBuild="true"68318 >68319 <Tool68320 Name="VCCLCompilerTool"68321 />68322 </FileConfiguration>68323 <FileConfiguration68324 Name="Release_Cairo_CFLite|Win32"68325 ExcludedFromBuild="true"68326 >68327 <Tool68328 Name="VCCLCompilerTool"68329 />68330 </FileConfiguration>68331 <FileConfiguration68332 Name="Debug_All|Win32"68333 ExcludedFromBuild="true"68334 >68335 <Tool68336 Name="VCCLCompilerTool"68337 />68338 </FileConfiguration>68339 <FileConfiguration68340 Name="Production|Win32"68341 ExcludedFromBuild="true"68342 >68343 <Tool68344 Name="VCCLCompilerTool"68345 />68346 </FileConfiguration>68347 </File>68348 <File68349 68297 RelativePath="..\bindings\js\JSDOMWrapper.cpp" 68350 68298 > -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r150216 r150276 9431 9431 </ClCompile> 9432 9432 <ClCompile Include="..\bindings\js\JSDOMWindowWebAudioCustom.cpp"> 9433 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>9434 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>9435 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>9436 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>9437 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>9438 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>9439 </ClCompile>9440 <ClCompile Include="..\bindings\js\JSDOMWindowWebSocketCustom.cpp">9441 9433 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> 9442 9434 <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r150216 r150276 5347 5347 <Filter>bindings\js</Filter> 5348 5348 </ClCompile> 5349 <ClCompile Include="..\bindings\js\JSDOMWindowWebSocketCustom.cpp">5350 <Filter>bindings\js</Filter>5351 </ClCompile>5352 5349 <ClCompile Include="..\bindings\js\JSDOMWrapper.cpp"> 5353 5350 <Filter>bindings\js</Filter> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r150216 r150276 3495 3495 A80A38FE0E50CC8200A25EBC /* PatternCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80A38FD0E50CC8200A25EBC /* PatternCG.cpp */; }; 3496 3496 A80A9423149F225E00989291 /* JSDOMWindowWebAudioCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80A9422149F225E00989291 /* JSDOMWindowWebAudioCustom.cpp */; }; 3497 A80A9425149F227100989291 /* JSDOMWindowWebSocketCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80A9424149F227100989291 /* JSDOMWindowWebSocketCustom.cpp */; };3498 3497 A80D67080E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h in Headers */ = {isa = PBXBuildFile; fileRef = A80D67070E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h */; }; 3499 3498 A80E6CE40A1989CA007FB8C5 /* CSSValueList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6CBA0A1989CA007FB8C5 /* CSSValueList.cpp */; }; … … 9997 9996 A80A38FD0E50CC8200A25EBC /* PatternCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PatternCG.cpp; sourceTree = "<group>"; }; 9998 9997 A80A9422149F225E00989291 /* JSDOMWindowWebAudioCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMWindowWebAudioCustom.cpp; sourceTree = "<group>"; }; 9999 A80A9424149F227100989291 /* JSDOMWindowWebSocketCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMWindowWebSocketCustom.cpp; sourceTree = "<group>"; };10000 9998 A80D67070E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextPlatformPrivateCG.h; sourceTree = "<group>"; }; 10001 9999 A80E6CBA0A1989CA007FB8C5 /* CSSValueList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSValueList.cpp; sourceTree = "<group>"; }; … … 18889 18887 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */, 18890 18888 A80A9422149F225E00989291 /* JSDOMWindowWebAudioCustom.cpp */, 18891 A80A9424149F227100989291 /* JSDOMWindowWebSocketCustom.cpp */,18892 18889 BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */, 18893 18890 BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */, … … 25526 25523 BCBFB53C0DCD29CF0019B3E5 /* JSDOMWindowShell.cpp in Sources */, 25527 25524 A80A9423149F225E00989291 /* JSDOMWindowWebAudioCustom.cpp in Sources */, 25528 A80A9425149F227100989291 /* JSDOMWindowWebSocketCustom.cpp in Sources */,25529 25525 CDDE691F171DFAD000A44D89 /* JSAudioBufferCustom.cpp in Sources */, 25530 25526 FD7868B9136B999200D403DF /* JSDynamicsCompressorNode.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
r148785 r150276 71 71 #include "JSDOMWindowShell.cpp" 72 72 #include "JSDOMWindowWebAudioCustom.cpp" 73 #include "JSDOMWindowWebSocketCustom.cpp"74 73 #include "JSDOMWrapper.cpp" 75 74 #include "JSDataViewCustom.cpp" -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
r149652 r150276 548 548 #endif 549 549 550 #if ENABLE(SHARED_WORKERS)551 JSValue JSDOMWindow::sharedWorker(ExecState* exec) const552 {553 if (SharedWorkerRepository::isAvailable())554 return getDOMConstructor<JSSharedWorkerConstructor>(exec, this);555 return jsUndefined();556 }557 #endif558 559 550 // Custom functions 560 551 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r150249 r150276 1511 1511 } 1512 1512 1513 # URL becomes url, but SetURL becomes setURL. 1514 sub ToMethodName 1515 { 1516 my $param = shift; 1517 my $ret = lcfirst($param); 1518 $ret =~ s/hTML/html/ if $ret =~ /^hTML/; 1519 $ret =~ s/uRL/url/ if $ret =~ /^uRL/; 1520 $ret =~ s/jS/js/ if $ret =~ /^jS/; 1521 $ret =~ s/xML/xml/ if $ret =~ /^xML/; 1522 $ret =~ s/xSLT/xslt/ if $ret =~ /^xSLT/; 1523 $ret =~ s/cSS/css/ if $ret =~ /^cSS/; 1524 1525 # For HTML5 FileSystem API Flags attributes. 1526 # (create is widely used to instantiate an object and must be avoided.) 1527 $ret =~ s/^create/isCreate/ if $ret =~ /^create$/; 1528 $ret =~ s/^exclusive/isExclusive/ if $ret =~ /^exclusive$/; 1529 1530 return $ret; 1531 } 1532 1533 # Returns the RuntimeEnabledFeatures function name that is hooked up to check if a method/attribute is enabled. 1534 sub GetRuntimeEnableFunctionName 1535 { 1536 my $signature = shift; 1537 1538 # If a parameter is given (e.g. "EnabledAtRuntime=FeatureName") return the RuntimeEnabledFeatures::{FeatureName}Enabled() method. 1539 return "RuntimeEnabledFeatures::" . ToMethodName($signature->extendedAttributes->{"EnabledAtRuntime"}) . "Enabled" if ($signature->extendedAttributes->{"EnabledAtRuntime"} && $signature->extendedAttributes->{"EnabledAtRuntime"} ne "VALUE_IS_MISSING"); 1540 1541 # Otherwise return a function named RuntimeEnabledFeatures::{methodName}Enabled(). 1542 return "RuntimeEnabledFeatures::" . ToMethodName($signature->name) . "Enabled"; 1543 } 1513 1544 1514 1545 sub GenerateImplementation … … 1947 1978 push(@implContent, "JSValue ${getFunctionName}(ExecState* exec, JSValue slotBase, PropertyName)\n"); 1948 1979 push(@implContent, "{\n"); 1980 1981 # Global constructors can be disabled at runtime. 1982 if ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"} && $attribute->signature->type =~ /Constructor$/) { 1983 AddToImplIncludes("RuntimeEnabledFeatures.h"); 1984 my $enable_function = GetRuntimeEnableFunctionName($attribute->signature); 1985 push(@implContent, " if (!${enable_function}())\n"); 1986 push(@implContent, " return jsUndefined();\n"); 1987 } 1949 1988 1950 1989 if (!$attribute->isStatic || $attribute->signature->type =~ /Constructor$/) { -
trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt
r149796 r150276 53 53 DoNotCheckSecurityOnGetter 54 54 DoNotCheckSecurityOnSetter 55 EnabledAtRuntime=* 55 56 EnforceRange 56 57 EventTarget -
trunk/Source/WebCore/page/DOMWindow.idl
r150045 r150276 327 327 [CustomGetter, Conditional=VIDEO] attribute HTMLAudioElementConstructorConstructor Audio; // Usable with the new operator 328 328 [Conditional=VIDEO] attribute HTMLAudioElementConstructor HTMLAudioElement; 329 [Conditional=WEB_SOCKETS, CustomGetter] attribute WebSocketConstructor WebSocket;330 [Conditional=SHARED_WORKERS, CustomGetter] attribute SharedWorkerConstructor SharedWorker; // Usable with the new operator331 329 // Mozilla has a separate XMLDocument object for XML documents. 332 330 // We just use Document for this. -
trunk/Source/WebCore/workers/SharedWorker.idl
r149796 r150276 31 31 32 32 [ 33 NoInterfaceObject,33 EnabledAtRuntime, 34 34 Conditional=SHARED_WORKERS, 35 35 CustomConstructor,
Note: See TracChangeset
for help on using the changeset viewer.