Skip to content

Commit

Permalink
[QtWebEngine] Silence cppcheck warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Emdek committed Nov 28, 2019
1 parent 912c0ab commit 0597fb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/modules/backends/web/qtwebengine/QtWebEnginePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,19 +337,21 @@ QtWebEngineWebWidget* QtWebEnginePage::createWidget(SessionsManager::OpenHints h
return widget;
}

QString QtWebEnginePage::createJavaScriptList(QStringList rules) const
QString QtWebEnginePage::createJavaScriptList(const QStringList &rules) const
{
if (rules.isEmpty())
{
return {};
}

QStringList parsedRules(rules);

for (int i = 0; i < rules.count(); ++i)
{
rules[i].replace(QLatin1Char('\''), QLatin1String("\\'"));
parsedRules[i].replace(QLatin1Char('\''), QLatin1String("\\'"));
}

return QLatin1Char('\'') + rules.join(QLatin1String("','")) + QLatin1Char('\'');
return QLatin1Char('\'') + parsedRules.join(QLatin1String("','")) + QLatin1Char('\'');
}

QString QtWebEnginePage::createScriptSource(const QString &path, const QStringList &parameters) const
Expand Down
2 changes: 1 addition & 1 deletion src/modules/backends/web/qtwebengine/QtWebEnginePage.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class QtWebEnginePage final : public QWebEnginePage
void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString &note, int line, const QString &source) override;
QWebEnginePage* createWindow(WebWindowType type) override;
QtWebEngineWebWidget* createWidget(SessionsManager::OpenHints hints);
QString createJavaScriptList(QStringList rules) const;
QString createJavaScriptList(const QStringList &rules) const;
QStringList chooseFiles(FileSelectionMode mode, const QStringList &oldFiles, const QStringList &acceptedMimeTypes) override;
bool acceptNavigationRequest(const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) override;
bool javaScriptConfirm(const QUrl &url, const QString &message) override;
Expand Down

0 comments on commit 0597fb7

Please sign in to comment.