Revamp the build scripts in deploy/.

Technically only deploy/package-linux-dynamic.sh is relevant and it's
been adjusted appropriately. All other files are obsoleted with the new
build process.

http://code.google.com/p/phantomjs/issues/detail?id=226
1.5
Ariya Hidayat 2012-03-08 21:58:30 -08:00
parent 8c01f46e4d
commit a398b3fec0
8 changed files with 1 additions and 2824 deletions

View File

@ -5,7 +5,7 @@ cd `dirname $0`/..
mkdir phantomjs
cp -r examples ChangeLog LICENSE.BSD README.md bin phantomjs
QT_LIB=deploy/Qt-4.8.0/lib
QT_LIB=src/qt/lib
mkdir phantomjs/lib
cp -r $QT_LIB/libQtCore.* $QT_LIB/libQtGui.* $QT_LIB/libQtNetwork.* $QT_LIB/libQtWebKit.* phantomjs/lib

View File

@ -1,35 +0,0 @@
diff --git a/src/3rdparty/webkit/Source/WebCore/inspector/front-end/Settings.js b/src/3rdparty/webkit/Source/WebCore/inspector/front-end/Settings.js
index 62bf84a..e830f85 100644
--- a/src/3rdparty/webkit/Source/WebCore/inspector/front-end/Settings.js
+++ b/src/3rdparty/webkit/Source/WebCore/inspector/front-end/Settings.js
@@ -40,7 +40,7 @@ var Preferences = {
showMissingLocalizedStrings: false,
samplingCPUProfiler: false,
showColorNicknames: true,
- debuggerAlwaysEnabled: false,
+ debuggerAlwaysEnabled: true,
profilerAlwaysEnabled: false,
onlineDetectionEnabled: true,
nativeInstrumentationEnabled: false,
@@ -58,7 +58,7 @@ WebInspector.Settings = function()
{
this.installApplicationSetting("colorFormat", "hex");
this.installApplicationSetting("consoleHistory", []);
- this.installApplicationSetting("debuggerEnabled", false);
+ this.installApplicationSetting("debuggerEnabled", true);
this.installApplicationSetting("domWordWrap", true);
this.installApplicationSetting("profilerEnabled", false);
this.installApplicationSetting("eventListenersFilter", "all");
diff --git a/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector.cpp b/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector.cpp
index 6706f2a..bec3d1c 100644
--- a/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector.cpp
+++ b/src/3rdparty/webkit/Source/WebKit/qt/Api/qwebinspector.cpp
@@ -161,7 +161,7 @@ void QWebInspector::showEvent(QShowEvent* event)
#if ENABLE(INSPECTOR)
// Allows QWebInspector::show() to init the inspector.
if (d->page)
- d->page->d->inspectorController()->show();
+ d->page->d->inspectorController()->showAndEnableDebugger();
#endif
}

View File

@ -1,268 +0,0 @@
diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
index 92b7d5c..c5e5bd5 100644
--- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
+++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp
@@ -22,7 +22,8 @@
#include "InspectorClientQt.h"
#include "InspectorController.h"
-#include "MD5.h"
+#include "Base64.h"
+#include "SHA1.h"
#include "Page.h"
#include "qwebpage.h"
#include "qwebpage_p.h"
@@ -44,43 +45,17 @@ namespace WebCore {
/*!
Computes the WebSocket handshake response given the two challenge numbers and key3.
*/
-static void generateWebSocketChallengeResponse(uint32_t number1, uint32_t number2, const unsigned char key3[8], unsigned char response[16])
+static QByteArray generateWebSocketChallengeResponse(const QByteArray& key)
{
- uint8_t challenge[16];
- qToBigEndian<qint32>(number1, &challenge[0]);
- qToBigEndian<qint32>(number2, &challenge[4]);
- memcpy(&challenge[8], key3, 8);
- MD5 md5;
- md5.addBytes(challenge, sizeof(challenge));
- Vector<uint8_t, 16> digest;
- md5.checksum(digest);
- memcpy(response, digest.data(), 16);
-}
-
-/*!
- Parses and returns a WebSocket challenge number according to the
- method specified in the WebSocket protocol.
-
- The field contains numeric digits interspersed with spaces and
- non-numeric digits. The protocol ignores the characters that are
- neither digits nor spaces. The digits are concatenated and
- interpreted as a long int. The result is this number divided by
- the number of spaces.
- */
-static quint32 parseWebSocketChallengeNumber(QString field)
-{
- QString nString;
- int numSpaces = 0;
- for (int i = 0; i < field.size(); i++) {
- QChar c = field[i];
- if (c == QLatin1Char(' '))
- numSpaces++;
- else if ((c >= QLatin1Char('0')) && (c <= QLatin1Char('9')))
- nString.append(c);
- }
- quint32 num = nString.toLong();
- quint32 result = (numSpaces ? (num / numSpaces) : num);
- return result;
+ SHA1 sha1;
+ Vector<uint8_t, 20> digest;
+ Vector<char> encoded;
+ QByteArray toHash("258EAFA5-E914-47DA-95CA-C5AB0DC85B11");
+ toHash.prepend(key);
+ sha1.addBytes((uint8_t*)toHash.data(), toHash.size());
+ sha1.computeHash(digest);
+ base64Encode((char*)digest.data(), digest.size(), encoded);
+ return QByteArray(encoded.data(), encoded.size());
}
static InspectorServerQt* s_inspectorServer;
@@ -194,7 +169,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
m_path = header.path();
m_contentType = header.contentType().toLatin1();
m_contentLength = header.contentLength();
- if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("WebSocket")))
+ if (header.hasKey(QLatin1String("Upgrade")) && (header.value(QLatin1String("Upgrade")) == QLatin1String("websocket")))
isWebSocket = true;
m_data.clear();
@@ -211,25 +186,19 @@ void InspectorServerRequestHandlerQt::tcpReadyRead()
// switch to websocket-style WebSocketService messaging
if (m_tcpConnection) {
m_tcpConnection->disconnect(SIGNAL(readyRead()));
- connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(webSocketReadyRead()));
-
- QByteArray key3 = m_tcpConnection->read(8);
-
- quint32 number1 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key1")));
- quint32 number2 = parseWebSocketChallengeNumber(header.value(QLatin1String("Sec-WebSocket-Key2")));
-
- char responseData[16];
- generateWebSocketChallengeResponse(number1, number2, (unsigned char*)key3.data(), (unsigned char*)responseData);
- QByteArray response(responseData, sizeof(responseData));
+ connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(webSocketReadyRead()), Qt::QueuedConnection);
+
+ QByteArray key = header.value(QLatin1String("Sec-WebSocket-Key")).toLatin1();
+ QString accept = QString::fromLatin1(generateWebSocketChallengeResponse(key));
QHttpResponseHeader responseHeader(101, QLatin1String("WebSocket Protocol Handshake"), 1, 1);
responseHeader.setValue(QLatin1String("Upgrade"), header.value(QLatin1String("Upgrade")));
responseHeader.setValue(QLatin1String("Connection"), header.value(QLatin1String("Connection")));
- responseHeader.setValue(QLatin1String("Sec-WebSocket-Origin"), header.value(QLatin1String("Origin")));
- responseHeader.setValue(QLatin1String("Sec-WebSocket-Location"), (QLatin1String("ws://") + header.value(QLatin1String("Host")) + m_path));
- responseHeader.setContentLength(response.size());
+ responseHeader.setValue(QLatin1String("Sec-WebSocket-Accept"), accept);
+ // responseHeader.setValue(QLatin1String("Sec-WebSocket-Origin"), header.value(QLatin1String("Sec-WebSocket-Origin")));
+ // responseHeader.setValue(QLatin1String("Sec-WebSocket-Location"), (QLatin1String("ws://") + header.value(QLatin1String("Host")) + m_path));
m_tcpConnection->write(responseHeader.toString().toLatin1());
- m_tcpConnection->write(response);
+ //m_tcpConnection->write(response);
m_tcpConnection->flush();
if ((words.size() == 4)
@@ -308,26 +277,54 @@ void InspectorServerRequestHandlerQt::tcpConnectionDisconnected()
m_tcpConnection = 0;
}
-int InspectorServerRequestHandlerQt::webSocketSend(QByteArray payload)
+int InspectorServerRequestHandlerQt::webSocketSend(const QString& message)
{
- Q_ASSERT(m_tcpConnection);
- m_tcpConnection->putChar(0x00);
- int nBytes = m_tcpConnection->write(payload);
- m_tcpConnection->putChar(0xFF);
- m_tcpConnection->flush();
- return nBytes;
+ QByteArray payload = message.toUtf8();
+ return webSocketSend(payload.data(), payload.size());
}
int InspectorServerRequestHandlerQt::webSocketSend(const char* data, size_t length)
{
Q_ASSERT(m_tcpConnection);
- m_tcpConnection->putChar(0x00);
+ m_tcpConnection->putChar(0x81);
+ if (length <= 125)
+ m_tcpConnection->putChar(static_cast<uint8_t>(length));
+ else if (length <= pow(2,16)) {
+ m_tcpConnection->putChar(126);
+ quint16 length16 = qToBigEndian<quint16>(static_cast<quint16>(length));
+ m_tcpConnection->write(reinterpret_cast<char*>(&length16), 2);
+ } else {
+ m_tcpConnection->putChar(127);
+ quint64 length64 = qToBigEndian<quint64>(static_cast<quint64>(length));
+ m_tcpConnection->write(reinterpret_cast<char*>(&length64), 8);
+ }
int nBytes = m_tcpConnection->write(data, length);
- m_tcpConnection->putChar(0xFF);
m_tcpConnection->flush();
return nBytes;
}
+static QByteArray applyMask(const QByteArray& payload, const QByteArray& maskingKey)
+{
+ Q_ASSERT(maskingKey.size() == 4);
+ QByteArray unmaskedPayload;
+ for (int i = 0; i < payload.size(); ++i) {
+ char unmaskedByte = payload[i] ^ maskingKey[i % 4];
+ unmaskedPayload.append(unmaskedByte);
+ }
+ return unmaskedPayload;
+}
+
+#define BYTETOBINARYPATTERN "%d%d%d%d%d%d%d%d"
+#define BYTETOBINARY(byte) \
+ (byte & 0x80 ? 1 : 0), \
+ (byte & 0x40 ? 1 : 0), \
+ (byte & 0x20 ? 1 : 0), \
+ (byte & 0x10 ? 1 : 0), \
+ (byte & 0x08 ? 1 : 0), \
+ (byte & 0x04 ? 1 : 0), \
+ (byte & 0x02 ? 1 : 0), \
+ (byte & 0x01 ? 1 : 0)
+
void InspectorServerRequestHandlerQt::webSocketReadyRead()
{
Q_ASSERT(m_tcpConnection);
@@ -336,38 +333,49 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead()
QByteArray content = m_tcpConnection->read(m_tcpConnection->bytesAvailable());
m_data.append(content);
while (m_data.size() > 0) {
- // first byte in websocket frame should be 0
- Q_ASSERT(!m_data[0]);
+ bool isMasked = m_data[1] & 0x80;
+ quint64 payloadLen = m_data[1] & 0x7F;
+ int pos = 2;
- // Start of WebSocket frame is indicated by 0
- if (m_data[0]) {
- qCritical() << "webSocketReadyRead: unknown frame type" << m_data[0];
- m_data.clear();
- m_tcpConnection->close();
- return;
+ if (payloadLen == 126) {
+ payloadLen = qFromBigEndian<quint16>(*reinterpret_cast<quint16*>(m_data.mid(pos, 2).data()));
+ pos = 4;
+ } else if (payloadLen == 127) {
+ payloadLen = qFromBigEndian<quint64>(*reinterpret_cast<quint64*>(m_data.mid(pos, 8).data()));
+ pos = 8;
}
- // End of WebSocket frame indicated by 0xff.
- int pos = m_data.indexOf(0xff, 1);
- if (pos < 1)
- return;
-
- // After above checks, length will be >= 0.
- size_t length = pos - 1;
- if (length <= 0)
- return;
-
- QByteArray payload = m_data.mid(1, length);
+ QByteArray payload;
+ if (isMasked) {
+ QByteArray maskingKey = m_data.mid(pos, 4);
+ pos += 4;
+ payload = applyMask(m_data.mid(pos, payloadLen), maskingKey);
+ } else {
+ payload = m_data.mid(pos, payloadLen);
+ }
+ // Handle fragmentation
+ if ((m_data[0] & 0x80) == 0) { // Non-last fragmented payload
+ m_fragmentedPayload.append(payload);
+
+ m_data = m_data.mid(pos + payloadLen);
+ continue;
+ } else {
+ if ((m_data[0] & 0x0F) == 0) { // Last fragment
+ m_fragmentedPayload.append(payload);
+ payload = m_fragmentedPayload;
+ m_fragmentedPayload.clear();
+ }
+ }
+
+ // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte).
+ m_data = m_data.mid(pos + payloadLen);
#if ENABLE(INSPECTOR)
if (m_inspectorClient) {
InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->d->page->inspectorController();
inspectorController->dispatchMessageFromFrontend(QString::fromUtf8(payload));
}
#endif
-
- // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte).
- m_data = m_data.mid(length + 2);
}
}
diff --git a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
index 922b63e..e1265b9 100644
--- a/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
+++ b/src/3rdparty/webkit/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h
@@ -83,7 +83,7 @@ public:
InspectorServerRequestHandlerQt(QTcpSocket *tcpConnection, InspectorServerQt *server);
virtual ~InspectorServerRequestHandlerQt();
- virtual int webSocketSend(QByteArray payload);
+ virtual int webSocketSend(const QString& message);
virtual int webSocketSend(const char *payload, size_t length);
private slots:
@@ -100,6 +100,7 @@ private:
int m_contentLength;
bool m_endOfHeaders;
QByteArray m_data;
+ QByteArray m_fragmentedPayload;
InspectorClientQt* m_inspectorClient;
void handleInspectorRequest(QStringList words);

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +0,0 @@
diff --git a/src/3rdparty/webkit/Source/WebCore/rendering/RenderFileUploadControl.cpp b/src/3rdparty/webkit/Source/WebCore/rendering/RenderFileUploadControl.cpp
index 87f6ff1..7d8f2d1 100644
--- a/src/3rdparty/webkit/Source/WebCore/rendering/RenderFileUploadControl.cpp
+++ b/src/3rdparty/webkit/Source/WebCore/rendering/RenderFileUploadControl.cpp
@@ -130,9 +130,6 @@ void RenderFileUploadControl::chooseIconForFiles(FileChooser* chooser, const Vec
void RenderFileUploadControl::click()
{
- // Requires a user gesture to open the file dialog.
- if (!frame() || !frame()->loader()->isProcessingUserGesture())
- return;
if (Chrome* chromePointer = chrome())
chromePointer->runOpenPanel(frame(), m_fileChooser);
}

View File

@ -1,16 +0,0 @@
--- a/configure 2011-03-29 22:16:21.000000000 -0700
+++ b/configure 2011-08-21 22:11:16.000000000 -0700
@@ -7160,13 +7160,6 @@ if [ "$CFG_GUI" = "no" ]; then
canBuildWebKit="no"
fi
-if [ "$CFG_SHARED" = "no" ]; then
- echo
- echo "WARNING: Using static linking will disable the WebKit module."
- echo
- canBuildWebKit="no"
-fi
-
CFG_CONCURRENT="yes"
if [ "$canBuildQtConcurrent" = "no" ]; then
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT"

View File

@ -1,19 +0,0 @@
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index ed9e9ce..ca35249 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1253,11 +1253,14 @@ void qt_init(QApplicationPrivate *priv, int)
[newDelegate setReflectionDelegate:oldDelegate];
[cocoaApp setDelegate:newDelegate];
+// https://bugreports.qt.nokia.com/browse/QTBUG-5952
QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader = [[QT_MANGLE_NAMESPACE(QCocoaMenuLoader) alloc] init];
if ([NSBundle loadNibNamed:@"qt_menu" owner:qtMenuLoader] == false) {
+#if 0
qFatal("Qt internal error: qt_menu.nib could not be loaded. The .nib file"
" should be placed in QtGui.framework/Versions/Current/Resources/ "
" or in the resources directory of your application bundle.");
+#endif
}
[cocoaApp setMenu:[qtMenuLoader menu]];

View File

@ -1,19 +0,0 @@
diff --git a/src/3rdparty/webkit/Source/WebCore/features.pri b/src/3rdparty/webkit/Source/WebCore/features.pri
index f04d0b4..5e4bfbe 100644
--- a/src/3rdparty/webkit/Source/WebCore/features.pri
+++ b/src/3rdparty/webkit/Source/WebCore/features.pri
@@ -163,10 +163,10 @@ symbian|maemo5|maemo6 {
DEFINES += ENABLE_VIDEO=0
mac:!contains(DEFINES, USE_QTMULTIMEDIA=1) {
- DEFINES -= ENABLE_VIDEO=0
- DEFINES += ENABLE_VIDEO=1
- DEFINES += WTF_USE_QTKIT=1
- DEFINES -= WTF_USE_QTKIT=0
+ # DEFINES -= ENABLE_VIDEO=0
+ # DEFINES += ENABLE_VIDEO=1
+ # DEFINES += WTF_USE_QTKIT=1
+ # DEFINES -= WTF_USE_QTKIT=0
} else: linux-*:!contains(DEFINES, USE_QTMULTIMEDIA=1) {
!contains(QT_CONFIG, no-pkg-config):system(pkg-config --exists glib-2.0 gio-2.0 gstreamer-0.10): {
DEFINES -= ENABLE_VIDEO=0