зеркало из https://github.com/mozilla/gecko-dev.git
bug 176624 - popup blocking. r=danm, sr=jag
This commit is contained in:
Родитель
8b867b0fd2
Коммит
29d3b3668b
|
@ -40,14 +40,12 @@
|
|||
label="&images.label;"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
<!--
|
||||
<treeitem position="3">
|
||||
<treerow>
|
||||
<treecell url="chrome://cookie/content/pref-popups.xul"
|
||||
label="&popups.label;"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
-->
|
||||
</treechildren>
|
||||
|
||||
</overlay>
|
||||
|
|
|
@ -48,69 +48,143 @@
|
|||
onload="init()"
|
||||
headertitle="&title;">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://cookie/content/cookieOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://cookie-/content/cookieOverlay.js"/>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
var _elementIDs = ["popupPolicy","popupCustom"];
|
||||
var domCbox = null;
|
||||
var policyButton;
|
||||
var customCbox;
|
||||
var manageButton;
|
||||
|
||||
var _elementIDs = ["popupPolicy","playSound","playSoundUrl","displayIcon"];
|
||||
|
||||
var gPolicyButton;
|
||||
var gSoundCheckbox;
|
||||
var gSoundUrlBox;
|
||||
var gSoundUrlButton;
|
||||
var gIconCheckbox;
|
||||
|
||||
const POPUP_TYPE = 2;
|
||||
|
||||
function init() {
|
||||
parent.initPanel('chrome://cookie/content/pref-popups.xul');
|
||||
policyButton = document.getElementById("popupPolicy");
|
||||
customCbox = document.getElementById("popupCustom");
|
||||
manageButton = document.getElementById("popupView");
|
||||
setButtons(true);
|
||||
parent.initPanel("chrome://cookie/content/pref-popups.xul");
|
||||
|
||||
gPolicyButton = document.getElementById("popupPolicy");
|
||||
gSoundCheckbox = document.getElementById("playSound");
|
||||
gSoundUrlBox = document.getElementById("playSoundUrl");
|
||||
gSoundUrlButton = document.getElementById("selectSound");
|
||||
gIconCheckbox = document.getElementById("displayIcon");
|
||||
|
||||
setButtons();
|
||||
}
|
||||
function setButtons(all) {
|
||||
if (all)
|
||||
customCbox.disabled = policyButton.value == 2;
|
||||
manageButton.disabled = policyButton.value == 2 || !customCbox.checked;
|
||||
|
||||
function blacklistEmpty() {
|
||||
var permissionmanager = Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager);
|
||||
|
||||
var popupManager = Components.classes["@mozilla.org/PopupWindowManager;1"]
|
||||
.getService(Components.interfaces.nsIPopupWindowManager);
|
||||
var enumerator = popupManager.getEnumerator();
|
||||
|
||||
while (enumerator.hasMoreElements()) {
|
||||
var permission = enumerator.getNext()
|
||||
.QueryInterface(Components.interfaces.nsIPermission);
|
||||
if (!permission.capability)
|
||||
return false;
|
||||
}
|
||||
function selectPolicy() {
|
||||
if (!domCbox) {
|
||||
// any selection clears the competing DOM pref
|
||||
domCbox = document.getElementById("popupDomShadow");
|
||||
_elementIDs.push("popupDomShadow");
|
||||
domCbox.checked = false;
|
||||
return true;
|
||||
}
|
||||
setButtons(true);
|
||||
|
||||
function setButtons() {
|
||||
var exceptionsAllow = document.getElementById("exceptionsAllow");
|
||||
var exceptionsBlock = document.getElementById("exceptionsBlock");
|
||||
|
||||
exceptionsAllow.disabled = (gPolicyButton.value == "true");
|
||||
exceptionsBlock.disabled = (!exceptionsAllow.disabled);
|
||||
|
||||
if (blacklistEmpty() && (gPolicyButton.value == "false")) {
|
||||
gSoundCheckbox.disabled = true;
|
||||
gSoundUrlBox.disabled = true;
|
||||
gSoundUrlButton.disabled = true;
|
||||
gIconCheckbox.disabled = true;
|
||||
}
|
||||
function selectCustom() {
|
||||
setButtons(false);
|
||||
else {
|
||||
gSoundCheckbox.disabled = false;
|
||||
gSoundUrlBox.disabled = false;
|
||||
gSoundUrlButton.disabled = false;
|
||||
gIconCheckbox.disabled = false;
|
||||
|
||||
enableSoundUrl(gSoundCheckbox.checked);
|
||||
}
|
||||
}
|
||||
|
||||
function selectSound() {
|
||||
var nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
var filepicker = Components.classes["@mozilla.org/filepicker;1"]
|
||||
.createInstance(nsIFilePicker);
|
||||
|
||||
filepicker.init(window, document.getElementById("selectSound").getAttribute("filepickertitle"), nsIFilePicker.modeOpen);
|
||||
filepicker.appendFilters(nsIFilePicker.filterAll);
|
||||
|
||||
var ret = filepicker.show();
|
||||
if (ret == nsIFilePicker.returnOK)
|
||||
gSoundUrlBox.value = filepicker.file.path;
|
||||
}
|
||||
|
||||
function enableSoundUrl(soundChecked) {
|
||||
gSoundUrlBox.disabled = !soundChecked;
|
||||
gSoundUrlButton.disabled = !soundChecked;
|
||||
}
|
||||
|
||||
function viewPopups() {
|
||||
window.openDialog("chrome://communicator/content/popupManager.xul", "",
|
||||
"chrome,resizable=yes,modal=yes",
|
||||
(gPolicyButton.value == "true"),
|
||||
"",
|
||||
true);
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<groupbox id="popupsArea">
|
||||
<caption label="&popupBlocking.label;"/>
|
||||
|
||||
<description>&popupDetails;</description>
|
||||
|
||||
<radiogroup id="popupPolicy" prefstring="privacy.popups.policy">
|
||||
<radio value="1" label="&popupAllow.label;"
|
||||
accesskey="&popupAllow.accesskey;"
|
||||
oncommand="selectPolicy()"/>
|
||||
<checkbox id="popupCustom" label="&popupCustom.label;"
|
||||
style="margin-left:2em"
|
||||
prefstring="privacy.popups.usecustom"
|
||||
oncommand="selectCustom(this)"/>
|
||||
<radio value="2" label="&popupReject.label;"
|
||||
accesskey="&popupReject.accesskey;"
|
||||
oncommand="selectPolicy()"/>
|
||||
</radiogroup>
|
||||
|
||||
<checkbox id="popupDomShadow" hidden="true"
|
||||
prefstring="dom.disable_open_during_load"/>
|
||||
|
||||
<hbox pack="end">
|
||||
<button id="popupView" label="&popupView.label;"
|
||||
accesskey="&popupView.accesskey;" oncommand="viewPopups();"/>
|
||||
<hbox align="center">
|
||||
<radiogroup id="popupPolicy" preftype="bool" prefstring="dom.disable_open_during_load">
|
||||
<vbox flex="1">
|
||||
<hbox>
|
||||
<radio value="false" label="&popupAllow.label;"
|
||||
oncommand="setButtons()"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="exceptionsAllow" label="&popupView.label;"
|
||||
oncommand="viewPopups();"/>
|
||||
</hbox>
|
||||
|
||||
<hbox>
|
||||
<radio value="true" label="&popupBlock.label;"
|
||||
oncommand="setButtons()"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="exceptionsBlock" label="&popupView.label;"
|
||||
oncommand="viewPopups();"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</radiogroup>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
<description id="whenBlock">&whenBlock.description;</description>
|
||||
<hbox align="center">
|
||||
<checkbox id="playSound" label="&playSound.label;"
|
||||
oncommand="enableSoundUrl(this.checked);"
|
||||
preftype="bool" prefstring="privacy.popups.sound_enabled"
|
||||
prefattribute="checked"/>
|
||||
<textbox flex="1" id="playSoundUrl" prefstring="privacy.popups.sound_url"/>
|
||||
<button id="selectSound" label="&selectSound.label;" accesskey="&selectSound.accesskey;"
|
||||
filepickertitle="&selectSound.title;" oncommand="selectSound();"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<checkbox id="displayIcon" label="&displayIcon.label;"
|
||||
preftype="bool" prefstring="privacy.popups.statusbar_icon_enabled"
|
||||
prefattribute="checked"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
<description>&popupNote.description;</description>
|
||||
</groupbox>
|
||||
|
||||
</page>
|
||||
|
|
|
@ -44,7 +44,6 @@ function changeDisabledState(state){
|
|||
//Set the states of the groupbox children state based on the "javascript enabled" checkbox value
|
||||
document.getElementById("allowScripts").disabled = state;
|
||||
document.getElementById("allowWindowMoveResize").disabled = state;
|
||||
document.getElementById("allowWindowOpen").disabled = state;
|
||||
document.getElementById("allowImageSrcChange").disabled = state;
|
||||
document.getElementById("allowDocumentCookieSet").disabled = state;
|
||||
document.getElementById("allowDocumentCookieGet").disabled = state;
|
||||
|
@ -87,8 +86,7 @@ function Startup(){
|
|||
|
||||
//If scriptData does not exist, then it is the first time the panel was shown and we default to false
|
||||
if (!("scriptData" in data)){
|
||||
var changedList = ["allowWindowOpenChanged",
|
||||
"allowWindowMoveResizeChanged",
|
||||
var changedList = ["allowWindowMoveResizeChanged",
|
||||
"allowWindowStatusChangeChanged",
|
||||
"allowWindowFlipChanged",
|
||||
"allowDocumentCookieSetChanged",
|
||||
|
@ -102,7 +100,6 @@ function Startup(){
|
|||
data.scriptData[ changedList[run] ].value = false;
|
||||
}
|
||||
|
||||
document.getElementById("allowWindowOpen").checked = getPrefValueForCheckbox("dom.disable_open_during_load");
|
||||
document.getElementById("allowWindowMoveResize").checked = getPrefValueForCheckbox("dom.disable_window_move_resize");
|
||||
document.getElementById("allowWindowFlip").checked = getPrefValueForCheckbox("dom.disable_window_flip");
|
||||
document.getElementById("allowWindowStatusChange").checked = getPrefValueForCheckbox("dom.disable_window_status_change");
|
||||
|
@ -143,11 +140,6 @@ function doOnOk(){
|
|||
|
||||
var data = parent.hPrefWindow.wsm.dataManager.pageData["chrome://communicator/content/pref/pref-scripts.xul"];
|
||||
|
||||
if (data.scriptData["allowWindowOpenChanged"].value){
|
||||
parent.hPrefWindow.setPref("bool", "dom.disable_open_during_load",
|
||||
!getCheckboxValue('allowWindowOpen'));
|
||||
}
|
||||
|
||||
if (data.scriptData["allowWindowMoveResizeChanged"].value){
|
||||
parent.hPrefWindow.setPref("bool", "dom.disable_window_move_resize",
|
||||
!getCheckboxValue('allowWindowMoveResize'));
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
<![CDATA[
|
||||
var panel = "chrome://communicator/content/pref/pref-scripts.xul";
|
||||
var _elementIDs = ["javascriptAllowNavigator",
|
||||
"allowWindowOpen",
|
||||
"allowWindowMoveResize",
|
||||
"allowWindowFlip",
|
||||
"allowWindowStatusChange",
|
||||
|
@ -71,7 +70,6 @@
|
|||
<label id="allowScripts" value="&allowScripts.label;"/>
|
||||
|
||||
<listbox id="AllowList" flex="1">
|
||||
<listitem type="checkbox" id="allowWindowOpen" label="&allowWindowOpen.label;"/>
|
||||
<listitem type="checkbox" id="allowWindowMoveResize" label="&allowWindowMoveResize.label;"/>
|
||||
<listitem type="checkbox" id="allowWindowFlip" label="&allowWindowFlip.label;"/>
|
||||
<listitem type="checkbox" id="allowHideStatusBar" label="&allowHideStatusBar.label;"/>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<!ENTITY cookies.label "Cookies">
|
||||
<!ENTITY images.label "Images">
|
||||
<!ENTITY popups.label "Pop-ups">
|
||||
<!ENTITY popups.label "Popup Windows">
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
<!ENTITY title "Pop-ups">
|
||||
<!ENTITY title "Popup Windows">
|
||||
|
||||
<!ENTITY popupBlocking.label "Pop-up Window Policy">
|
||||
<!ENTITY popupBlocking.label "Popup Windows">
|
||||
|
||||
<!ENTITY popupDetails "When websites attempt to open new windows without being asked">
|
||||
<!ENTITY popupDetails "Specify how to handle popup windows that appear on top of or under the current Navigator window:">
|
||||
|
||||
<!ENTITY popupAllow.label "Allow pop-up windows">
|
||||
<!ENTITY popupAllow.accesskey "a">
|
||||
<!ENTITY popupReject.label "Reject pop-up windows">
|
||||
<!ENTITY popupReject.accesskey "r">
|
||||
<!ENTITY popupAllow.label "Allow popups">
|
||||
<!ENTITY popupAllow.accesskey "A">
|
||||
<!ENTITY popupBlock.label "Suppress popups">
|
||||
<!ENTITY popupBlock.accesskey "S">
|
||||
|
||||
<!ENTITY popupCustom.label "Use custom settings">
|
||||
<!ENTITY popupCustom.accesskey "c">
|
||||
<!ENTITY popupView.label "Exceptions...">
|
||||
|
||||
<!ENTITY whenBlock.description "When a popup window has been suppressed:">
|
||||
<!ENTITY playSound.label "Play a sound:">
|
||||
|
||||
<!ENTITY selectSound.label "Select...">
|
||||
<!ENTITY selectSound.accesskey "e">
|
||||
<!ENTITY selectSound.title "Select Popup Suppress Sound">
|
||||
|
||||
<!ENTITY displayIcon.label "Display an icon in the Navigator status bar">
|
||||
|
||||
<!ENTITY popupNote.description "Note: Suppressing all popups may prevent important features of some web sites from working, such as login windows for banks and shopping sites. For details of how to allow specific sites to use popups while suppressing all others, click Help. Even if suppressed, sites may use other methods to show popups.">
|
||||
|
||||
<!ENTITY popupView.label "Manage Pop-up Permissions">
|
||||
<!ENTITY popupView.accesskey "m">
|
||||
|
|
Загрузка…
Ссылка в новой задаче