Reviewed by Tim O.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Sep 2006 20:43:56 +0000 (20:43 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Sep 2006 20:43:56 +0000 (20:43 +0000)
        <rdar://problem/4741392> Develop a system to find what version of WebKit an app was linked with

        * Misc/WebKitVersionChecks.h: Added.
        * Misc/WebKitVersionChecks.m: Added.
        (WebKitLinkedOnOrAfter): Added.
        (WebKitLinkTimeVersion): Added.
        (WebKitRunTimeVersion): Added.
        * WebKit.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16478 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/Misc/WebKitVersionChecks.h [new file with mode: 0644]
WebKit/Misc/WebKitVersionChecks.m [new file with mode: 0644]
WebKit/WebKit.xcodeproj/project.pbxproj

index 91d1a6cc5cbff70df3e5ab4050bbc07a51f85ca3..f7a7258726c0c72bdcebe2fc0441a6109a1f7170 100644 (file)
@@ -1,3 +1,16 @@
+2006-09-20  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by Tim O.
+
+        <rdar://problem/4741392> Develop a system to find what version of WebKit an app was linked with
+
+        * Misc/WebKitVersionChecks.h: Added.
+        * Misc/WebKitVersionChecks.m: Added.
+        (WebKitLinkedOnOrAfter): Added.
+        (WebKitLinkTimeVersion): Added.
+        (WebKitRunTimeVersion): Added.
+        * WebKit.xcodeproj/project.pbxproj:
+
 2006-09-20  Tim Omernick  <timo@apple.com>
 
         Reviewed by Darin.
diff --git a/WebKit/Misc/WebKitVersionChecks.h b/WebKit/Misc/WebKitVersionChecks.h
new file mode 100644 (file)
index 0000000..1498250
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2005 Apple Computer, 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+/* Version numbers are based on the 'current library version' specified in the WebKit build rules.
+   All of these methods return or take version numbers with each part shifted to the left 2 bytes.
+   For example the version 1.2.3 is returned as 0x00010203 and version 200.3.5 is returned as 0x00C80305
+   A version of -1 is returned if the main executable did not link against WebKit (should never happen). */
+
+BOOL WebKitLinkedOnOrAfter(int version);
+int WebKitLinkTimeVersion(void);
+int WebKitRunTimeVersion(void);
diff --git a/WebKit/Misc/WebKitVersionChecks.m b/WebKit/Misc/WebKitVersionChecks.m
new file mode 100644 (file)
index 0000000..01a4643
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2005 Apple Computer, 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. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#import "WebKitVersionChecks.h"
+#import <mach-o/dyld.h>
+
+BOOL WebKitLinkedOnOrAfter(int version)
+{
+    return (WebKitLinkTimeVersion() >= version); 
+}
+
+int WebKitLinkTimeVersion(void)
+{
+    return NSVersionOfLinkTimeLibrary("WebKit");
+}
+
+int WebKitRunTimeVersion(void)
+{
+    return NSVersionOfRunTimeLibrary("WebKit");
+}
index 82facf9f8cc59eea5a2119fec6949b4ae654f0fa..3ffba9a30af12cb5dc63de449cb30d6f1c7e2632 100644 (file)
@@ -10,6 +10,8 @@
                1C0706630A431E01001078F6 /* WebScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C0706620A431E01001078F6 /* WebScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1C07073D0A433BD8001078F6 /* WebScriptDebugServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C07073C0A433BD8001078F6 /* WebScriptDebugServer.m */; };
                1C07079A0A433E22001078F6 /* WebScriptDebugServerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C0707990A433E22001078F6 /* WebScriptDebugServerPrivate.h */; };
+               1C0D40870AC1C8F40009C113 /* WebKitVersionChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C0D40850AC1C8F40009C113 /* WebKitVersionChecks.h */; };
+               1C0D40880AC1C8F40009C113 /* WebKitVersionChecks.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C0D40860AC1C8F40009C113 /* WebKitVersionChecks.m */; };
                1C68F667095B5FC100C2984E /* webInspector in Resources */ = {isa = PBXBuildFile; fileRef = 1C68F640095B5FC100C2984E /* webInspector */; };
                1C68F668095B5FC100C2984E /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C68F65C095B5FC100C2984E /* WebInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1C68F669095B5FC100C2984E /* WebInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C68F65D095B5FC100C2984E /* WebInspector.m */; };
                1C0706620A431E01001078F6 /* WebScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugServer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                1C07073C0A433BD8001078F6 /* WebScriptDebugServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebScriptDebugServer.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                1C0707990A433E22001078F6 /* WebScriptDebugServerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptDebugServerPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               1C0D40850AC1C8F40009C113 /* WebKitVersionChecks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitVersionChecks.h; sourceTree = "<group>"; };
+               1C0D40860AC1C8F40009C113 /* WebKitVersionChecks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebKitVersionChecks.m; sourceTree = "<group>"; };
                1C68F640095B5FC100C2984E /* webInspector */ = {isa = PBXFileReference; lastKnownFileType = folder; name = webInspector; path = WebInspector/webInspector; sourceTree = SOURCE_ROOT; };
                1C68F65C095B5FC100C2984E /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                1C68F65D095B5FC100C2984E /* WebInspector.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebInspector.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                                F5C283730284676D018635CA /* WebKitPrefix.h */,
                                BEE52D4A0473032500CA289C /* WebKitSystemBits.h */,
                                BEE52D4B0473032500CA289C /* WebKitSystemBits.m */,
+                               1C0D40850AC1C8F40009C113 /* WebKitVersionChecks.h */,
+                               1C0D40860AC1C8F40009C113 /* WebKitVersionChecks.m */,
                                BEE18F990472B73200CA289C /* WebLocalizableStrings.h */,
                                BEE18F9A0472B73200CA289C /* WebLocalizableStrings.m */,
                                ED6BE2E5088C32B50044DEDC /* WebNSAttributedStringExtras.h */,
                                6538B1C80A90596D00A07522 /* WebFormDataStream.h in Headers */,
                                65A734610A923948001B57E8 /* WebPlugInStreamLoaderDelegate.h in Headers */,
                                659044280A9D3B4200E89459 /* WebDocumentLoadState.h in Headers */,
+                               1C0D40870AC1C8F40009C113 /* WebKitVersionChecks.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
+                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
                        projectRoot = "";
+                       shouldCheckCompatibility = 1;
                        targets = (
                                9398100A0824BF01008DF038 /* WebKit */,
                        );
                                51E4D39A0A886B5E00ECEE2C /* WebIconDatabaseBridge.m in Sources */,
                                6538B1C90A90596E00A07522 /* WebFormDataStream.m in Sources */,
                                659044290A9D3B4200E89459 /* WebDocumentLoadState.m in Sources */,
+                               1C0D40880AC1C8F40009C113 /* WebKitVersionChecks.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };