[Qt] Fix WebProcess crash on Mac when accessing a site with video tag.
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Jul 2012 16:31:10 +0000 (16:31 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Jul 2012 16:31:10 +0000 (16:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90384

Reviewed by Jocelyn Turcotte.

We need to initialize the private symbols used by MediaPlayerPrivateQTKit
otherwise they will be null and it will lead to a crash. We copy WebSystemInterface
files for WK2 just like the Mac port as WK2 may have different needs than WK1 layer (we
may add or remove symbols in here). It doesn't fix the video rendering yet but it's
first step.

* Target.pri:
* WebProcess/WebCoreSupport/qt/WebSystemInterface.h: Added.
* WebProcess/WebCoreSupport/qt/WebSystemInterface.mm: Added.
(InitWebCoreSystemInterfaceForWK2):
* WebProcess/qt/WebProcessMainQt.cpp:
(WebKit::WebProcessMainQt):

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

Source/WebKit2/ChangeLog
Source/WebKit2/Target.pri
Source/WebKit2/WebProcess/WebCoreSupport/qt/WebSystemInterface.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebCoreSupport/qt/WebSystemInterface.mm [new file with mode: 0644]
Source/WebKit2/WebProcess/qt/WebProcessMainQt.cpp

index 211cfa3..07cb39a 100644 (file)
@@ -1,3 +1,23 @@
+2012-07-02  Alexis Menard  <alexis.menard@openbossa.org>
+
+        [Qt] Fix WebProcess crash on Mac when accessing a site with video tag.
+        https://bugs.webkit.org/show_bug.cgi?id=90384
+
+        Reviewed by Jocelyn Turcotte.
+
+        We need to initialize the private symbols used by MediaPlayerPrivateQTKit
+        otherwise they will be null and it will lead to a crash. We copy WebSystemInterface
+        files for WK2 just like the Mac port as WK2 may have different needs than WK1 layer (we
+        may add or remove symbols in here). It doesn't fix the video rendering yet but it's
+        first step.
+
+        * Target.pri:
+        * WebProcess/WebCoreSupport/qt/WebSystemInterface.h: Added.
+        * WebProcess/WebCoreSupport/qt/WebSystemInterface.mm: Added.
+        (InitWebCoreSystemInterfaceForWK2):
+        * WebProcess/qt/WebProcessMainQt.cpp:
+        (WebKit::WebProcessMainQt):
+
 2012-07-02  Sudarsana Nagineni  <sudarsana.nagineni@linux.intel.com>
 
         [EFL] [WK2] Remove content sniffer and decoder initialization from WebProcess
index 2700582..4e86026 100644 (file)
@@ -771,6 +771,16 @@ SOURCES += \
     WebProcess/qt/WebProcessQt.cpp
 
 mac: {
+
+    contains(DEFINES, WTF_USE_QTKIT=1) {
+        DEFINES += NSGEOMETRY_TYPES_SAME_AS_CGGEOMETRY_TYPES
+        INCLUDEPATH += \
+            $$PWD/../../WebKitLibraries/
+        HEADERS += \
+            WebProcess/WebCoreSupport/qt/WebSystemInterface.h
+        SOURCES += \
+            WebProcess/WebCoreSupport/qt/WebSystemInterface.mm
+    }
     INCLUDEPATH += \
         Platform/mac \
         Platform/CoreIPC/mac
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebSystemInterface.h b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebSystemInterface.h
new file mode 100644 (file)
index 0000000..eec0cbb
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2006 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.
+ */
+
+#include <stdint.h>
+
+void InitWebCoreSystemInterfaceForWK2();
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/qt/WebSystemInterface.mm
new file mode 100644 (file)
index 0000000..1a0c0f6
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2006, 2007, 2008, 2009, 2010 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. 
+ * 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 "WebSystemInterface.h"
+
+// Needed for builds not using PCH to expose BUILDING_ macros, see bug 32753.
+#include <wtf/Platform.h>
+
+#import <WebCoreSystemInterface.h>
+#import <WebKitSystemInterface.h>
+
+#define INIT(function) wk##function = WK##function
+
+void InitWebCoreSystemInterfaceForWK2(void)
+{
+    static bool didInit;
+    if (didInit)
+        return;
+
+    INIT(QTIncludeOnlyModernMediaFileTypes);
+    INIT(QTMovieDataRate);
+    INIT(QTMovieDisableComponent);
+    INIT(QTMovieMaxTimeLoaded);
+    INIT(QTMovieMaxTimeLoadedChangeNotification);
+    INIT(QTMovieMaxTimeSeekable);
+    INIT(QTMovieGetType);
+    INIT(QTMovieHasClosedCaptions);
+    INIT(QTMovieResolvedURL);
+    INIT(QTMovieSetShowClosedCaptions);
+    INIT(QTMovieSelectPreferredAlternates);
+    INIT(QTMovieViewSetDrawSynchronously);
+    INIT(QTGetSitesInMediaDownloadCache);
+    INIT(QTClearMediaDownloadCacheForSite);
+    INIT(QTClearMediaDownloadCache);
+    INIT(CreateMediaUIBackgroundView);
+    INIT(CreateMediaUIControl);
+    INIT(WindowSetAlpha);
+    INIT(WindowSetScaledFrame);
+
+    didInit = true;
+}
index 99eb681..cb72cb9 100644 (file)
@@ -40,6 +40,9 @@
 #if USE(ACCELERATED_COMPOSITING)
 #include "WebGraphicsLayer.h"
 #endif
+#if USE(QTKIT)
+#include "WebSystemInterface.h"
+#endif
 
 #ifndef NDEBUG
 #if !OS(WINDOWS)
@@ -148,6 +151,10 @@ Q_DECL_EXPORT int WebProcessMainQt(QGuiApplication* app)
     JSC::initializeThreading();
     WTF::initializeMainThread();
     RunLoop::initializeMainRunLoop();
+    
+#if USE(QTKIT)
+    InitWebCoreSystemInterfaceForWK2();
+#endif
 
     // Create the connection.
     if (app->arguments().size() <= 1) {