Title: [95655] trunk
Revision
95655
Author
[email protected]
Date
2011-09-21 11:48:16 -0700 (Wed, 21 Sep 2011)

Log Message

Source/_javascript_Core: _javascript_Core Part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes
https://bugs.webkit.org/show_bug.cgi?id=68451

Reviewed by Darin Adler.

* _javascript_Core.xcodeproj/project.pbxproj: Added a script build phase that invokes
check-for-inappropriate-objc-class-names, allowing only class names prefixed with "JS".

Source/WebCore: WebCore part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes
https://bugs.webkit.org/show_bug.cgi?id=68451

Reviewed by Darin Adler.

* WebCore.xcodeproj/project.pbxproj: Added a script build phase that invokes
check-for-inappropriate-objc-class-names, allowing only class names prefixed with "DOM" or "Web".

Source/WebKit: WebKit part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes
https://bugs.webkit.org/show_bug.cgi?id=68451

Reviewed by Darin Adler.

* WebKit.xcodeproj/project.pbxproj: Added a script build phase that invokes
check-for-inappropriate-objc-class-names, allowing only class names prefixed with "Web" or "_Web".

Source/WebKit2: WebKit2 part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes
https://bugs.webkit.org/show_bug.cgi?id=68451

Reviewed by Darin Adler.

* WebKit2.xcodeproj/project.pbxproj: Added a script build phase that invokes
check-for-inappropriate-objc-class-names, allowing only class names prefixed with "WK" or "Web".

Tools: Tools part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes
https://bugs.webkit.org/show_bug.cgi?id=68451

Reviewed by Darin Adler.

* Scripts/check-for-inappropriate-objc-class-names: Added. Checks for
Objective-C classes with names not having one of a list of prefixes
passed on the command line.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (95654 => 95655)


--- trunk/Source/_javascript_Core/ChangeLog	2011-09-21 18:45:56 UTC (rev 95654)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-09-21 18:48:16 UTC (rev 95655)
@@ -1,3 +1,13 @@
+2011-09-21  Dan Bernstein  <[email protected]>
+
+        _javascript_Core Part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes
+        https://bugs.webkit.org/show_bug.cgi?id=68451
+
+        Reviewed by Darin Adler.
+
+        * _javascript_Core.xcodeproj/project.pbxproj: Added a script build phase that invokes
+        check-for-inappropriate-objc-class-names, allowing only class names prefixed with "JS".
+
 2011-09-20  Gavin Barraclough  <[email protected]>
 
         MacroAssembler fixes.

Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (95654 => 95655)


--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2011-09-21 18:45:56 UTC (rev 95654)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj	2011-09-21 18:48:16 UTC (rev 95655)
@@ -2874,6 +2874,7 @@
 				9319586B09D9F91A00A56FD4 /* Check For Global Initializers */,
 				933457200EBFDC3F00B80894 /* Check For Exit Time Destructors */,
 				5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */,
+				3713F014142905240036387F /* Check For Inappropriate Objective-C Class Names */,
 			);
 			buildRules = (
 			);
@@ -2941,6 +2942,21 @@
 /* End PBXProject section */
 
 /* Begin PBXShellScriptBuildPhase section */
+		3713F014142905240036387F /* Check For Inappropriate Objective-C Class Names */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+				"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
+			);
+			name = "Check For Inappropriate Objective-C Class Names";
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			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";
+		};
 		5D29D8BE0E9860B400C3D2D0 /* Check For Weak VTables and Externals */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;

Modified: trunk/Source/WebCore/ChangeLog (95654 => 95655)


--- trunk/Source/WebCore/ChangeLog	2011-09-21 18:45:56 UTC (rev 95654)
+++ trunk/Source/WebCore/ChangeLog	2011-09-21 18:48:16 UTC (rev 95655)
@@ -1,5 +1,15 @@
 2011-09-21  Dan Bernstein  <[email protected]>
 
+        WebCore part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes
+        https://bugs.webkit.org/show_bug.cgi?id=68451
+
+        Reviewed by Darin Adler.
+
+        * WebCore.xcodeproj/project.pbxproj: Added a script build phase that invokes
+        check-for-inappropriate-objc-class-names, allowing only class names prefixed with "DOM" or "Web".
+
+2011-09-21  Dan Bernstein  <[email protected]>
+
         <rdar://problem/9768483> REGRESSION: Crash in RenderBlock::removeFloatingObjectsBelow()
         https://bugs.webkit.org/show_bug.cgi?id=68550
 

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (95654 => 95655)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-09-21 18:45:56 UTC (rev 95654)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-09-21 18:48:16 UTC (rev 95655)
@@ -23557,6 +23557,7 @@
 				939D050109D9FF6B00984996 /* Check For Global Initializers */,
 				933457E60EBFDF6B00B80894 /* Check For Exit Time Destructors */,
 				5D0D540D0E9862F60029E223 /* Check For Weak VTables and Externals */,
+				37A1EAA3142699BC0087F425 /* Check For Inappropriate Objective-C Class Names */,
 				5DF50887116F3077005202AB /* Check For Inappropriate Files In Framework */,
 			);
 			buildRules = (
@@ -23688,6 +23689,21 @@
 			shellPath = /bin/sh;
 			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";
 		};
+		37A1EAA3142699BC0087F425 /* Check For Inappropriate Objective-C Class Names */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+				"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
+			);
+			name = "Check For Inappropriate Objective-C Class Names";
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			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";
+		};
 		5D0D540D0E9862F60029E223 /* Check For Weak VTables and Externals */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;

Modified: trunk/Source/WebKit/ChangeLog (95654 => 95655)


--- trunk/Source/WebKit/ChangeLog	2011-09-21 18:45:56 UTC (rev 95654)
+++ trunk/Source/WebKit/ChangeLog	2011-09-21 18:48:16 UTC (rev 95655)
@@ -1,3 +1,13 @@
+2011-09-21  Dan Bernstein  <[email protected]>
+
+        WebKit part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes
+        https://bugs.webkit.org/show_bug.cgi?id=68451
+
+        Reviewed by Darin Adler.
+
+        * WebKit.xcodeproj/project.pbxproj: Added a script build phase that invokes
+        check-for-inappropriate-objc-class-names, allowing only class names prefixed with "Web" or "_Web".
+
 2011-09-19  Anders Carlsson  <[email protected]>
 
         Remove WebViewEventHandling.mm

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (95654 => 95655)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2011-09-21 18:45:56 UTC (rev 95654)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2011-09-21 18:48:16 UTC (rev 95655)
@@ -1641,6 +1641,7 @@
 				939D054F09DA02D500984996 /* Check For Global Initializers */,
 				9337D6540EBFE54D00DA3CB5 /* Check For Exit Time Destructors */,
 				5D0D54210E98631D0029E223 /* Check For Weak VTables and Externals */,
+				3713F018142905B70036387F /* Check For Inappropriate Objective-C Class Names */,
 				5D88EE6C11407DE800BC3ABC /* Check For Framework Include Consistency */,
 				5DE6D18C0FCF231B002DE28C /* Symlink WebKitPluginHost in to place */,
 			);
@@ -1731,6 +1732,21 @@
 			shellPath = /bin/sh;
 			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";
 		};
+		3713F018142905B70036387F /* Check For Inappropriate Objective-C Class Names */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+				"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
+			);
+			name = "Check For Inappropriate Objective-C Class Names";
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			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";
+		};
 		5D0D54210E98631D0029E223 /* Check For Weak VTables and Externals */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;

Modified: trunk/Source/WebKit2/ChangeLog (95654 => 95655)


--- trunk/Source/WebKit2/ChangeLog	2011-09-21 18:45:56 UTC (rev 95654)
+++ trunk/Source/WebKit2/ChangeLog	2011-09-21 18:48:16 UTC (rev 95655)
@@ -1,3 +1,13 @@
+2011-09-21  Dan Bernstein  <[email protected]>
+
+        WebKit2 part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes
+        https://bugs.webkit.org/show_bug.cgi?id=68451
+
+        Reviewed by Darin Adler.
+
+        * WebKit2.xcodeproj/project.pbxproj: Added a script build phase that invokes
+        check-for-inappropriate-objc-class-names, allowing only class names prefixed with "WK" or "Web".
+
 2011-09-21  Jesus Sanchez-Palencia  <[email protected]>
 
         [Qt][WK2] Implement Download support in WebProcess

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (95654 => 95655)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2011-09-21 18:45:56 UTC (rev 95654)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2011-09-21 18:48:16 UTC (rev 95655)
@@ -3925,6 +3925,7 @@
 				5DF408C0131DD37C00130071 /* Check For Global Initializers */,
 				5DF408C4131DD3DB00130071 /* Check For Exit Time Destructors */,
 				5DF408C5131DD46700130071 /* Check For Weak VTables and Externals */,
+				3713F0231429063D0036387F /* Check For Inappropriate Objective-C Class Names */,
 				5DF408C6131DD49700130071 /* Check For Framework Include Consistency */,
 				5DF408D1131DDBEC00130071 /* Check For Inappropriate Files In Framework */,
 			);
@@ -4017,6 +4018,21 @@
 /* End PBXResourcesBuildPhase section */
 
 /* Begin PBXShellScriptBuildPhase section */
