<table><tr><td style="">marten created this revision.<br />marten added reviewers: Frameworks, dfaure.<br />Herald added a project: Frameworks.<br />Herald added a subscriber: kde-frameworks-devel.<br />marten requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D28647">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>I've been looking at porting Konqueror's User Agent Changer plugin to current KF5. The GUI is ported and working, but trying to change the user agent more than once in any given invocation of the browser does not seem to work.</p>
<p>After changing the user agent string in kio_httprc, the plugin calls KIO::Scheduler::emitReparseSlaveConfiguration() to inform all running ioslaves of the change. This first of all calls slotReparseSlaveConfiguration() directly to update in the current process, and then sets m_ignoreConfigReparse to true and emits the reparseSlaveConfiguration() signal. The signal calls slotReparseSlaveConfiguration() via DBus; when activated in the same process slotReparseSlaveConfiguration() ignores the signal because m_ignoreConfigReparse is set, it is reset to false and simply returns.</p>
<p>However, it appears that the signal does not get looped back to the current process; in other words, slotReparseSlaveConfiguration() is not called via the DBus signal. This means that m_ignoreConfigReparse is never reset to false and, the next time that KIO::Scheduler::emitReparseSlaveConfiguration() is called it has no effect. This can be confirmed by uncommenting the "Ignoring signal sent by myself" debug line in slotReparseSlaveConfiguration(), the message is never printed.</p>
<p>The change fixes this by explicitly setting m_ignoreConfigReparse to false before the direct call of slotReparseSlaveConfiguration(), then to true before the DBus call. This inhibits the loopback signal in case it does happen, but ensures that the direct call is not ignored.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Tested with <a href="https://kluge.in-chemnitz.de/tools/browser.php" class="remarkup-link" target="_blank" rel="noreferrer">https://kluge.in-chemnitz.de/tools/browser.php</a> to show the user agent as sent.<br />
Observed that, with this fix, the user agent can be changed as many times as required.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D28647">https://phabricator.kde.org/D28647</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/core/scheduler.cpp</div></div></div><br /><div><strong>To: </strong>marten, Frameworks, dfaure<br /><strong>Cc: </strong>kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns<br /></div>