diff options
| author | Nikhil Marathe <nsm.nikhil@gmail.com> | 2010-05-16 15:40:40 +0530 | 
|---|---|---|
| committer | Nikhil Marathe <nsm.nikhil@gmail.com> | 2010-05-16 15:41:43 +0530 | 
| commit | 720d51efb2db7fe36cb7f9177522feb0967e15ee (patch) | |
| tree | 742ae646bd928921abba2f08f712f9a6b951174c /src | |
| parent | SVN_SILENT made messages (.desktop file) (diff) | |
| download | rekonq-720d51efb2db7fe36cb7f9177522feb0967e15ee.tar.xz | |
Added support for javascript:<code> so that bookmarklets work
BUG: 227422
Diffstat (limited to 'src')
| -rw-r--r-- | src/protocolhandler.cpp | 14 | 
1 files changed, 12 insertions, 2 deletions
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index d710c24c..63bc640d 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -93,8 +93,18 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra      if (_url.protocol() == QL1S("javascript"))      {          QString scriptSource = _url.authority(); -        if(scriptSource.isEmpty()) -            return false; +        if(scriptSource.isEmpty()) { +            // if javascript:<code here> then authority() returns +            // an empty string. Extract the source manually +// Use the prettyUrl() since that is unencoded + +            // 11 is length of 'javascript:' +            // fromPercentEncoding() is used to decode all the % encoded +            // characters to normal, so that it is treated as valid javascript +            scriptSource = QUrl::fromPercentEncoding(_url.url().mid(11).toAscii()); +            if(scriptSource.isEmpty()) +                return false; +        }          QVariant result = frame->evaluateJavaScript(scriptSource);          return true;  | 
