2012-08-10 20:20:25 +00:00
|
|
|
/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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/. */
|
2011-07-13 19:17:31 +00:00
|
|
|
|
2011-11-17 21:21:25 +00:00
|
|
|
let Cc = Components.classes;
|
|
|
|
let Ci = Components.interfaces;
|
|
|
|
let Cu = Components.utils;
|
2011-07-13 19:17:31 +00:00
|
|
|
|
2013-06-19 23:30:53 +00:00
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this,
|
|
|
|
"LoginManagerContent", "resource://gre/modules/LoginManagerContent.jsm");
|
2013-08-05 18:22:59 +00:00
|
|
|
XPCOMUtils.defineLazyModuleGetter(this,
|
|
|
|
"InsecurePasswordUtils", "resource://gre/modules/InsecurePasswordUtils.jsm");
|
2013-06-19 23:30:53 +00:00
|
|
|
|
2011-07-13 19:17:31 +00:00
|
|
|
// Bug 671101 - directly using webNavigation in this context
|
|
|
|
// causes docshells to leak
|
2012-09-25 18:44:40 +00:00
|
|
|
this.__defineGetter__("webNavigation", function () {
|
2011-07-13 19:17:31 +00:00
|
|
|
return docShell.QueryInterface(Ci.nsIWebNavigation);
|
|
|
|
});
|
|
|
|
|
2011-07-19 10:50:36 +00:00
|
|
|
addMessageListener("WebNavigation:LoadURI", function (message) {
|
2011-07-13 19:17:31 +00:00
|
|
|
let flags = message.json.flags || webNavigation.LOAD_FLAGS_NONE;
|
|
|
|
|
|
|
|
webNavigation.loadURI(message.json.uri, flags, null, null, null);
|
|
|
|
});
|
2011-07-28 20:20:52 +00:00
|
|
|
|
|
|
|
addMessageListener("Browser:HideSessionRestoreButton", function (message) {
|
|
|
|
// Hide session restore button on about:home
|
|
|
|
let doc = content.document;
|
|
|
|
let container;
|
|
|
|
if (doc.documentURI.toLowerCase() == "about:home" &&
|
|
|
|
(container = doc.getElementById("sessionRestoreContainer"))){
|
|
|
|
container.hidden = true;
|
|
|
|
}
|
|
|
|
});
|
2013-06-19 23:30:53 +00:00
|
|
|
|
2013-07-26 21:26:22 +00:00
|
|
|
if (!Services.prefs.getBoolPref("browser.tabs.remote")) {
|
|
|
|
addEventListener("DOMContentLoaded", function(event) {
|
|
|
|
LoginManagerContent.onContentLoaded(event);
|
|
|
|
});
|
2013-08-05 18:22:59 +00:00
|
|
|
addEventListener("DOMFormHasPassword", function(event) {
|
|
|
|
InsecurePasswordUtils.checkForInsecurePasswords(event.target);
|
|
|
|
});
|
2013-07-26 21:26:22 +00:00
|
|
|
addEventListener("DOMAutoComplete", function(event) {
|
|
|
|
LoginManagerContent.onUsernameInput(event);
|
|
|
|
});
|
|
|
|
addEventListener("blur", function(event) {
|
|
|
|
LoginManagerContent.onUsernameInput(event);
|
|
|
|
});
|
|
|
|
}
|