Skip to content

Commit

Permalink
[qtmozembed] Detect error pages. Contributes to JB#47498
Browse files Browse the repository at this point in the history
  • Loading branch information
Marko Kenttala committed Nov 20, 2019
1 parent ddcf97d commit 29c585c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/qmozview_p.cpp
Expand Up @@ -41,6 +41,10 @@
using namespace mozilla;
using namespace mozilla::embedlite;

#define CONTENT_LOADED "chrome:contentloaded"
#define DOCURI_KEY "docuri"
#define ABOUT_URL_PREFIX "about:"

qint64 current_timestamp(QTouchEvent *aEvent)
{
if (aEvent) {
Expand Down Expand Up @@ -733,6 +737,12 @@ void QMozViewPrivate::RecvAsyncMessage(const char16_t *aMessage, const char16_t
ok = error.error == QJsonParseError::NoError;
QVariant vdata = doc.toVariant();

// Check docuri if this is an error page
if (message == CONTENT_LOADED && vdata.toMap().value(DOCURI_KEY).toString().startsWith(ABOUT_URL_PREFIX)) {
// Mark security invalid, not used in error pages
mSecurity.setSecurityRaw(NULL, 0);
}

if (ok) {
#ifdef DEVELOPMENT_BUILD
qCDebug(lcEmbedLiteExt) << "mesg:" << message.get() << ", data:" << data.get();
Expand Down

0 comments on commit 29c585c

Please sign in to comment.