зеркало из https://github.com/mozilla/gecko-dev.git
Bring back image blocking.
This commit is contained in:
Родитель
f6efaf2c06
Коммит
ca44975b7f
|
@ -188,17 +188,6 @@ function UpdateBackForwardButtons()
|
|||
}
|
||||
}
|
||||
|
||||
function UpdatePageReport(event)
|
||||
{
|
||||
if (!gReportButton)
|
||||
return;
|
||||
|
||||
if (gBrowser.mCurrentBrowser.pageReport)
|
||||
gReportButton.setAttribute("blocked", "true");
|
||||
else
|
||||
gReportButton.removeAttribute("blocked");
|
||||
}
|
||||
|
||||
function RegisterTabOpenObserver()
|
||||
{
|
||||
const observer = {
|
||||
|
@ -223,10 +212,7 @@ function Startup()
|
|||
gBrandBundle = document.getElementById("bundle_brand");
|
||||
gBrowser = document.getElementById("content");
|
||||
gURLBar = document.getElementById("urlbar");
|
||||
gReportButton = document.getElementById("page-report-button");
|
||||
|
||||
gBrowser.addEventListener("DOMUpdatePageReport", UpdatePageReport, false);
|
||||
|
||||
|
||||
var toolbox = document.getElementById("navigator-toolbox");
|
||||
toolbox.customizeDone = BrowserToolboxCustomizeDone;
|
||||
|
||||
|
@ -579,14 +565,8 @@ function updateGoMenu(goMenu)
|
|||
destroyGoMenuItems(goMenu);
|
||||
|
||||
var history = document.getElementById("hiddenHistoryTree");
|
||||
|
||||
if (history.hidden) {
|
||||
if (history.hidden)
|
||||
history.hidden = false;
|
||||
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
|
||||
.getService(Components.interfaces.nsIGlobalHistory);
|
||||
var dataSource = globalHistory.QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
history.database.AddDataSource(dataSource);
|
||||
}
|
||||
|
||||
if (!history.ref)
|
||||
history.ref = "NC:HistoryRoot";
|
||||
|
@ -3144,12 +3124,6 @@ function displayPageInfo()
|
|||
"dialog=no", null, "securityTab");
|
||||
}
|
||||
|
||||
function displayPageReport()
|
||||
{
|
||||
window.openDialog("chrome://browser/content/pageReport.xul", "_blank",
|
||||
"dialog=no");
|
||||
}
|
||||
|
||||
const mediatorContractId = "@mozilla.org/appshell/window-mediator;1";
|
||||
const nsIWebBrowserChrome = Components.interfaces.nsIWebBrowserChrome;
|
||||
|
||||
|
|
|
@ -321,6 +321,9 @@ Contributor(s):
|
|||
label="&setWallpaperCmd.label;"
|
||||
accesskey="&setWallpaperCmd.accesskey;"
|
||||
oncommand="gContextMenu.setWallpaper();"/>
|
||||
<menuitem id="context-blockimage"
|
||||
label="&blockImageCmd.label;" type="checkbox"
|
||||
oncommand="gContextMenu.toggleImageBlocking(!this.checked);"/>
|
||||
<menuitem id="context-back"
|
||||
label="&backCmd.label;"
|
||||
accesskey="&backCmd.accesskey;"
|
||||
|
|
|
@ -260,4 +260,6 @@
|
|||
|
||||
<!ENTITY findOnSearchBarCmd.label "Find in this Page">
|
||||
<!ENTITY currentDownloads.label "Current Downloads">
|
||||
<!ENTITY openDownloadsSidebar.commandkey "E">
|
||||
<!ENTITY openDownloadsSidebar.commandkey "E">
|
||||
|
||||
<!ENTITY blockImageCmd.label "Block images from this server">
|
|
@ -33,6 +33,7 @@
|
|||
| Currently, this code is relatively useless for any other purpose. In the |
|
||||
| longer term, this code will be restructured to make it more reusable. |
|
||||
------------------------------------------------------------------------------*/
|
||||
const IMAGEPERMISSION = 1;
|
||||
function nsContextMenu( xulMenu ) {
|
||||
this.target = null;
|
||||
this.menu = null;
|
||||
|
@ -100,7 +101,7 @@ nsContextMenu.prototype = {
|
|||
this.showItem( "context-reload", !( this.isTextSelected || this.onLink || this.onImage || this.onTextInput ) );
|
||||
|
||||
this.showItem( "context-stop", !( this.isTextSelected || this.onLink || this.onImage || this.onTextInput ) );
|
||||
this.showItem( "context-sep-stop", !( this.isTextSelected || this.onLink || this.onImage || this.onTextInput ) );
|
||||
this.showItem( "context-sep-stop", !( this.isTextSelected || this.onLink || this.onTextInput ) );
|
||||
|
||||
// XXX: Stop is determined in navigator.js; the canStop broadcaster is broken
|
||||
//this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
|
||||
|
@ -147,6 +148,11 @@ nsContextMenu.prototype = {
|
|||
this.showItem( "context-searchselect", this.isTextSelected );
|
||||
this.showItem( "frame", this.inFrame );
|
||||
this.showItem( "frame-sep", this.inFrame );
|
||||
this.showItem( "context-blockimage", this.onImage);
|
||||
if (this.onImage) {
|
||||
var blockImage = document.getElementById("context-blockimage");
|
||||
blockImage.checked = this.isImageBlocked();
|
||||
}
|
||||
},
|
||||
initClipboardItems : function () {
|
||||
|
||||
|
@ -527,6 +533,18 @@ nsContextMenu.prototype = {
|
|||
saveImage : function () {
|
||||
saveURL( this.imageURL, null, "SaveImageTitle", false );
|
||||
},
|
||||
toggleImageBlocking : function (aBlock) {
|
||||
var permissionmanager =
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager);
|
||||
permissionmanager.add(this.imageURL, !aBlock, IMAGEPERMISSION);
|
||||
},
|
||||
isImageBlocked : function() {
|
||||
var permissionmanager =
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager);
|
||||
return permissionmanager.testForBlocking(this.imageURL, IMAGEPERMISSION);
|
||||
},
|
||||
// Generate email address and put it on clipboard.
|
||||
copyEmail : function () {
|
||||
// Copy the comma-separated list of email addresses only.
|
||||
|
|
Загрузка…
Ссылка в новой задаче