Changeset 95655 in webkit
- Timestamp:
- Sep 21, 2011 11:48:16 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r95652 r95655 1 2011-09-21 Dan Bernstein <mitz@apple.com> 2 3 JavaScriptCore Part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes 4 https://bugs.webkit.org/show_bug.cgi?id=68451 5 6 Reviewed by Darin Adler. 7 8 * JavaScriptCore.xcodeproj/project.pbxproj: Added a script build phase that invokes 9 check-for-inappropriate-objc-class-names, allowing only class names prefixed with "JS". 10 1 11 2011-09-20 Gavin Barraclough <barraclough@apple.com> 2 12 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r95559 r95655 2875 2875 933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */, 2876 2876 5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */, 2877 3713F014142905240036387F /* Check For Inappropriate Objective-C Class Names */, 2877 2878 ); 2878 2879 buildRules = ( … … 2942 2943 2943 2944 /* Begin PBXShellScriptBuildPhase section */ 2945 3713F014142905240036387F /* Check For Inappropriate Objective-C Class Names */ = { 2946 isa = PBXShellScriptBuildPhase; 2947 buildActionMask = 2147483647; 2948 files = ( 2949 ); 2950 inputPaths = ( 2951 "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", 2952 ); 2953 name = "Check For Inappropriate Objective-C Class Names"; 2954 outputPaths = ( 2955 ); 2956 runOnlyForDeploymentPostprocessing = 0; 2957 shellPath = /bin/sh; 2958 shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-objc-class-names ]; then\n ../../Tools/Scripts/check-for-inappropriate-objc-class-names JS || exit $?\nfi"; 2959 }; 2944 2960 5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */ = { 2945 2961 isa = PBXShellScriptBuildPhase; -
trunk/Source/WebCore/ChangeLog
r95654 r95655 1 2011-09-21 Dan Bernstein <mitz@apple.com> 2 3 WebCore part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes 4 https://bugs.webkit.org/show_bug.cgi?id=68451 5 6 Reviewed by Darin Adler. 7 8 * WebCore.xcodeproj/project.pbxproj: Added a script build phase that invokes 9 check-for-inappropriate-objc-class-names, allowing only class names prefixed with "DOM" or "Web". 10 1 11 2011-09-21 Dan Bernstein <mitz@apple.com> 2 12 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r95513 r95655 23558 23558 933457E60EBFDF6B00B80894 /* Check For Exit Time Destructors */, 23559 23559 5D0D540D0E9862F60029E223 /* Check For Weak VTables and Externals */, 23560 37A1EAA3142699BC0087F425 /* Check For Inappropriate Objective-C Class Names */, 23560 23561 5DF50887116F3077005202AB /* Check For Inappropriate Files In Framework */, 23561 23562 ); … … 23688 23689 shellPath = /bin/sh; 23689 23690 shellScript = "# Copy all the Inspector front-end resources.\nditto \"${SRCROOT}/inspector/front-end\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector\"\nditto \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore/InspectorBackendStub.js\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector\"\n\n# Remove the WebKit.qrc file since it is not used on the Mac (this file is for Qt).\nrm -f \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector/WebKit.qrc\"\n\n# Remove *.re2js files, they are only used to generate some .js files.\nrm -f \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector/\"*.re2js\n\n# Remove any .svn directories that may have been copied over.\nfind \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/inspector\" -name \".svn\" -type d | xargs rm -rf\n"; 23691 }; 23692 37A1EAA3142699BC0087F425 /* Check For Inappropriate Objective-C Class Names */ = { 23693 isa = PBXShellScriptBuildPhase; 23694 buildActionMask = 2147483647; 23695 files = ( 23696 ); 23697 inputPaths = ( 23698 "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", 23699 ); 23700 name = "Check For Inappropriate Objective-C Class Names"; 23701 outputPaths = ( 23702 ); 23703 runOnlyForDeploymentPostprocessing = 0; 23704 shellPath = /bin/sh; 23705 shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-objc-class-names ]; then\n ../../Tools/Scripts/check-for-inappropriate-objc-class-names DOM Web || exit $?\nfi"; 23690 23706 }; 23691 23707 5D0D540D0E9862F60029E223 /* Check For Weak VTables and Externals */ = { -
trunk/Source/WebKit/ChangeLog
r95470 r95655 1 2011-09-21 Dan Bernstein <mitz@apple.com> 2 3 WebKit part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes 4 https://bugs.webkit.org/show_bug.cgi?id=68451 5 6 Reviewed by Darin Adler. 7 8 * WebKit.xcodeproj/project.pbxproj: Added a script build phase that invokes 9 check-for-inappropriate-objc-class-names, allowing only class names prefixed with "Web" or "_Web". 10 1 11 2011-09-19 Anders Carlsson <andersca@apple.com> 2 12 -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r95470 r95655 1642 1642 9337D6540EBFE54D00DA3CB5 /* Check For Exit Time Destructors */, 1643 1643 5D0D54210E98631D0029E223 /* Check For Weak VTables and Externals */, 1644 3713F018142905B70036387F /* Check For Inappropriate Objective-C Class Names */, 1644 1645 5D88EE6C11407DE800BC3ABC /* Check For Framework Include Consistency */, 1645 1646 5DE6D18C0FCF231B002DE28C /* Symlink WebKitPluginHost in to place */, … … 1731 1732 shellPath = /bin/sh; 1732 1733 shellScript = "mkdir -p \"${TARGET_BUILD_DIR}/${PRIVATE_HEADERS_FOLDER_PATH}\"\nmkdir -p \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}\"\nmkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKit\"\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make -C mac -f \"MigrateHeaders.make\" -j `/usr/sbin/sysctl -n hw.availcpu`\nfi\n"; 1734 }; 1735 3713F018142905B70036387F /* Check For Inappropriate Objective-C Class Names */ = { 1736 isa = PBXShellScriptBuildPhase; 1737 buildActionMask = 2147483647; 1738 files = ( 1739 ); 1740 inputPaths = ( 1741 "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", 1742 ); 1743 name = "Check For Inappropriate Objective-C Class Names"; 1744 outputPaths = ( 1745 ); 1746 runOnlyForDeploymentPostprocessing = 0; 1747 shellPath = /bin/sh; 1748 shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-objc-class-names ]; then\n ../../Tools/Scripts/check-for-inappropriate-objc-class-names Web _Web || exit $?\nfi"; 1733 1749 }; 1734 1750 5D0D54210E98631D0029E223 /* Check For Weak VTables and Externals */ = { -
trunk/Source/WebKit2/ChangeLog
r95631 r95655 1 2011-09-21 Dan Bernstein <mitz@apple.com> 2 3 WebKit2 part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes 4 https://bugs.webkit.org/show_bug.cgi?id=68451 5 6 Reviewed by Darin Adler. 7 8 * WebKit2.xcodeproj/project.pbxproj: Added a script build phase that invokes 9 check-for-inappropriate-objc-class-names, allowing only class names prefixed with "WK" or "Web". 10 1 11 2011-09-21 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 12 -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r95448 r95655 3926 3926 5DF408C4131DD3DB00130071 /* Check For Exit Time Destructors */, 3927 3927 5DF408C5131DD46700130071 /* Check For Weak VTables and Externals */, 3928 3713F0231429063D0036387F /* Check For Inappropriate Objective-C Class Names */, 3928 3929 5DF408C6131DD49700130071 /* Check For Framework Include Consistency */, 3929 3930 5DF408D1131DDBEC00130071 /* Check For Inappropriate Files In Framework */, … … 4018 4019 4019 4020 /* Begin PBXShellScriptBuildPhase section */ 4021 3713F0231429063D0036387F /* Check For Inappropriate Objective-C Class Names */ = { 4022 isa = PBXShellScriptBuildPhase; 4023 buildActionMask = 2147483647; 4024 files = ( 4025 ); 4026 inputPaths = ( 4027 "$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)", 4028 ); 4029 name = "Check For Inappropriate Objective-C Class Names"; 4030 outputPaths = ( 4031 ); 4032 runOnlyForDeploymentPostprocessing = 0; 4033 shellPath = /bin/sh; 4034 shellScript = "if [ \"${ACTION}\" = \"installhdrs\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-inappropriate-objc-class-names ]; then\n ../../Tools/Scripts/check-for-inappropriate-objc-class-names WK Web || exit $?\nfi"; 4035 }; 4020 4036 5DF408C0131DD37C00130071 /* Check For Global Initializers */ = { 4021 4037 isa = PBXShellScriptBuildPhase; -
trunk/Tools/ChangeLog
r95647 r95655 1 2011-09-21 Dan Bernstein <mitz@apple.com> 2 3 Tools part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes 4 https://bugs.webkit.org/show_bug.cgi?id=68451 5 6 Reviewed by Darin Adler. 7 8 * Scripts/check-for-inappropriate-objc-class-names: Added. Checks for 9 Objective-C classes with names not having one of a list of prefixes 10 passed on the command line. 11 1 12 2011-09-21 Xianzhu Wang <wangxianzhu@chromium.org> 2 13 -
trunk/Tools/Scripts/check-for-inappropriate-objc-class-names
r95653 r95655 1 1 #!/usr/bin/perl 2 2 3 # Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.3 # Copyright (C) 2006, 2007, 2008, 2010, 2011 Apple Inc. All rights reserved. 4 4 # 5 5 # Redistribution and use in source and binary forms, with or without 6 6 # modification, are permitted provided that the following conditions 7 7 # are met: 8 # 9 # 1. Redistributions of source code must retain the above copyright 10 # notice, this list of conditions and the following disclaimer. 11 # 2. Redistributions in binary form must reproduce the above copyright 12 # notice, this list of conditions and the following disclaimer in the 13 # documentation and/or other materials provided with the distribution. 14 # 3. Neither the name of Apple Inc. ("Apple") nor the names of 15 # its contributors may be used to endorse or promote products derived 16 # from this software without specific prior written permission. 17 # 18 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 8 # 1. Redistributions of source code must retain the above copyright 9 # notice, this list of conditions and the following disclaimer. 10 # 2. Redistributions in binary form must reproduce the above copyright 11 # notice, this list of conditions and the following disclaimer in the 12 # documentation and/or other materials provided with the distribution. 13 # 14 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 15 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 18 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24 # THE POSSIBILITY OF SUCH DAMAGE. 28 25 29 # "check-for- weak-vtables-and-externals" script for WebKit Open Source Project26 # "check-for-inappropriate-objc-class-names" script for WebKit Open Source Project 30 27 31 # Intended to be invoked from an Xcode build step to check if there are 32 # any weak vtables or weak externals in a target. 28 # Intended to be invoked from an Xcode build step to check if a framework 29 # defines any Objective-C class whose name does not have one of the prefixes 30 # the framework is allowed to use. 33 31 34 32 use warnings; … … 39 37 sub touch($); 40 38 39 my @allowedPrefixes = @ARGV; 40 41 die "No allowed prefixes passed on the command line" if !@allowedPrefixes; 42 41 43 my $arch = $ENV{'CURRENT_ARCH'}; 42 my $configuration = $ENV{'CONFIGURATION'};43 44 my $target = $ENV{'TARGET_NAME'}; 44 45 my $variant = $ENV{'CURRENT_VARIANT'}; 45 46 my $coverageBuild = $ENV{'WEBKIT_COVERAGE_BUILD'}; 46 my $debugRoot = $ENV{'WEBKIT_DEBUG_ROOT'};47 48 $arch = $ENV{'NATIVE_ARCH'} if !$arch; # for Xcode 2.1, which does not have CURRENT_ARCH49 $variant = "normal" if !$variant; # for Xcode 2.1, which does not have CURRENT_VARIANT50 47 51 48 my $executablePath = "$ENV{'TARGET_BUILD_DIR'}/$ENV{'EXECUTABLE_PATH'}"; 52 49 53 my $buildTimestampPath = $ENV{'TARGET_TEMP_DIR'} . "/" . basename($0) . ".timestamp";50 my $buildTimestampPath = $ENV{'TARGET_TEMP_DIR'} . "/" . basename($0) . join('-', @allowedPrefixes) . ".timestamp"; 54 51 my $buildTimestampAge = -M $buildTimestampPath; 55 52 my $executablePathAge = -M $executablePath; 53 my $scriptAge = -M $0; 54 55 my $pattern = "^(" . join('|', @allowedPrefixes) . ")"; 56 56 57 57 my $sawError = 0; 58 58 59 if (!defined $executablePathAge || !defined $buildTimestampAge || $executablePathAge < $buildTimestampAge ) {60 if (!open NM, "(nm - m '$executablePath' | c++filt| sed 's/^/STDOUT:/') 2>&1 |") {59 if (!defined $executablePathAge || !defined $buildTimestampAge || $executablePathAge < $buildTimestampAge || $scriptAge < $buildTimestampAge) { 60 if (!open NM, "(nm -Ugjp '$executablePath' | sed 's/^/STDOUT:/') 2>&1 |") { 61 61 print "ERROR: Could not open $executablePath\n"; 62 62 $sawError = 1; 63 63 next; 64 64 } 65 my @weakVTableClasses = (); 66 my @weakExternalSymbols = (); 65 my @badNames; 67 66 while (<NM>) { 68 67 if (/^STDOUT:/) { 69 # Ignore undefined, RTTI and typeinfo symbols. 70 next if /\bundefined\b/ or /\b__ZT[IS]/; 71 72 if (/weak external vtable for (.*)$/) { 73 push @weakVTableClasses, $1; 74 } elsif (/weak external (.*)$/) { 75 push @weakExternalSymbols, $1; 76 } 68 next unless /^STDOUT:_OBJC_CLASS_\$_/; 69 chomp; 70 my $className = substr($_, 21); 71 push(@badNames, $className) unless $className =~ /$pattern/; 77 72 } else { 78 73 print STDERR if $_ ne "nm: no name list\n"; … … 81 76 close NM; 82 77 83 my $shortName = $executablePath; 84 $shortName =~ s/.*\///; 78 if (@badNames) { 85 79 86 if (@weakVTableClasses) { 87 print "ERROR: $shortName has a weak vtable in it ($executablePath)\n"; 88 print "ERROR: Fix by making sure the first virtual function in each of these classes is not an inline:\n"; 89 for my $class (sort @weakVTableClasses) { 90 print "ERROR: class $class\n"; 80 my $shortName = $executablePath; 81 $shortName =~ s/.*\///; 82 83 print "ERROR: $shortName defines one or more Objective-C classes with inappropriate names. ($executablePath)\n"; 84 for my $className (@badNames) { 85 print "ERROR: Inapproriate Objective-C class name: $className.\n"; 91 86 } 92 $sawError = 1;93 }94 87 95 if (@weakExternalSymbols) { 96 print "ERROR: $shortName has a weak external symbol in it ($executablePath)\n"; 97 print "ERROR: A weak external symbol is generated when a symbol is defined in multiple compilation units and is also marked as being exported from the library.\n"; 98 print "ERROR: A common cause of weak external symbols is when an inline function is listed in the linker export file.\n"; 99 for my $symbol (sort @weakExternalSymbols) { 100 print "ERROR: symbol $symbol\n"; 88 if (@allowedPrefixes > 1) { 89 print "ERROR: Objective-C class names in $target must have one of these prefixes: " . join(", ", map('"' . $_ . '"', @allowedPrefixes)) . ".\n"; 90 } else { 91 print "ERROR: Objective-C class names in $target must have the prefix \"" . $allowedPrefixes[0] . "\".\n"; 101 92 } 93 102 94 $sawError = 1; 103 95 } … … 110 102 111 103 touch($buildTimestampPath); 112 113 104 exit 0; 114 105
Note: See TracChangeset
for help on using the changeset viewer.