Bug 404320

Summary: WebHitTestResult incorrectly assumes every <a> element has 'href' attribute
Product: [Applications] Falkon Reporter: Eugene Shalygin <eugene.shalygin+bugzilla.kde>
Component: generalAssignee: David Rosca <nowrep>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: proposed patch

Description Eugene Shalygin 2019-02-14 05:30:47 UTC
SUMMARY
If <a> element does not have 'href' attribute, the JS script in WebHitTestResult generates an error: Uncaught TypeError: Cannot read property 'trim' of null.

Such <a> tags are widely used by Twine/Tweego story formats. Thus debugging such stories using Falkon is greatly complicated.

STEPS TO REPRODUCE
1. Create a HTML document with <a> element which does not have 'href' attribute (handles the link via a script, for example)
2. Open it in Falkon
3. Click the link.

OBSERVED RESULT

"TypeError: Cannot read property 'trim' of null." in the console log.


EXPECTED RESULT
No errors

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: git master
KDE Frameworks Version: git master
Qt Version: 5.12.1

ADDITIONAL INFORMATION

http://www.motoslave.net/tweego/
Comment 1 Eugene Shalygin 2019-02-14 05:46:46 UTC
Created attachment 118055 [details]
proposed patch
Comment 2 David Rosca 2019-02-14 07:54:10 UTC
Git commit b508ed2260a9fd9951a0b7536514be7ff2609ae3 by David Rosca.
Committed on 14/02/2019 at 07:44.
Pushed by drosca into branch 'master'.

WebHitTestResult: Expect null href attribute

Patch by Eugene Shalygin

M  +6    -3    src/lib/webengine/webhittestresult.cpp

https://commits.kde.org/falkon/b508ed2260a9fd9951a0b7536514be7ff2609ae3