1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
/* 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/. */
var { MailE10SUtils } = ChromeUtils.import(
"resource:///modules/MailE10SUtils.jsm"
);
/* Magic global things the <browser> and its entourage of logic expect. */
var PopupNotifications = {
show(browser, id, message) {
console.warn(
"Not showing popup notification",
id,
"with the message",
message
);
},
};
var gBrowser = {
get selectedBrowser() {
return document.getElementById("requestFrame");
},
_getAndMaybeCreateDateTimePickerPanel() {
return this.selectedBrowser.dateTimePicker;
},
get webNavigation() {
return this.selectedBrowser.webNavigation;
},
};
function getBrowser() {
return gBrowser.selectedBrowser;
}
/* Logic to actually run the login process and window contents */
var reporterListener = {
_isBusy: false,
QueryInterface: ChromeUtils.generateQI([
"nsIWebProgressListener",
"nsISupportsWeakReference",
]),
onStateChange(
/* in nsIWebProgress*/ aWebProgress,
/* in nsIRequest*/ aRequest,
/* in unsigned long*/ aStateFlags,
/* in nsresult*/ aStatus
) {},
onProgressChange(
/* in nsIWebProgress*/ aWebProgress,
/* in nsIRequest*/ aRequest,
/* in long*/ aCurSelfProgress,
/* in long */ aMaxSelfProgress,
/* in long */ aCurTotalProgress,
/* in long */ aMaxTotalProgress
) {},
onLocationChange(
/* in nsIWebProgress*/ aWebProgress,
/* in nsIRequest*/ aRequest,
/* in nsIURI*/ aLocation
) {
document.getElementById("headerMessage").value = aLocation.spec;
},
onStatusChange(
/* in nsIWebProgress*/ aWebProgress,
/* in nsIRequest*/ aRequest,
/* in nsresult*/ aStatus,
/* in wstring*/ aMessage
) {},
onSecurityChange(
/* in nsIWebProgress*/ aWebProgress,
/* in nsIRequest*/ aRequest,
/* in unsigned long*/ aState
) {
const wpl_security_bits =
Ci.nsIWebProgressListener.STATE_IS_SECURE |
Ci.nsIWebProgressListener.STATE_IS_BROKEN |
Ci.nsIWebProgressListener.STATE_IS_INSECURE;
let icon = document.getElementById("security-icon");
switch (aState & wpl_security_bits) {
case Ci.nsIWebProgressListener.STATE_IS_SECURE:
icon.setAttribute(
"src",
"chrome://messenger/skin/icons/connection-secure.svg"
);
// Set alt.
document.l10n.setAttributes(icon, "content-tab-security-high-icon");
icon.classList.add("secure-connection-icon");
break;
case Ci.nsIWebProgressListener.STATE_IS_BROKEN:
icon.setAttribute(
"src",
"chrome://messenger/skin/icons/connection-insecure.svg"
);
document.l10n.setAttributes(icon, "content-tab-security-broken-icon");
icon.classList.remove("secure-connection-icon");
break;
default:
icon.removeAttribute("src");
icon.removeAttribute("data-l10n-id");
icon.removeAttribute("alt");
icon.classList.remove("secure-connection-icon");
break;
}
},
onContentBlockingEvent(
/* in nsIWebProgress*/ aWebProgress,
/* in nsIRequest*/ aRequest,
/* in unsigned long*/ aEvent
) {},
};
function cancelRequest() {
reportUserClosed();
window.close();
}
function reportUserClosed() {
let request = window.arguments[0].wrappedJSObject;
request.cancelled();
}
function loadRequestedUrl() {
let request = window.arguments[0].wrappedJSObject;
var browser = document.getElementById("requestFrame");
browser.addProgressListener(reporterListener, Ci.nsIWebProgress.NOTIFY_ALL);
var url = request.url;
if (url == "") {
document.getElementById("headerMessage").value = request.promptText;
} else {
MailE10SUtils.loadURI(browser, url);
document.getElementById("headerMessage").value = url;
}
request.loaded(window, browser.webProgress);
}
|