From a30c245da0129f7b0edd515e7ac94d124f7077c8 Mon Sep 17 00:00:00 2001 From: Philipp Kewisch Date: Wed, 2 Apr 2014 00:30:50 +0200 Subject: [PATCH] Bug 901332 - Google CalDAV OAuth2 authentication dialog not shown in SeaMonkey. r=Ratty a=Ratty CLOSED TREE --HG-- rename : mail/base/content/browserRequest.js => suite/mailnews/browserRequest.js rename : mail/base/content/browserRequest.xul => suite/mailnews/browserRequest.xul rename : mail/themes/osx/mail/browserRequest.css => suite/themes/classic/mac/messenger/browserRequest.css rename : mail/themes/windows/mail/browserRequest.css => suite/themes/classic/messenger/browserRequest.css rename : chat/themes/away-16.png => suite/themes/classic/messenger/icons/insecure.png rename : mail/themes/windows/mail/icons/loading.png => suite/themes/classic/messenger/icons/loading.png rename : chat/themes/available-16.png => suite/themes/classic/messenger/icons/secure.png rename : mail/themes/windows/mail/browserRequest.css => suite/themes/modern/messenger/browserRequest.css rename : chat/themes/away-16.png => suite/themes/modern/messenger/icons/insecure.png rename : mail/themes/linux/mail/icons/loading.png => suite/themes/modern/messenger/icons/loading.png rename : chat/themes/available-16.png => suite/themes/modern/messenger/icons/secure.png --- suite/mailnews/browserRequest.js | 113 ++++++++++++++++++ suite/mailnews/browserRequest.xul | 34 ++++++ suite/mailnews/jar.mn | 2 + suite/themes/classic/jar.mn | 5 + .../classic/mac/messenger/browserRequest.css | 60 ++++++++++ .../classic/messenger/browserRequest.css | 41 +++++++ .../classic/messenger/icons/insecure.png | Bin 0 -> 559 bytes .../classic/messenger/icons/loading.png | Bin 0 -> 10727 bytes .../themes/classic/messenger/icons/secure.png | Bin 0 -> 595 bytes suite/themes/modern/jar.mn | 4 + .../modern/messenger/browserRequest.css | 41 +++++++ .../modern/messenger/icons/insecure.png | Bin 0 -> 559 bytes .../themes/modern/messenger/icons/loading.png | Bin 0 -> 13906 bytes .../themes/modern/messenger/icons/secure.png | Bin 0 -> 595 bytes 14 files changed, 300 insertions(+) create mode 100644 suite/mailnews/browserRequest.js create mode 100644 suite/mailnews/browserRequest.xul create mode 100644 suite/themes/classic/mac/messenger/browserRequest.css create mode 100644 suite/themes/classic/messenger/browserRequest.css create mode 100644 suite/themes/classic/messenger/icons/insecure.png create mode 100644 suite/themes/classic/messenger/icons/loading.png create mode 100644 suite/themes/classic/messenger/icons/secure.png create mode 100644 suite/themes/modern/messenger/browserRequest.css create mode 100644 suite/themes/modern/messenger/icons/insecure.png create mode 100644 suite/themes/modern/messenger/icons/loading.png create mode 100644 suite/themes/modern/messenger/icons/secure.png diff --git a/suite/mailnews/browserRequest.js b/suite/mailnews/browserRequest.js new file mode 100644 index 0000000000..18782b9c74 --- /dev/null +++ b/suite/mailnews/browserRequest.js @@ -0,0 +1,113 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const wpl = Components.interfaces.nsIWebProgressListener; + +var reporterListener = { + _isBusy: false, + get securityButton() { + delete this.securityButton; + return this.securityButton = document.getElementById("security-button"); + }, + + QueryInterface: function(aIID) { + if (aIID.equals(Components.interfaces.nsIWebProgressListener) || + aIID.equals(Components.interfaces.nsISupportsWeakReference) || + aIID.equals(Components.interfaces.nsISupports)) + return this; + throw Components.results.NS_NOINTERFACE; + }, + + onStateChange: function(/*in nsIWebProgress*/ aWebProgress, + /*in nsIRequest*/ aRequest, + /*in unsigned long*/ aStateFlags, + /*in nsresult*/ aStatus) { + }, + + onProgressChange: function(/*in nsIWebProgress*/ aWebProgress, + /*in nsIRequest*/ aRequest, + /*in long*/ aCurSelfProgress, + /*in long */aMaxSelfProgress, + /*in long */aCurTotalProgress, + /*in long */aMaxTotalProgress) { + }, + + onLocationChange: function(/*in nsIWebProgress*/ aWebProgress, + /*in nsIRequest*/ aRequest, + /*in nsIURI*/ aLocation) { + document.getElementById("headerMessage").textContent = aLocation.spec; + }, + + onStatusChange: function(/*in nsIWebProgress*/ aWebProgress, + /*in nsIRequest*/ aRequest, + /*in nsresult*/ aStatus, + /*in wstring*/ aMessage) { + }, + + onSecurityChange: function(/*in nsIWebProgress*/ aWebProgress, + /*in nsIRequest*/ aRequest, + /*in unsigned long*/ aState) { + const wpl_security_bits = wpl.STATE_IS_SECURE | + wpl.STATE_IS_BROKEN | + wpl.STATE_IS_INSECURE | + wpl.STATE_SECURE_HIGH | + wpl.STATE_SECURE_MED | + wpl.STATE_SECURE_LOW; + var browser = document.getElementById("requestFrame"); + var level; + + switch (aState & wpl_security_bits) { + case wpl.STATE_IS_SECURE | wpl.STATE_SECURE_HIGH: + level = "high"; + break; + case wpl.STATE_IS_SECURE | wpl.STATE_SECURE_MED: + case wpl.STATE_IS_SECURE | wpl.STATE_SECURE_LOW: + level = "low"; + break; + case wpl.STATE_IS_BROKEN: + level = "broken"; + break; + } + if (level) { + this.securityButton.setAttribute("level", level); + this.securityButton.hidden = false; + } else { + this.securityButton.hidden = true; + this.securityButton.removeAttribute("level"); + } + this.securityButton.setAttribute("tooltiptext", + browser.securityUI.tooltipText); + } +} + +function cancelRequest() +{ + reportUserClosed(); + window.close(); +} + +function reportUserClosed() +{ + let request = window.arguments[0].wrappedJSObject; + request.cancelled(); +} + +function loadRequestedUrl() +{ + let request = window.arguments[0].wrappedJSObject; + document.getElementById("headerMessage").textContent = request.promptText; + let account = request.account; + if (request.iconURI != "") + document.getElementById("headerImage").src = request.iconURI; + + var browser = document.getElementById("requestFrame"); + browser.addProgressListener(reporterListener, + Components.interfaces.nsIWebProgress.NOTIFY_ALL); + var url = request.url; + if (url != "") { + browser.setAttribute("src", url); + document.getElementById("headerMessage").textContent = url; + } + request.loaded(window, browser.webProgress); +} diff --git a/suite/mailnews/browserRequest.xul b/suite/mailnews/browserRequest.xul new file mode 100644 index 0000000000..4ddd0ccab5 --- /dev/null +++ b/suite/mailnews/browserRequest.xul @@ -0,0 +1,34 @@ + + + + + + + + + +