+2009-07-28 Robert Hogan <robert@roberthogan.net>
+
+ Reviewed by Simon Hausmann.
+
+ Add WebKit version API to Qt.
+
+ Get the current version of WebKit from WebKit/mac/Configurations/Version.xcconfig
+ at compile time and make it available to webkit ports through WebKitVersion.h.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27158
+
+ * WebCore.pro: Call generate-webkitversion.pl
+
2009-07-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
Unreviewed make dist build fix.
../WebKit/qt/Api/qwebhistoryinterface.cpp \
../WebKit/qt/Api/qwebpluginfactory.cpp \
../WebKit/qt/Api/qwebsecurityorigin.cpp \
- ../WebKit/qt/Api/qwebdatabase.cpp
+ ../WebKit/qt/Api/qwebdatabase.cpp \
+ ../WebKit/qt/Api/qwebkitversion.cpp
win32-*|wince*: SOURCES += platform/win/SystemTimeWin.cpp
xpathbison.variable_out = GENERATED_SOURCES
addExtraCompilerWithHeader(xpathbison)
+# GENERATOR 11: WebKit Version
+# The appropriate Apple-maintained Version.xcconfig file for WebKit version information is in WebKit/mac/Configurations/.
+webkitversion.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}WebKitVersion.h
+webkitversion.commands = perl $$PWD/../WebKit/scripts/generate-webkitversion.pl --config $$PWD/../WebKit/mac/Configurations/Version.xcconfig --outputDir $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}
+WEBKITVERSION_SCRIPT = $$PWD/platform/generate-webkitversion.pl
+webkitversion.input = WEBKITVERSION_SCRIPT
+webkitversion.CONFIG = target_predeps
+webkitversion.depend = $$PWD/platform/generate-webkitversion.pl
+webkitversion.variable_out = GENERATED_SOURCES
+webkitversion.clean = ${QMAKE_VAR_GENERATED_SOURCES_DIR_SLASH}WebKitVersion.h
+addExtraCompiler(webkitversion)
+
+
include($$PWD/../WebKit/qt/Api/headers.pri)
HEADERS += $$WEBKIT_API_HEADERS
!CONFIG(QTDIR_build) {
--- /dev/null
+#!/usr/bin/perl
+
+# Based on make_names.pl
+#
+# Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
+# Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org>
+# Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+# Copyright (C) 2009 Robert Hogan <robert@roberthogan.net>
+#
+# 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.
+
+# This script reads Version.xcconfig and returns either or both of the major and minor
+# WebKit version numbers. It is currently used by WebKit.pri.
+
+use strict;
+
+use Config;
+use Getopt::Long;
+use File::Path;
+use Switch;
+
+my $usage = "generate-webkitversion --config WebKit/mac/Configurations/Version.xcconfig --outputDir <outputdir>";
+
+my $major_version = "";
+my $minor_version = "";
+# The appropriate Apple-maintained Version.xcconfig file for WebKit version information is in WebKit/mac/Configurations/.
+my $configFile = "./WebKit/mac/Configurations/Version.xcconfig";
+my $outputDir = "";
+
+GetOptions('config=s' => \$configFile,
+ 'outputDir=s' => \$outputDir);
+
+die "You must specify a --config <file> " unless (length($configFile));
+die "You must specify a --outputDir <outputdir> " unless (length($outputDir));
+
+die "./WebKit/mac/Configurations/Version.xcconfig does not exist: use --config <file> to specify its correct location." unless (-e $configFile);
+die "$outputDir/ does not exist: use --outputDir <directory> to specify the location of an output directory that exists" unless (-e "$outputDir");
+
+unless (open INPUT, "<", $configFile) { print STDERR "File does not exist: $configFile\n";}
+while (my $line = <INPUT>) {
+ chomp $line;
+ if ($line =~ /^MAJOR_VERSION\s+=\s+\d+;/) {
+ $line =~ s/^(MAJOR_VERSION)\s+(=)\s+(\d+);/$3/;
+ $major_version = $line;
+ }
+ if ($line =~ /^MINOR_VERSION\s+=\s+\d+;/) {
+ $line =~ s/^(MINOR_VERSION)\s+(=)\s+(\d+);/$3/;
+ $minor_version = $line;
+ }
+}
+
+$major_version = "531" unless (length($major_version));
+$minor_version = "3" unless (length($minor_version));
+
+my $webKitVersionPath = "$outputDir/WebKitVersion.h";
+
+printWebKitVersionHeaderFile("$webKitVersionPath");
+
+sub printLicenseHeader
+{
+ my $F = shift;
+ print F "/*
+ * THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT.
+ *
+ *
+ * Copyright (C) 2009 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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.
+ */
+
+
+";
+}
+
+sub printWebKitVersionHeaderFile
+{
+ my $headerPath = shift;
+ my $F;
+ open F, ">$headerPath";
+
+ printLicenseHeader($F);
+
+ print F "#ifndef WebKitVersion_h\n";
+ print F "#define WebKitVersion_h\n\n";
+
+ print F "#define WEBKIT_MAJOR_VERSION $major_version\n";
+ print F "#define WEBKIT_MINOR_VERSION $minor_version\n\n";
+
+ print F "#endif //WebKitVersion_h\n";
+
+ close F;
+}
+
+
+
+2009-07-28 Robert Hogan <robert@roberthogan.net>
+
+ Reviewed by Simon Hausmann.
+
+ Add WebKit version API to Qt.
+
+ Get the current version of WebKit from WebKit/mac/Configurations/Version.xcconfig
+ at compile time and make it available to webkit ports through WebKitVersion.h.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27158
+
+ * scripts/generate-webkitversion.pl: Added
+
2009-07-24 Andrei Popescu <andreip@google.com>
ApplicationCache should have size limit
$$PWD/qwebsecurityorigin.h \
$$PWD/qwebelement.h \
$$PWD/qwebpluginfactory.h \
- $$PWD/qwebhistory.h
+ $$PWD/qwebhistory.h \
+ $$PWD/qwebkitversion.h
--- /dev/null
+/*
+ Copyright (C) 2009 Robert Hogan <robert@roberthogan.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include <qwebkitversion.h>
+#include <WebKitVersion.h>
+
+/*!
+
+ Returns the version number of WebKit at run-time as a string (for
+ example, "531.3"). This is the version of WebKit the application
+ was compiled against.
+
+*/
+QString qWebKitVersion()
+{
+ return QString("%1.%2").arg(WEBKIT_MAJOR_VERSION).arg(WEBKIT_MINOR_VERSION);
+}
+
+/*!
+
+ Returns the 'major' version number of WebKit at run-time as an integer
+ (for example, 531). This is the version of WebKit the application
+ was compiled against.
+
+*/
+int qWebKitMajorVersion()
+{
+ return WEBKIT_MAJOR_VERSION;
+}
+
+/*!
+
+ Returns the 'minor' version number of WebKit at run-time as an integer
+ (for example, 3). This is the version of WebKit the application
+ was compiled against.
+
+*/
+int qWebKitMinorVersion()
+{
+ return WEBKIT_MINOR_VERSION;
+}
--- /dev/null
+/*
+ Copyright (C) 2009 Robert Hogan <robert@roberthogan.net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <qstring.h>
+
+#ifndef qwebkitversion_h
+#define qwebkitversion_h
+
+#include <QtCore/qstring.h>
+#include "qwebkitglobal.h"
+
+QWEBKIT_EXPORT QString qWebKitVersion();
+QWEBKIT_EXPORT int qWebKitMajorVersion();
+QWEBKIT_EXPORT int qWebKitMinorVersion();
+
+#endif // qwebkitversion_h
#include "qwebhistory.h"
#include "qwebhistory_p.h"
#include "qwebsettings.h"
+#include "qwebkitversion.h"
#include "Frame.h"
#include "FrameTree.h"
The default implementation returns the following value:
- "Mozilla/5.0 (%Platform%; %Security%; %Subplatform%; %Locale%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko, Safari/419.3) %AppVersion"
+ "Mozilla/5.0 (%Platform%; %Security%; %Subplatform%; %Locale%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Safari/%WebKitVersion%"
In this string the following values are replaced at run-time:
\list
\o %Security% expands to U if SSL is enabled, otherwise N. SSL is enabled if QSslSocket::supportsSsl() returns true.
\o %Locale% is replaced with QLocale::name(). The locale is determined from the view of the QWebPage. If no view is set on the QWebPage,
then a default constructed QLocale is used instead.
- \o %WebKitVersion% currently expands to 527+
+ \o %WebKitVersion% is the version of WebKit the application was compiled against.
\o %AppVersion% expands to QCoreApplication::applicationName()/QCoreApplication::applicationVersion() if they're set; otherwise defaulting to Qt and the current Qt version.
\endlist
*/
ua.append(QLatin1String(") "));
// webkit/qt version
- ua.append(QLatin1String("AppleWebKit/" WEBKIT_VERSION " (KHTML, like Gecko, Safari/419.3) "));
+ ua.append(QString(QLatin1String("AppleWebKit/%1 (KHTML, like Gecko) "))
+ .arg(QString(qWebKitVersion())));
// Application name/version
QString appName = QCoreApplication::applicationName();
if (!appName.isEmpty()) {
- ua.append(QLatin1Char(' ') + appName);
+ ua.append(appName);
#if QT_VERSION >= 0x040400
QString appVer = QCoreApplication::applicationVersion();
if (!appVer.isEmpty())
ua.append(QLatin1String("Qt/"));
ua.append(QLatin1String(qVersion()));
}
+
+ ua.append(QString(QLatin1String(" Safari/%1"))
+ .arg(qWebKitVersion()));
+
return ua;
}
+2009-07-28 Robert Hogan <robert@roberthogan.net>
+
+ Reviewed by Simon Hausmann.
+
+ Add WebKit version API to Qt.
+
+ Get the current version of WebKit from WebKit/mac/Configurations/Version.xcconfig
+ at compile time and make it available to Qt applications through
+ qWebKitVersion().
+
+ Also amend the User Agent string to place the Safari clause outside
+ the final bracket and to the end of the UA string.
+
+ https://bugs.webkit.org/show_bug.cgi?id=27158
+
+ Minor build tweak by Simon Hausmann (adding export macros to new functions).
+
+ * Api/headers.pri:
+ * Api/qwebkitversion.cpp: Added.
+ (webKitVersion):
+ (webKitMajorVersion):
+ (webKitMinorVersion):
+ * Api/qwebkitversion.h: Added.
+ * Api/qwebpage.cpp:
+ (QWebPage::userAgentForUrl):
+ * tests/qwebview/tst_qwebview.cpp:
+ (tst_QWebView::getWebKitVersion):
+
2009-07-28 Simon Hausmann <simon.hausmann@nokia.com>
Rubber-stamped by Ariya Hidayat.
#include <qwebpage.h>
#include <qnetworkrequest.h>
#include <qdiriterator.h>
+#include <qwebkitversion.h>
class tst_QWebView : public QObject
{
void renderHints();
void guessUrlFromString_data();
void guessUrlFromString();
+ void getWebKitVersion();
};
// This will be called before the first test function is executed.
QCOMPARE(url, guessUrlFromString);
}
+void tst_QWebView::getWebKitVersion()
+{
+ QVERIFY(qWebKitVersion().toDouble() > 0);
+}
+
QTEST_MAIN(tst_QWebView)
#include "tst_qwebview.moc"
--- /dev/null
+#!/usr/bin/perl
+
+# Based on make_names.pl
+#
+# Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
+# Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org>
+# Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+# Copyright (C) 2009 Robert Hogan <robert@roberthogan.net>
+#
+# 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.
+
+# This script reads Version.xcconfig and returns either or both of the major and minor
+# WebKit version numbers. It is currently used by WebKit.pri.
+
+use strict;
+
+use Config;
+use Getopt::Long;
+use File::Path;
+use Switch;
+
+my $usage = "generate-webkitversion --config WebKit/mac/Configurations/Version.xcconfig --outputDir <outputdir>";
+
+my $major_version = "";
+my $minor_version = "";
+# The appropriate Apple-maintained Version.xcconfig file for WebKit version information is in WebKit/mac/Configurations/.
+my $configFile = "./WebKit/mac/Configurations/Version.xcconfig";
+my $outputDir = "";
+
+GetOptions('config=s' => \$configFile,
+ 'outputDir=s' => \$outputDir);
+
+die "You must specify a --config <file> " unless (length($configFile));
+die "You must specify a --outputDir <outputdir> " unless (length($outputDir));
+
+die "./WebKit/mac/Configurations/Version.xcconfig does not exist: use --config <file> to specify its correct location." unless (-e $configFile);
+die "$outputDir/ does not exist: use --outputDir <directory> to specify the location of an output directory that exists" unless (-e "$outputDir");
+
+unless (open INPUT, "<", $configFile) { print STDERR "File does not exist: $configFile\n";}
+while (my $line = <INPUT>) {
+ chomp $line;
+ if ($line =~ /^MAJOR_VERSION\s+=\s+\d+;/) {
+ $line =~ s/^(MAJOR_VERSION)\s+(=)\s+(\d+);/$3/;
+ $major_version = $line;
+ }
+ if ($line =~ /^MINOR_VERSION\s+=\s+\d+;/) {
+ $line =~ s/^(MINOR_VERSION)\s+(=)\s+(\d+);/$3/;
+ $minor_version = $line;
+ }
+}
+
+$major_version = "531" unless (length($major_version));
+$minor_version = "3" unless (length($minor_version));
+
+my $webKitVersionPath = "$outputDir/WebKitVersion.h";
+
+printWebKitVersionHeaderFile("$webKitVersionPath");
+
+sub printLicenseHeader
+{
+ my $F = shift;
+ print F "/*
+ * THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT.
+ *
+ *
+ * Copyright (C) 2009 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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.
+ */
+
+
+";
+}
+
+sub printWebKitVersionHeaderFile
+{
+ my $headerPath = shift;
+ my $F;
+ open F, ">$headerPath";
+
+ printLicenseHeader($F);
+
+ print F "#ifndef WebKitVersion_h\n";
+ print F "#define WebKitVersion_h\n\n";
+
+ print F "#define WEBKIT_MAJOR_VERSION $major_version\n";
+ print F "#define WEBKIT_MINOR_VERSION $minor_version\n\n";
+
+ print F "#endif //WebKitVersion_h\n";
+
+ close F;
+}
+
+
+