+		3713F0231429063D0036387F /* Check For Inappropriate Objective-C Class Names */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputPaths = (
+				"$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)",
+			);
+			name = "Check For Inappropriate Objective-C Class Names";
+			outputPaths = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			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";
+		};
 		5DF408C0131DD37C00130071 /* Check For Global Initializers */ = {
 			isa = PBXShellScriptBuildPhase;
 			buildActionMask = 2147483647;

Modified: trunk/Tools/ChangeLog (95654 => 95655)


--- trunk/Tools/ChangeLog	2011-09-21 18:45:56 UTC (rev 95654)
+++ trunk/Tools/ChangeLog	2011-09-21 18:48:16 UTC (rev 95655)
@@ -1,3 +1,14 @@
+2011-09-21  Dan Bernstein  <[email protected]>
+
+        Tools part of: Prevent the WebKit frameworks from defining inappropriately-named Objective-C classes
+        https://bugs.webkit.org/show_bug.cgi?id=68451
+
+        Reviewed by Darin Adler.
+
+        * Scripts/check-for-inappropriate-objc-class-names: Added. Checks for
+        Objective-C classes with names not having one of a list of prefixes
+        passed on the command line.
+
 2011-09-21  Xianzhu Wang  <[email protected]>
 
         Ensure TestWebKitAPI works on mac, win, chromium-mac and chromium-linux

Copied: trunk/Tools/Scripts/check-for-inappropriate-objc-class-names (from rev 95653, trunk/Tools/Scripts/check-for-weak-vtables-and-externals) (0 => 95655)


--- trunk/Tools/Scripts/check-for-inappropriate-objc-class-names	                        (rev 0)
+++ trunk/Tools/Scripts/check-for-inappropriate-objc-class-names	2011-09-21 18:48:16 UTC (rev 95655)
@@ -0,0 +1,111 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2006, 2007, 2008, 2010, 2011 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+# "check-for-inappropriate-objc-class-names" script for WebKit Open Source Project
+
+# Intended to be invoked from an Xcode build step to check if a framework
+# defines any Objective-C class whose name does not have one of the prefixes
+# the framework is allowed to use.
+
+use warnings;
+use strict;
+
+use File::Basename;
+
+sub touch($);
+
+my @allowedPrefixes = @ARGV;
+
+die "No allowed prefixes passed on the command line" if !@allowedPrefixes;
+
+my $arch = $ENV{'CURRENT_ARCH'};
+my $target = $ENV{'TARGET_NAME'};
+my $variant = $ENV{'CURRENT_VARIANT'};
+my $coverageBuild = $ENV{'WEBKIT_COVERAGE_BUILD'};
+
+my $executablePath = "$ENV{'TARGET_BUILD_DIR'}/$ENV{'EXECUTABLE_PATH'}";
+
+my $buildTimestampPath = $ENV{'TARGET_TEMP_DIR'} . "/" . basename($0) . join('-', @allowedPrefixes) . ".timestamp";
+my $buildTimestampAge = -M $buildTimestampPath;
+my $executablePathAge = -M $executablePath;
+my $scriptAge = -M $0;
+
+my $pattern = "^(" . join('|', @allowedPrefixes) . ")";
+
+my $sawError = 0;
+
+if (!defined $executablePathAge || !defined $buildTimestampAge || $executablePathAge < $buildTimestampAge || $scriptAge < $buildTimestampAge) {
+    if (!open NM, "(nm -Ugjp '$executablePath' | sed 's/^/STDOUT:/') 2>&1 |") {
+        print "ERROR: Could not open $executablePath\n";
+        $sawError = 1;
+        next;
+    }
+    my @badNames;
+    while (<NM>) {
+        if (/^STDOUT:/) {
+            next unless /^STDOUT:_OBJC_CLASS_\$_/;
+            chomp;
+            my $className = substr($_, 21);
+            push(@badNames, $className) unless $className =~ /$pattern/;
+        } else {
+            print STDERR if $_ ne "nm: no name list\n";
+        }
+    }
+    close NM;
+
+    if (@badNames) {
+
+        my $shortName = $executablePath;
+        $shortName =~ s/.*\///;
+
+        print "ERROR: $shortName defines one or more Objective-C classes with inappropriate names. ($executablePath)\n";
+        for my $className (@badNames) {
+            print "ERROR: Inapproriate Objective-C class name: $className.\n";
+        }
+
+        if (@allowedPrefixes > 1) {
+            print "ERROR: Objective-C class names in $target must have one of these prefixes: " . join(", ", map('"' . $_ . '"', @allowedPrefixes)) . ".\n";
+        } else {
+            print "ERROR: Objective-C class names in $target must have the prefix \"" . $allowedPrefixes[0] . "\".\n";
+        }
+
+        $sawError = 1;
+    }
+}
+
+if ($sawError and !$coverageBuild) {
+    unlink $executablePath;
+    exit 1;
+}
+
+touch($buildTimestampPath);
+exit 0;
+
+sub touch($)
+{
+    my ($path) = @_;
+    open(TOUCH, ">", $path) or die "$!";
+    close(TOUCH);
+}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to