diff --git a/src/debug_harness.html b/src/debug_harness.html
deleted file mode 100644
index 575faf62..00000000
--- a/src/debug_harness.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/debug_wrapper.js b/src/debug_wrapper.js
deleted file mode 100644
index fdbf904f..00000000
--- a/src/debug_wrapper.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// This is a wrapper for the script to be executed.
-// When remote debugging, there's no way to reload the page
-// to be able to run the script being debugged, because there's
-// no user-facing way to interact with phantomjs.
-// This provides a function wrapper around the script in order to
-// make the whole script callable from the console on the remote debugger.
-
-var __run = function() {
-
-%1
-
-};
\ No newline at end of file
diff --git a/src/phantomjs.qrc b/src/phantomjs.qrc
index 9b7dd378..33b35f0b 100644
--- a/src/phantomjs.qrc
+++ b/src/phantomjs.qrc
@@ -1,7 +1,6 @@
- debug_harness.html
- debug_wrapper.js
+ remote_debugger_harness.html
phantomjs-icon.png
coffee-script.js
usage.txt
diff --git a/src/remote_debugger_harness.html b/src/remote_debugger_harness.html
new file mode 100644
index 00000000..326ea7af
--- /dev/null
+++ b/src/remote_debugger_harness.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/utils.cpp b/src/utils.cpp
index 53b9aa1a..f0f30411 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -105,31 +105,12 @@ bool Utils::loadJSForDebug(const QString& jsFilePath, const QString& libraryPath
bool Utils::loadJSForDebug(const QString& jsFilePath, const Encoding& jsFileEnc, const QString& libraryPath, QWebFrame* targetFrame)
{
-
QString scriptPath = findScript(jsFilePath, libraryPath);
QString scriptBody = jsFromScriptFile(scriptPath, jsFileEnc);
- QFile wrapper(":/debug_wrapper.js");
- if (!wrapper.open(QIODevice::ReadOnly))
- return false; // We got big issues
- QString jsWrapper = QString::fromUtf8(wrapper.readAll());
- jsWrapper = jsWrapper.arg(scriptBody);
- m_tempWrapper = new QTemporaryFile(QDir::tempPath() + "/debugwrapper_XXXXXX.js");
- m_tempWrapper->open();
- m_tempWrapper->write(jsWrapper.toUtf8());
- m_tempWrapper->close();
-
- QFile f(":/debug_harness.html");
- if (!f.open(QIODevice::ReadOnly))
- return false;
- QString html = QString::fromUtf8(f.readAll());
-
- html = html.arg(m_tempWrapper->fileName());
- m_tempHarness = new QTemporaryFile(QDir::tempPath() + "/debugharness_XXXXXX.html");
- m_tempHarness->open();
- m_tempHarness->write(html.toLocal8Bit());
- m_tempHarness->close();
- targetFrame->load(QUrl::fromLocalFile(m_tempHarness->fileName()));
+ QString remoteDebuggerHarnessSrc = Utils::readResourceFileUtf8(":/remote_debugger_harness.html");
+ remoteDebuggerHarnessSrc = remoteDebuggerHarnessSrc.arg(scriptBody);
+ targetFrame->setHtml(remoteDebuggerHarnessSrc);
return true;
}
diff --git a/src/utils.h b/src/utils.h
index 2fe8f1bf..336b6f70 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -54,8 +54,8 @@ public:
static bool injectJsInFrame(const QString &jsFilePath, const Encoding &jsFileEnc, const QString &libraryPath, QWebFrame *targetFrame, const bool startingScript = false);
static QString readResourceFileUtf8(const QString &resourceFilePath);
- static bool loadJSForDebug(const QString &jsFilePath, const Encoding &jsFileEnc, const QString &libraryPath, QWebFrame *targetFrame, const bool startingScript = false);
- static bool loadJSForDebug(const QString &jsFilePath, const QString &libraryPath, QWebFrame *targetFrame, const bool startingScript = false);
+ static bool loadJSForDebug(const QString &jsFilePath, const Encoding &jsFileEnc, const QString &libraryPath, QWebFrame *targetFrame);
+ static bool loadJSForDebug(const QString &jsFilePath, const QString &libraryPath, QWebFrame *targetFrame);
static void cleanupFromDebug();
private:
static QString findScript(const QString &jsFilePath, const QString& libraryPath);