Skip to content

Commit 0ee5963

Browse files
committed
better output-inserting routines
1 parent 395d78a commit 0ee5963

File tree

5 files changed

+18
-27
lines changed

5 files changed

+18
-27
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ The following compile-time variable can tighten further the security of PEB.
144144
* Perl 5 distribution - any Linux, Mac or Windows Perl distribution.
145145

146146
Tested successfully using the following Perl distributions:
147-
Linux x64 [Perlbrew](https://perlbrew.pl/) Perl versions 5.18.4, 5.23.7
148-
Linux x64 [Relocatable Perl](https://github.com/skaji/relocatable-perl) version 5.24.1
149-
Windows x32 [Strawberry Perl](http://strawberryperl.com/) PortableZIP versions 5.12.2.0, 5.16.1.1, 5.20.2.1
147+
Linux 64-bit [Perlbrew](https://perlbrew.pl/) Perl versions 5.18.4, 5.23.7
148+
Linux 64-bit [Relocatable Perl](https://github.com/skaji/relocatable-perl) version 5.24.1
149+
Windows 32-bit [Strawberry Perl](http://strawberryperl.com/) PortableZIP versions 5.12.2.0, 5.16.1.1, 5.20.2.1
150150

151151
To use a Perlbrew Perl with PEB create a symlink to the wanted Perl interpreter named:
152152
``{PEB_binary_directory}/perl/bin/perl``

REQUIREMENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ If you are using the Qt Creator IDE, go to 'Projects' and disable the 'Shadow Bu
2828
* Perl 5 distribution - any Linux, Mac or Windows Perl distribution.
2929

3030
Tested successfully using the following Perl distributions:
31-
Linux x64 [Perlbrew](https://perlbrew.pl/) Perl versions 5.18.4, 5.23.7
32-
Linux x64 [Relocatable Perl](https://github.com/skaji/relocatable-perl) version 5.24.1
33-
Windows x32 [Strawberry Perl](http://strawberryperl.com/) PortableZIP versions 5.12.2.0, 5.16.1.1, 5.20.2.1
31+
Linux 64-bit [Perlbrew](https://perlbrew.pl/) Perl versions 5.18.4, 5.23.7
32+
Linux 64-bit [Relocatable Perl](https://github.com/skaji/relocatable-perl) version 5.24.1
33+
Windows 32-bit [Strawberry Perl](http://strawberryperl.com/) PortableZIP versions 5.12.2.0, 5.16.1.1, 5.20.2.1
3434

3535
To use a Perlbrew Perl with PEB create a symlink to the wanted Perl interpreter named:
3636
``{PEB_binary_directory}/perl/bin/perl``

src/page.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,5 @@ QPage::QPage()
140140
QObject::connect(this, SIGNAL(frameCreated(QWebFrame *)),
141141
this, SLOT(qFrameCustomizerSlot(QWebFrame *)));
142142

143-
lastTargetFrame = currentFrame();
144143
windowCloseRequested = false;
145144
}

src/page.h

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public slots:
5454
{
5555
if (ok) {
5656
emit changeTitleSignal();
57-
qJavaScriptInjector(QPage::mainFrame());
5857
}
5958
}
6059

@@ -113,9 +112,9 @@ public slots:
113112
if (stdoutTarget.length() > 0) {
114113
qOutputInserter(output, stdoutTarget);
115114
} else {
116-
lastTargetFrame->setHtml(output,
117-
QUrl(qApp->property("pseudoDomain")
118-
.toString()));
115+
currentFrame()->setHtml(output,
116+
QUrl(qApp->property("pseudoDomain")
117+
.toString()));
119118
}
120119
}
121120

@@ -177,6 +176,8 @@ public slots:
177176

178177
void qOutputInserter(QString stdoutData, QString stdoutTarget)
179178
{
179+
qJavaScriptInjector(currentFrame());
180+
180181
QString outputInsertionJavaScript =
181182
"pebOutputInsertion(\"" +
182183
stdoutData +
@@ -363,13 +364,8 @@ public slots:
363364
}
364365

365366
// ==============================
366-
// JavaScript-injecting routines:
367+
// JavaScript-injecting routine:
367368
// ==============================
368-
void qFrameCustomizerSlot(QWebFrame *frame)
369-
{
370-
qJavaScriptInjector(frame);
371-
}
372-
373369
void qJavaScriptInjector(QWebFrame *frame)
374370
{
375371
QFileReader *resourceReader =
@@ -544,8 +540,6 @@ public slots:
544540

545541
if (request.url().authority() ==
546542
qApp->property("pseudoDomain").toString()) {
547-
lastTargetFrame = frame;
548-
549543
if (pageStatus == "trusted") {
550544
// ==============================
551545
// User selected single file:
@@ -812,8 +806,6 @@ public slots:
812806
}
813807

814808
private:
815-
QWebFrame *lastTargetFrame;
816-
817809
QString pageStatus;
818810
QRegExp htmlFileNameExtensionMarker;
819811
QString emptyString;

src/script-handler.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ public slots:
4747
scriptAccumulatedOutput.append(output);
4848

4949
qDebug() << QDateTime::currentMSecsSinceEpoch()
50-
<< "msecs from epoch: output from" << scriptFullFilePath;
50+
<< "msecs from epoch: output from" << scriptFullFilePath;
5151

5252
// Handling 'script closed' confirmation:
5353
if (output == scriptCloseConfirmation) {
5454
qDebug() << QDateTime::currentMSecsSinceEpoch()
55-
<< "msecs from epoch:"
56-
<< "interactive script terminated normally:"
57-
<< scriptFullFilePath;
55+
<< "msecs from epoch:"
56+
<< "interactive script terminated normally:"
57+
<< scriptFullFilePath;
5858
} else {
5959
if (scriptStdoutTarget.length() > 0) {
6060
emit displayScriptOutputSignal(output, scriptStdoutTarget);
@@ -69,7 +69,7 @@ public slots:
6969
scriptAccumulatedErrors.append("\n");
7070

7171
qDebug() << QDateTime::currentMSecsSinceEpoch()
72-
<< "msecs from epoch: errors from" << scriptFullFilePath;
72+
<< "msecs from epoch: errors from" << scriptFullFilePath;
7373
// qDebug() << "Script errors:" << scriptErrors;
7474
}
7575

@@ -84,7 +84,7 @@ public slots:
8484
scriptProcess.close();
8585

8686
qDebug() << QDateTime::currentMSecsSinceEpoch()
87-
<< "msecs from epoch: script finished:" << scriptFullFilePath;
87+
<< "msecs from epoch: script finished:" << scriptFullFilePath;
8888
}
8989

9090
void qRootPasswordTimeoutSlot()

0 commit comments

Comments
 (0)