Bug 294673, don't allow sending reports from about:blank (or any other invalid URIs), r=mconnor

This commit is contained in:
gavin%gavinsharp.com 2005-10-13 01:32:02 +00:00
Родитель 99b44c383a
Коммит 9261c5204b
3 изменённых файлов: 58 добавлений и 6 удалений

Просмотреть файл

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Gavin Sharp <gavin@gavinsharp.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -34,9 +35,46 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var reporterListener = {
function loadReporterWizard()
{
window.openDialog("chrome://reporter/content/reportWizard.xul", "", "chrome,centerscreen,dialog,resizable=no,width=535,height=442",getBrowser().currentURI.spec);
QueryInterface: function(aIID) {
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
onLocationChange: function(aProgress, aRequest, aURI) {
var broadcaster = document.getElementById("reporterItemsBroadcaster");
// XXX The schemeIs check is only necessary until bug 169826 is fixed,
// since we can end up with a dummy URI here
var isEnabled = (aURI && "schemeIs" in aURI &&
(aURI.schemeIs("http") ||
aURI.schemeIs("https") ||
aURI.schemeIs("ftp") ||
aURI.schemeIs("gopher")));
broadcaster.setAttribute("disabled", !isEnabled);
},
onStateChange: function() { },
onProgressChange: function() { },
onStatusChange: function() { },
onSecurityChange: function() { },
onLinkIconAvailable: function() { }
}
function onBrowserLoad() {
gBrowser.addProgressListener(reporterListener);
}
function loadReporterWizard() {
window.openDialog("chrome://reporter/content/reportWizard.xul", "",
"chrome,centerscreen,dialog,resizable=no,width=535,height=442",
getBrowser().currentURI.spec);
return true;
}
window.addEventListener("load", onBrowserLoad, false);

Просмотреть файл

@ -24,6 +24,8 @@
-
- Contributor(s):
- Jay Patel <jay@mozilla.org>
- Gavin Sharp <gavin@gavinsharp.com>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
@ -46,11 +48,15 @@
<script type="application/x-javascript" src="chrome://reporter/content/reporterOverlay.js"/>
<!-- Firefox -->
<broadcasterset id="mainBroadcasterSet">
<broadcaster id="reporterItemsBroadcaster" disabled="true"/>
</broadcasterset>
<menupopup id="menu_HelpPopup">
<menuitem id="menu_HelpPopup_reportertoolmenu"
label="&reporterMenu.title;..."
accesskey="&reporterMenu.accesskey;"
insertbefore="aboutSeparator"
observes="reporterItemsBroadcaster"
oncommand="loadReporterWizard()"/>
</menupopup>
<toolbarpalette id="BrowserToolbarPalette">
@ -58,13 +64,21 @@
oncommand="loadReporterWizard();"
class="toolbarbutton-1"
label="&reporterMenu.title;"
observes="reporterItemsBroadcaster"
tooltiptext="&reporterMenu.tooltip;"/>
</toolbarpalette>
<!-- SeaMonkey -->
<broadcasterset id="navBroadcasters">
<broadcaster id="reporterItemsBroadcaster" disabled="true"/>
</broadcasterset>
<menupopup id="helpPopup">
<menuseparator insertbefore="menu_HelpAboutSeparator"/>
<menuitem id="helpPopup_reportertoolmenu" label="&reporterMenu.title;..." accesskey="&reporterMenu.accesskey;" insertbefore="menu_HelpAboutSeparator"
oncommand="loadReporterWizard()"/>
<menuitem id="helpPopup_reportertoolmenu"
label="&reporterMenu.title;..."
accesskey="&reporterMenu.accesskey;"
insertbefore="menu_HelpAboutSeparator"
oncommand="loadReporterWizard()"
observes="reporterItemsBroadcaster"/>
</menupopup>
</overlay>

Просмотреть файл

@ -18,7 +18,7 @@
}
*/
#reporterMenuButton[disabled="true"] {
-moz-image-region: rect(0px 69px 23px 92px) !important;
-moz-image-region: rect(0px 69px 23px 46px) !important;
}
/* Small */