diff --git a/examples/webenginewidgets/browser/browserapplication.cpp b/examples/webenginewidgets/browser/browserapplication.cpp
index 8961bf7fb7c7c4cb05f304a313b4b1a77f1d9fff..ca28b2d0bf4e71f986e5806b186f06ef6ca105b5 100644
--- a/examples/webenginewidgets/browser/browserapplication.cpp
+++ b/examples/webenginewidgets/browser/browserapplication.cpp
@@ -83,11 +83,11 @@ static void setUserStyleSheet(QWebEngineProfile *profile, const QString &styleSh
     Q_ASSERT(profile);
     QString scriptName(QStringLiteral("userStyleSheet"));
     QWebEngineScript script;
-    QList<QWebEngineScript> styleSheets = profile->scripts().findScripts(scriptName);
+    QList<QWebEngineScript> styleSheets = profile->scripts()->findScripts(scriptName);
     if (!styleSheets.isEmpty())
         script = styleSheets.first();
     Q_FOREACH (const QWebEngineScript &s, styleSheets)
-        profile->scripts().remove(s);
+        profile->scripts()->remove(s);
 
     if (script.isNull()) {
         script.setName(scriptName);
@@ -106,7 +106,7 @@ static void setUserStyleSheet(QWebEngineProfile *profile, const QString &styleSh
                                          "css.innerText = \"%1\";"\
                                          "})()").arg(styleSheet);
     script.setSourceCode(source);
-    profile->scripts().insert(script);
+    profile->scripts()->insert(script);
     // run the script on the already loaded views
     // this has to be deferred as it could mess with the storage initialization on startup
     if (mainWindow)
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
index 70357058752115d174a77361986671053dd7cc0f..7df044e66d55c2c9911e4f838053b18fbc5b96ea 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp
@@ -156,9 +156,9 @@ void QWebEngineDownloadItem::cancel()
     Returns the download item's id.
 */
 
-quint32 QWebEngineDownloadItem::id()
+quint32 QWebEngineDownloadItem::id() const
 {
-    Q_D(QWebEngineDownloadItem);
+    Q_D(const QWebEngineDownloadItem);
     return d->downloadId;
 }
 
@@ -205,9 +205,9 @@ quint32 QWebEngineDownloadItem::id()
     \sa QWebEngineDownloadItem::DownloadState
 */
 
-QWebEngineDownloadItem::DownloadState QWebEngineDownloadItem::state()
+QWebEngineDownloadItem::DownloadState QWebEngineDownloadItem::state() const
 {
-    Q_D(QWebEngineDownloadItem);
+    Q_D(const QWebEngineDownloadItem);
     return d->downloadState;
 }
 
@@ -217,9 +217,9 @@ QWebEngineDownloadItem::DownloadState QWebEngineDownloadItem::state()
     -1 means the size is unknown.
 */
 
-qint64 QWebEngineDownloadItem::totalBytes()
+qint64 QWebEngineDownloadItem::totalBytes() const
 {
-    Q_D(QWebEngineDownloadItem);
+    Q_D(const QWebEngineDownloadItem);
     return d->totalBytes;
 }
 
@@ -229,9 +229,9 @@ qint64 QWebEngineDownloadItem::totalBytes()
     -1 means the size is unknown.
 */
 
-qint64 QWebEngineDownloadItem::receivedBytes()
+qint64 QWebEngineDownloadItem::receivedBytes() const
 {
-    Q_D(QWebEngineDownloadItem);
+    Q_D(const QWebEngineDownloadItem);
     return d->receivedBytes;
 }
 
@@ -239,9 +239,9 @@ qint64 QWebEngineDownloadItem::receivedBytes()
     Returns the download's origin url.
 */
 
-QUrl QWebEngineDownloadItem::url()
+QUrl QWebEngineDownloadItem::url() const
 {
-    Q_D(QWebEngineDownloadItem);
+    Q_D(const QWebEngineDownloadItem);
     return d->downloadUrl;
 }
 
@@ -252,9 +252,9 @@ QUrl QWebEngineDownloadItem::url()
     and file name is deduced not to overwrite already existing files.
 */
 
-QString QWebEngineDownloadItem::path()
+QString QWebEngineDownloadItem::path() const
 {
-    Q_D(QWebEngineDownloadItem);
+    Q_D(const QWebEngineDownloadItem);
     return d->downloadPath;
 }
 
@@ -282,9 +282,9 @@ void QWebEngineDownloadItem::setPath(QString path)
     \sa finished(), state(),
 */
 
-bool QWebEngineDownloadItem::isFinished()
+bool QWebEngineDownloadItem::isFinished() const
 {
-    Q_D(QWebEngineDownloadItem);
+    Q_D(const QWebEngineDownloadItem);
     return d->downloadFinished;
 }
 
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h
index ee3ab221dd24da5feb5885bd24f84be51eb6404c..d362131f2a8dae204aca70611a896091042bdad0 100644
--- a/src/webenginewidgets/api/qwebenginedownloaditem.h
+++ b/src/webenginewidgets/api/qwebenginedownloaditem.h
@@ -61,14 +61,14 @@ public:
     };
     Q_ENUMS(DownloadState)
 
-    quint32 id();
-    DownloadState state();
-    qint64 totalBytes();
-    qint64 receivedBytes();
-    QUrl url();
-    QString path();
+    quint32 id() const;
+    DownloadState state() const;
+    qint64 totalBytes() const;
+    qint64 receivedBytes() const;
+    QUrl url() const;
+    QString path() const;
     void setPath(QString path);
-    bool isFinished();
+    bool isFinished() const;
 
 public Q_SLOTS:
     void accept();
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index adccfca2a061bbcff0b6d5e8d15c5ed0063ec7f5..2e5f685fd22b3d46dd6bf76be80953286a7996e9 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -103,8 +103,8 @@ using QtWebEngineCore::BrowserContextAdapter;
 */
 
 QWebEngineProfilePrivate::QWebEngineProfilePrivate(BrowserContextAdapter* browserContext)
-        : scriptCollection(new QWebEngineScriptCollectionPrivate(browserContext->userScriptController()))
-        , m_settings(new QWebEngineSettings())
+        : m_settings(new QWebEngineSettings())
+        , m_scriptCollection(new QWebEngineScriptCollection(new QWebEngineScriptCollectionPrivate(browserContext->userScriptController())))
         , m_browserContextRef(browserContext)
 {
     m_browserContextRef->addClient(this);
@@ -438,10 +438,10 @@ bool QWebEngineProfile::visitedLinksContainsUrl(const QUrl &url) const
     Returns the script collection used by this profile.
     \sa QWebEngineScriptCollection
 */
-QWebEngineScriptCollection &QWebEngineProfile::scripts()
+QWebEngineScriptCollection *QWebEngineProfile::scripts() const
 {
-    Q_D(QWebEngineProfile);
-    return d->scriptCollection;
+    Q_D(const QWebEngineProfile);
+    return d->m_scriptCollection.data();
 }
 
 /*!
diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h
index d65db24ab876b69c6478e3db12920051ae7b1c9d..4308fe75d9528d98fcf5657b3e486cdd973c34c3 100644
--- a/src/webenginewidgets/api/qwebengineprofile.h
+++ b/src/webenginewidgets/api/qwebengineprofile.h
@@ -98,7 +98,7 @@ public:
     bool visitedLinksContainsUrl(const QUrl &url) const;
 
     QWebEngineSettings *settings() const;
-    QWebEngineScriptCollection &scripts();
+    QWebEngineScriptCollection *scripts() const;
 
     static QWebEngineProfile *defaultProfile();
 
diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h
index b0bfc88b994a408170572cbb10ca7c72d3417e39..55941580dfbe8da02b76db4607131b43efe40176 100644
--- a/src/webenginewidgets/api/qwebengineprofile_p.h
+++ b/src/webenginewidgets/api/qwebengineprofile_p.h
@@ -43,6 +43,7 @@
 #include "qwebenginescriptcollection.h"
 #include <QMap>
 #include <QPointer>
+#include <QScopedPointer>
 
 namespace QtWebEngineCore {
 class BrowserContextAdapter;
@@ -72,10 +73,10 @@ public:
     void removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *);
     void clearUrlSchemeHandlers();
 
-    QWebEngineScriptCollection scriptCollection;
 private:
     QWebEngineProfile *q_ptr;
     QWebEngineSettings *m_settings;
+    QScopedPointer<QWebEngineScriptCollection> m_scriptCollection;
     QExplicitlySharedDataPointer<QtWebEngineCore::BrowserContextAdapter> m_browserContextRef;
     QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads;
     QMap<QByteArray, QPointer<QWebEngineUrlSchemeHandler> > m_urlSchemeHandlers;
diff --git a/src/webenginewidgets/api/qwebenginescriptcollection.h b/src/webenginewidgets/api/qwebenginescriptcollection.h
index 5ef9c55c797f83f4ff807b6ce3f705ac6dde3ed8..fe3ce28611db8c2beb172ea2f1b1fc90d7c927af 100644
--- a/src/webenginewidgets/api/qwebenginescriptcollection.h
+++ b/src/webenginewidgets/api/qwebenginescriptcollection.h
@@ -67,6 +67,7 @@ public:
     QList<QWebEngineScript> toList() const;
 
 private:
+    Q_DISABLE_COPY(QWebEngineScriptCollection)
     friend class QWebEnginePagePrivate;
     friend class QWebEngineProfilePrivate;
     QWebEngineScriptCollection(QWebEngineScriptCollectionPrivate *);