aboutsummaryrefslogtreecommitdiff
path: root/development/phantomjs/patches/build-qt55-evaluateJavaScript.patch
blob: ba1f5301d7b0ca5d5b9e4bae45a03a9a9f796d48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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()
 {