History

cleanup re-display of OAuthWebView

Stephen Birarda committed 12 years ago

Commit d9420541 parent 66077d55 files · +33 −5Browse files

Showing the changes to interface/src/ui/OAuthWebViewHandler.cpp (1 of 5 files). Show all

Unified · Split

interface/src/ui/OAuthWebViewHandler.cpp+16−2
@@ -21,7 +21,9 @@ OAuthWebViewHandler& OAuthWebViewHandler::getInstance() { · 20 unmodified lines
2121 }
2222
2323 OAuthWebViewHandler::OAuthWebViewHandler() :
24− _activeWebView(NULL)
24+ _activeWebView(NULL),
25+ _webViewRedisplayTimer(),
26+ _lastAuthorizationURL()
2527 {
2628
2729 }
@@ -41,7 +43,19 @@ void OAuthWebViewHandler::addHighFidelityRootCAToSSLConfig() { · 13 unmodified lines
4143 const int WEB_VIEW_REDISPLAY_ELAPSED_MSECS = 5 * 1000;
4244
4345 void OAuthWebViewHandler::displayWebviewForAuthorizationURL(const QUrl& authorizationURL) {
44− if (!_activeWebView && _webViewRedisplayTimer.elapsed() >= WEB_VIEW_REDISPLAY_ELAPSED_MSECS) {
46+ if (!_activeWebView) {
47+
48+ if (!_lastAuthorizationURL.isEmpty()) {
49+ if (_lastAuthorizationURL.host() == authorizationURL.host()
50+ && _webViewRedisplayTimer.elapsed() < WEB_VIEW_REDISPLAY_ELAPSED_MSECS) {
51+ // this would be re-displaying an OAuth dialog for the same auth URL inside of the redisplay ms
52+ // so return instead
53+ return;
54+ }
55+ }
56+
57+ _lastAuthorizationURL = authorizationURL;
58+
4559 _activeWebView = new QWebView;
4660
4761 // keep the window on top and delete it when it closes

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t