aboutsummaryrefslogtreecommitdiff
path: root/development/phantomjs/patches/build-qt55-evaluateJavaScript.patch
diff options
context:
space:
mode:
authorHeinz Wiesinger <pprkut@slackbuilds.org>2021-11-20 20:24:27 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2021-11-22 09:10:20 +0700
commit80dde6cb9fb24583c26dc3fc1d2d6ce45de47771 (patch)
treed25d6c6d05a7ce4cbf735c5a2f7775b04dec83a0 /development/phantomjs/patches/build-qt55-evaluateJavaScript.patch
parent0b1d0630dade44cb8cbace138ec338bdffffe79c (diff)
development/phantomjs: Updated for version 2.1.1
Signed-off-by: Heinz Wiesinger <pprkut@slackbuilds.org> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'development/phantomjs/patches/build-qt55-evaluateJavaScript.patch')
-rw-r--r--development/phantomjs/patches/build-qt55-evaluateJavaScript.patch169
1 files changed, 169 insertions, 0 deletions
diff --git a/development/phantomjs/patches/build-qt55-evaluateJavaScript.patch b/development/phantomjs/patches/build-qt55-evaluateJavaScript.patch
new file mode 100644
index 0000000000000..ba1f5301d7b0c
--- /dev/null
+++ b/development/phantomjs/patches/build-qt55-evaluateJavaScript.patch
@@ -0,0 +1,169 @@
+Last-Update: 2016-02-15
+Forwarded: no
+Bug-Upstream: https://github.com/ariya/phantomjs/issues/13727
+Author: Ximin Luo <infinity0@debian.org>
+Reviewed-By: Dmitry Smirnov <onlyjob@debian.org>
+Description: Port to Qt 5.5
+ - Remove second argument to evaluateJavascript(), which was not really used
+ for anything, anyways
+
+--- a/src/utils.cpp
++++ b/src/utils.cpp
+@@ -37,8 +37,9 @@
+ #include <QDateTime>
+ #include <QDir>
+ #include <QtWebKitWidgets/QWebFrame>
+
++
+ static QString findScript(const QString& jsFilePath, const QString& libraryPath)
+ {
+ if (!jsFilePath.isEmpty()) {
+ QFile jsFile;
+@@ -131,9 +132,9 @@
+ }
+ return false;
+ }
+ // Execute JS code in the context of the document
+- targetFrame->evaluateJavaScript(scriptBody, QString(JAVASCRIPT_SOURCE_CODE_URL).arg(QFileInfo(scriptPath).fileName()));
++ targetFrame->evaluateJavaScript(scriptBody);
+ return true;
+ }
+
+ bool loadJSForDebug(const QString& jsFilePath, const QString& libraryPath, QWebFrame* targetFrame, const bool autorun)
+@@ -146,12 +147,12 @@
+ QString scriptPath = findScript(jsFilePath, libraryPath);
+ QString scriptBody = jsFromScriptFile(scriptPath, jsFileLanguage, jsFileEnc);
+
+ scriptBody = QString("function __run() {\n%1\n}").arg(scriptBody);
+- targetFrame->evaluateJavaScript(scriptBody, QString(JAVASCRIPT_SOURCE_CODE_URL).arg(QFileInfo(scriptPath).fileName()));
++ targetFrame->evaluateJavaScript(scriptBody);
+
+ if (autorun) {
+- targetFrame->evaluateJavaScript("__run()", QString());
++ targetFrame->evaluateJavaScript("__run()");
+ }
+
+ return true;
+ }
+--- a/src/repl.cpp
++++ b/src/repl.cpp
+@@ -146,9 +146,9 @@
+ // Set the static callback to offer Completions to the User
+ linenoiseSetCompletionCallback(REPL::offerCompletion);
+
+ // Inject REPL utility functions
+- m_webframe->evaluateJavaScript(Utils::readResourceFileUtf8(":/repl.js"), QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg("repl.js"));
++ m_webframe->evaluateJavaScript(Utils::readResourceFileUtf8(":/repl.js"));
+
+ // Add self to JavaScript world
+ m_webframe->addToJavaScriptWindowObject("_repl", this);
+
+@@ -183,10 +183,9 @@
+ // This will return an array of String with the possible completions
+ QStringList completions = REPL::getInstance()->m_webframe->evaluateJavaScript(
+ QString(JS_RETURN_POSSIBLE_COMPLETIONS).arg(
+ toInspect,
+- toComplete),
+- QString()
++ toComplete)
+ ).toStringList();
+
+ foreach(QString c, completions) {
+ if (lastIndexOfDot > -1) {
+@@ -209,9 +208,9 @@
+ if (userInput[0] != '\0') {
+ // Send the user input to the main Phantom frame for evaluation
+ m_webframe->evaluateJavaScript(
+ QString(JS_EVAL_USER_INPUT).arg(
+- QString(userInput).replace('"', "\\\"")), QString("phantomjs://repl-input"));
++ QString(userInput).replace('"', "\\\"")));
+
+ // Save command in the REPL history
+ linenoiseHistoryAdd(userInput);
+ linenoiseHistorySave(m_historyFilepath.data()); //< requires "char *"
+--- a/src/phantom.cpp
++++ b/src/phantom.cpp
+@@ -380,9 +380,9 @@
+ "require.cache['" + filename + "']._getRequire()," +
+ "require.cache['" + filename + "'].exports," +
+ "require.cache['" + filename + "']" +
+ "));";
+- m_page->mainFrame()->evaluateJavaScript(scriptSource, QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg(QFileInfo(filename).fileName()));
++ m_page->mainFrame()->evaluateJavaScript(scriptSource);
+ }
+
+ bool Phantom::injectJs(const QString& jsFilePath)
+ {
+@@ -477,10 +477,9 @@
+ m_page->mainFrame()->addToJavaScriptWindowObject("phantom", this);
+
+ // Bootstrap the PhantomJS scope
+ m_page->mainFrame()->evaluateJavaScript(
+- Utils::readResourceFileUtf8(":/bootstrap.js"),
+- QString(JAVASCRIPT_SOURCE_PLATFORM_URL).arg("bootstrap.js")
++ Utils::readResourceFileUtf8(":/bootstrap.js")
+ );
+ }
+
+ bool Phantom::setCookies(const QVariantList& cookies)
+--- a/src/config.cpp
++++ b/src/config.cpp
+@@ -176,9 +176,9 @@
+ QWebPage webPage;
+ // Add this object to the global scope
+ webPage.mainFrame()->addToJavaScriptWindowObject("config", this);
+ // Apply the JSON config settings to this very object
+- webPage.mainFrame()->evaluateJavaScript(configurator.arg(jsonConfig), QString());
++ webPage.mainFrame()->evaluateJavaScript(configurator.arg(jsonConfig));
+ }
+
+ QString Config::helpText() const
+ {
+--- a/src/webpage.cpp
++++ b/src/webpage.cpp
+@@ -752,10 +752,10 @@
+
+ qDebug() << "WebPage - evaluateJavaScript" << function;
+
+ evalResult = m_currentFrame->evaluateJavaScript(
+- function, //< function evaluated
+- QString("phantomjs://webpage.evaluate()")); //< reference source file
++ function //< function evaluated
++ );
+
+ qDebug() << "WebPage - evaluateJavaScript result" << evalResult;
+
+ return evalResult;
+@@ -925,9 +925,9 @@
+ networkOp = QNetworkAccessManager::DeleteOperation;
+ }
+
+ if (networkOp == QNetworkAccessManager::UnknownOperation) {
+- m_mainFrame->evaluateJavaScript("console.error('Unknown network operation: " + operation + "');", QString());
++ m_mainFrame->evaluateJavaScript("console.error('Unknown network operation: " + operation + "');");
+ return;
+ }
+
+ if (address == "about:blank") {
+@@ -1314,9 +1314,9 @@
+ return ret.toString();
+ }
+ }
+ }
+- frame->evaluateJavaScript("console.error('Bad header callback given, use phantom.callback);", QString());
++ frame->evaluateJavaScript("console.error('Bad header callback given, use phantom.callback);");
+ return QString();
+ }
+
+ QString WebPage::header(int page, int numPages)
+@@ -1353,9 +1353,9 @@
+ }
+
+ void WebPage::_appendScriptElement(const QString& scriptUrl)
+ {
+- m_currentFrame->evaluateJavaScript(QString(JS_APPEND_SCRIPT_ELEMENT).arg(scriptUrl), scriptUrl);
++ m_currentFrame->evaluateJavaScript(QString(JS_APPEND_SCRIPT_ELEMENT).arg(scriptUrl));
+ }
+
+ QObject* WebPage::_getGenericCallback()
+ {