Unreviewed, rolling out r118752.
authorcaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 May 2012 11:37:41 +0000 (11:37 +0000)
committercaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 May 2012 11:37:41 +0000 (11:37 +0000)
http://trac.webkit.org/changeset/118752
https://bugs.webkit.org/show_bug.cgi?id=87731

incomplete patch (Requested by cmarcelo on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-05-29

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::didRelaunchProcess):
* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewPrivate):
* UIProcess/API/qt/tests/qmltests/WebView.pro:
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/qt/WebPageProxyQt.cpp:
* WebProcess/WebPage/WebPage.h:
(WebPage):
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/qt/WebPageQt.cpp:

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp

index 65db626..eaa5f13 100644 (file)
@@ -1,3 +1,25 @@
+2012-05-29  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r118752.
+        http://trac.webkit.org/changeset/118752
+        https://bugs.webkit.org/show_bug.cgi?id=87731
+
+        incomplete patch (Requested by cmarcelo on #webkit).
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::didRelaunchProcess):
+        * UIProcess/API/qt/qquickwebview_p.h:
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        (QQuickWebViewPrivate):
+        * UIProcess/API/qt/tests/qmltests/WebView.pro:
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * UIProcess/qt/WebPageProxyQt.cpp:
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage):
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/qt/WebPageQt.cpp:
+
 2012-05-21  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
 
         [Qt] [WK2] Allow user to inject JS scripts when the page loads
index 7f269e2..9d77171 100644 (file)
@@ -54,7 +54,6 @@
 #include <JavaScriptCore/JSBase.h>
 #include <JavaScriptCore/JSRetainPtr.h>
 #include <QDateTime>
-#include <QtCore/QFile>
 #include <QtQml/QJSValue>
 #include <WKOpenPanelResultListener.h>
 #include <WKSerializedScriptValue.h>
@@ -62,7 +61,6 @@
 #include <WebCore/IntRect.h>
 #include <wtf/Assertions.h>
 #include <wtf/MainThread.h>
-#include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
 using namespace WebCore;
@@ -454,7 +452,6 @@ void QQuickWebViewPrivate::didRelaunchProcess()
 
     webPageProxy->drawingArea()->setSize(viewSize(), IntSize());
     updateViewportSize();
-    updateUserScripts();
 }
 
 PassOwnPtr<DrawingAreaProxy> QQuickWebViewPrivate::createDrawingAreaProxy()
@@ -682,52 +679,6 @@ void QQuickWebViewPrivate::setNavigatorQtObjectEnabled(bool enabled)
     context->setNavigatorQtObjectEnabled(webPageProxy.get(), enabled);
 }
 
