зеркало из https://github.com/mozilla/pjs.git
Bug 397695 - "Remove checkForChromelessWindow() code" [p=johnath r=gavin a1.9=mconnor]
This commit is contained in:
Родитель
4741abfe3c
Коммит
ddb625077f
|
@ -574,8 +574,5 @@ pref("accessibility.blockautorefresh", false);
|
|||
// import bookmarks.html into Places bookmarks
|
||||
pref("browser.places.importBookmarksHTML", true);
|
||||
|
||||
// Show infobar on chromeless windows
|
||||
pref("browser.warn_chromeless_window.infobar", false);
|
||||
|
||||
// if false, will add the "Places" folder to the personal toolbar
|
||||
pref("browser.places.createdDefaultQueries", false);
|
||||
|
|
|
@ -1204,10 +1204,6 @@ function delayedStartup()
|
|||
|
||||
// bookmark-all-tabs command
|
||||
gBookmarkAllTabsHandler = new BookmarkAllTabsHandler();
|
||||
|
||||
// Prevent chrome-spoofing popups from forging our chrome, by adding a
|
||||
// notification box entry in cases of chromeless popups.
|
||||
checkForChromelessWindow();
|
||||
}
|
||||
|
||||
function BrowserShutdown()
|
||||
|
@ -5578,87 +5574,6 @@ BookmarkAllTabsHandler.prototype = {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Check the chromehidden attribute to see if the toolbar is hidden. If so,
|
||||
* and if they haven't disabled the security.warn_chromeless_window.infobar
|
||||
* pref, show an infobar notification informing them of what's going on. This
|
||||
* helps fight chrome spoofing on popups. See bug 337344
|
||||
*/
|
||||
function checkForChromelessWindow() {
|
||||
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
// true by default
|
||||
if (!prefs.getBoolPref("browser.warn_chromeless_window.infobar"))
|
||||
return;
|
||||
|
||||
if (document.documentElement.getAttribute("chromehidden").indexOf("toolbar") != -1 ||
|
||||
document.documentElement.getAttribute("chromehidden").indexOf("location") != -1) {
|
||||
|
||||
var bundle_browser = document.getElementById("bundle_browser");
|
||||
|
||||
// It's possible that something in the window.content.opener.location.path
|
||||
// chain might be null. Rather than chaining a ton of 99% pass null checks,
|
||||
// though, let's try/catch in order to fail gracefully
|
||||
try {
|
||||
var messageString = bundle_browser.getFormattedString("chromelessWindow.warningMessage",
|
||||
[window.content.opener.location.host]);
|
||||
} catch (ex) {
|
||||
|
||||
// An exception here is not worth breaking our security warning, but is worth
|
||||
// logging, since it shouldn't happen.
|
||||
Components.utils.reportError(ex);
|
||||
messageString = bundle_browser.getString("chromelessWindow.warningNoLocation");
|
||||
|
||||
}
|
||||
|
||||
var notificationBox = gBrowser.getNotificationBox();
|
||||
var notificationName = "chromeless-info";
|
||||
if (notificationBox.getNotificationWithValue(notificationName)) {
|
||||
Components.utils.reportError("Already have a chromeless-info notification!")
|
||||
return;
|
||||
}
|
||||
|
||||
var buttons = [{
|
||||
label: bundle_browser.getString("chromelessWindow.showToolbarsButton"),
|
||||
accessKey: bundle_browser.getString("chromelessWindow.accessKey"),
|
||||
popup: null,
|
||||
callback: function() { return showToolbars(); }
|
||||
}];
|
||||
|
||||
notificationBox.appendNotification(messageString,
|
||||
notificationName,
|
||||
"chrome://browser/skin/Info.png",
|
||||
notificationBox.PRIORITY_INFO_HIGH,
|
||||
buttons);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for "Show Toolbars" button in chromeless window notification box.
|
||||
* Resets visibility of the go button stack and url bar, and wipes the
|
||||
* chromehidden document attribute.
|
||||
*/
|
||||
function showToolbars() {
|
||||
|
||||
// Unhide the chrome elements
|
||||
document.documentElement.removeAttribute("chromehidden");
|
||||
|
||||
// Undo the URLBar tweaks performed when the url bar was chromehidden
|
||||
if (gURLBar) {
|
||||
gURLBar.removeAttribute("readonly");
|
||||
gURLBar.setAttribute("enablehistory", "true");
|
||||
}
|
||||
|
||||
var goButtonStack = document.getElementById("go-button-stack");
|
||||
if (goButtonStack)
|
||||
goButtonStack.removeAttribute("hidden");
|
||||
|
||||
return false; // Dismiss the notification message
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility class to handle manipulations of the identity indicators in the UI
|
||||
*/
|
||||
|
|
|
@ -83,12 +83,6 @@ refreshBlocked.goButton.accesskey=A
|
|||
refreshBlocked.refreshLabel=%S prevented this page from automatically reloading.
|
||||
refreshBlocked.redirectLabel=%S prevented this page from automatically redirecting to another page.
|
||||
|
||||
# Chromeless popup handling
|
||||
chromelessWindow.warningMessage=The web site at %S has hidden your toolbars.
|
||||
chromelessWindow.warningNoLocation=This web site has hidden your toolbars.
|
||||
chromelessWindow.showToolbarsButton=Show Toolbars
|
||||
chromelessWindow.accessKey=S
|
||||
|
||||
# Star button
|
||||
starButtonOn.tooltip=Edit this bookmark
|
||||
starButtonOff.tooltip=Bookmark this page
|
||||
|
|
Загрузка…
Ссылка в новой задаче