https://bugs.webkit.org/show_bug.cgi?id=68451
Reviewed by Darin Adler.
* JavaScriptCore.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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@95655
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-09-21 Dan Bernstein <mitz@apple.com>
+
+ JavaScriptCore 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.
+
+ * JavaScriptCore.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 <barraclough@apple.com>
MacroAssembler fixes.
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 = (
);
/* 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;
+2011-09-21 Dan Bernstein <mitz@apple.com>
+
+ 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 <mitz@apple.com>
<rdar://problem/9768483> REGRESSION: Crash in RenderBlock::removeFloatingObjectsBelow()
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 = (
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;
+2011-09-21 Dan Bernstein <mitz@apple.com>
+
+ 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 <andersca@apple.com>
Remove WebViewEventHandling.mm
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 */,
);
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;
+2011-09-21 Dan Bernstein <mitz@apple.com>
+
+ 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 <jesus.palencia@openbossa.org>
[Qt][WK2] Implement Download support in WebProcess
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 */,
);
/* 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;
+2011-09-21 Dan Bernstein <mitz@apple.com>
+
+ 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 <wangxianzhu@chromium.org>
Ensure TestWebKitAPI works on mac, win, chromium-mac and chromium-linux
--- /dev/null
+#!/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);
+}