-static QString readUserScript(const QUrl& url)
-{
-    QString path;
-    if (url.isLocalFile())
-        path = url.toLocalFile();
-    else if (url.scheme() == QLatin1String("qrc"))
-        path = QStringLiteral(":") + url.path();
-    else {
-        qWarning("QQuickWebView: Couldn't open '%s' as user script because only file:/// and qrc:/// URLs are supported.", qPrintable(url.toString()));
-        return QString();
-    }
-
-    QFile file(path);
-    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
-        qWarning("QQuickWebView: Couldn't open '%s' as user script due to error '%s'.", qPrintable(url.toString()), qPrintable(file.errorString()));
-        return QString();
-    }
-
-    QString contents = QString::fromUtf8(file.readAll());
-    if (contents.isEmpty())
-        qWarning("QQuickWebView: Ignoring '%s' as user script because file is empty.", qPrintable(url.toString()));
-
-    return contents;
-}
-
-void QQuickWebViewPrivate::updateUserScripts()
-{
-    Vector<String> scripts;
-    scripts.reserveCapacity(userScripts.size());
-
-    for (unsigned i = 0; i < userScripts.size(); ++i) {
-        const QUrl& url = userScripts.at(i);
-        if (!url.isValid()) {
-            qWarning("QQuickWebView: Couldn't open '%s' as user script because URL is invalid.", qPrintable(url.toString()));
-            continue;
-        }
-
-        QString contents = readUserScript(url);
-        if (contents.isEmpty())
-            continue;
-        scripts.append(String(contents));
-    }
-
-    webPageProxy->setUserScripts(scripts);
-}
-
 QPointF QQuickWebViewPrivate::contentPos() const
 {
     Q_Q(const QQuickWebView);
@@ -1345,22 +1296,6 @@ void QQuickWebViewExperimental::evaluateJavaScript(const QString& script, const
     d_ptr->webPageProxy.get()->runJavaScriptInMainFrame(script, ScriptValueCallback::create(closure, javaScriptCallback));
 }
 
-QList<QUrl> QQuickWebViewExperimental::userScripts() const
-{
-    Q_D(const QQuickWebView);
-    return d->userScripts;
-}
-
-void QQuickWebViewExperimental::setUserScripts(const QList<QUrl>& userScripts)
-{
-    Q_D(QQuickWebView);
-    if (d->userScripts == userScripts)
-        return;
-    d->userScripts = userScripts;
-    d->updateUserScripts();
-    emit userScriptsChanged();
-}
-
 QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QQmlListProperty<QQuickUrlSchemeDelegate>* property, int index)
 {
     const QObjectList children = property->object->children();
index 770fccf..f33c6e6 100644 (file)
@@ -268,7 +268,6 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject {
     Q_PROPERTY(QQmlListProperty<QQuickUrlSchemeDelegate> urlSchemeDelegates READ schemeDelegates)
     Q_PROPERTY(QString userAgent READ userAgent WRITE setUserAgent NOTIFY userAgentChanged)
     Q_PROPERTY(double devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged)
-    Q_PROPERTY(QList<QUrl> userScripts READ userScripts WRITE setUserScripts NOTIFY userScriptsChanged)
     Q_ENUMS(NavigationRequestActionExperimental)
 
 public:
@@ -301,8 +300,6 @@ public:
     void setUserAgent(const QString& userAgent);
     double devicePixelRatio() const;
     void setDevicePixelRatio(double);
-    QList<QUrl> userScripts() const;
-    void setUserScripts(const QList<QUrl>& userScripts);
 
     QWebKitTest* test();
 
@@ -356,7 +353,6 @@ Q_SIGNALS:
     void devicePixelRatioChanged();
     void enterFullScreenRequested();
     void exitFullScreenRequested();
-    void userScriptsChanged();
 
 private:
     QQuickWebView* q_ptr;
index 29234a9..572a7f2 100644 (file)
@@ -124,7 +124,6 @@ public:
     bool renderToOffscreenBuffer() const { return m_renderToOffscreenBuffer; }
     bool transparentBackground() const;
     void setNavigatorQtObjectEnabled(bool);
-    void updateUserScripts();
 
     QPointF contentPos() const;
     void setContentPos(const QPointF&);
@@ -193,8 +192,6 @@ protected:
 
     WebCore::ViewportAttributes attributes;
 
-    QList<QUrl> userScripts;
-
     bool m_useDefaultContentItemSize;
     bool m_navigatorQtObjectEnabled;
     bool m_renderToOffscreenBuffer;
index fd940d4..5cc6f35 100644 (file)
@@ -16,5 +16,3 @@ DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\"
 OTHER_FILES += \
     WebView/* \
     common/*
-
-RESOURCES = resources.qrc
index 95e6c13..72d4695 100644 (file)
@@ -336,7 +336,6 @@ public:
     void authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password);
     void certificateVerificationRequest(const String& hostname, bool& ignoreErrors);
     void proxyAuthenticationRequiredRequest(const String& hostname, uint16_t port, const String& prefilledUsername, String& username, String& password);
-    void setUserScripts(const Vector<String>&);
 #endif // PLATFORM(QT).
 
 #if PLATFORM(QT)
index 5cafad5..ae3c4aa 100644 (file)
@@ -102,11 +102,6 @@ void WebPageProxy::sendApplicationSchemeReply(const QQuickNetworkReply* reply)
     }
 }
 
-void WebPageProxy::setUserScripts(const Vector<String>& scripts)
-{
-    process()->send(Messages::WebPage::SetUserScripts(scripts), m_pageID);
-}
-
 #if PLUGIN_ARCHITECTURE(X11)
 void WebPageProxy::createPluginContainer(uint64_t& windowID)
 {
index 3b7e6e6..4b2b76c 100644 (file)
@@ -523,7 +523,6 @@ public:
     void registerApplicationScheme(const String& scheme);
     void applicationSchemeReply(const QtNetworkReplyData&);
     void receivedApplicationSchemeRequest(const QNetworkRequest&, QtNetworkReply*);
-    void setUserScripts(const Vector<String>&);
 #endif
     void wheelEvent(const WebWheelEvent&);
 #if ENABLE(GESTURE_EVENTS)
index 899a2a9..4bab8ac 100644 (file)
@@ -68,7 +68,6 @@ messages -> WebPage {
 #if PLATFORM(QT)
     ApplicationSchemeReply(WebKit::QtNetworkReplyData reply)
     RegisterApplicationScheme(WTF::String scheme)
-    SetUserScripts(WTF::Vector<WTF::String> script)
 #endif
 
     StopLoadingFrame(uint64_t frameID)
index 2e90a73..4007198 100644 (file)
 #include "WebEvent.h"
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"
-#include <WebCore/DOMWrapperWorld.h>
 #include <WebCore/FocusController.h>
 #include <WebCore/Frame.h>
 #include <WebCore/KeyboardEvent.h>
 #include <WebCore/Page.h>
-#include <WebCore/PageGroup.h>
 #include <WebCore/PlatformKeyboardEvent.h>
 #include <WebCore/Range.h>
 #include <WebCore/Settings.h>
@@ -413,13 +411,4 @@ void WebPage::applicationSchemeReply(const QtNetworkReplyData& replyData)
     networkReply->finalize();
 }
 
-void WebPage::setUserScripts(const Vector<String>& scripts)
-{
-    // This works because we keep an unique page group for each Page.
-    PageGroup* pageGroup = PageGroup::pageGroup(this->pageGroup()->identifier());
-    pageGroup->removeUserScriptsFromWorld(mainThreadNormalWorld());
-    for (unsigned i = 0; i < scripts.size(); ++i)
-        pageGroup->addUserScriptToWorld(mainThreadNormalWorld(), scripts.at(i), KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInTopFrameOnly);
-}
-
 } // namespace WebKit