Bug 36619 - display notification when file picker is blocked r=sicking a=blocking

This commit is contained in:
David Zbarsky 2010-08-27 11:49:08 -04:00
parent df751a140e
commit 07afb3378d
4 changed files with 20 additions and 6 deletions

View File

@ -505,6 +505,10 @@ const gPopupBlockerObserver = {
var pageReport = gBrowser.pageReport;
if (pageReport) {
for (var i = 0; i < pageReport.length; ++i) {
// popupWindowURI will be null if the file picker popup is blocked.
// xxxdz this should make the option say "Show file picker" and do it (Bug 590306)
if (!pageReport[i].popupWindowURI)
continue;
var popupURIspec = pageReport[i].popupWindowURI.spec;
// Sometimes the popup URI that we get back from the pageReport

View File

@ -110,6 +110,7 @@
#include "nsIContentPrefService.h"
#include "nsIObserverService.h"
#include "nsIPopupWindowManager.h"
#include "nsGlobalWindow.h"
// input type=image
#include "nsImageLoadingContent.h"
@ -276,8 +277,11 @@ AsyncClickHandler::Run()
PRUint32 permission;
pm->TestPermission(doc->GetDocumentURI(), &permission);
if (permission == nsIPopupWindowManager::DENY_POPUP)
if (permission == nsIPopupWindowManager::DENY_POPUP) {
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
nsGlobalWindow::FirePopupBlockedEvent(domDoc, win, nsnull, EmptyString(), EmptyString());
return NS_OK;
}
}
// Get Loc title

View File

@ -5007,11 +5007,12 @@ PRBool IsPopupBlocked(nsIDOMDocument* aDoc)
return blocked;
}
static
void FirePopupBlockedEvent(nsIDOMDocument* aDoc,
nsIDOMWindow *aRequestingWindow, nsIURI *aPopupURI,
const nsAString &aPopupWindowName,
const nsAString &aPopupWindowFeatures)
/* static */
void
nsGlobalWindow::FirePopupBlockedEvent(nsIDOMDocument* aDoc,
nsIDOMWindow *aRequestingWindow, nsIURI *aPopupURI,
const nsAString &aPopupWindowName,
const nsAString &aPopupWindowFeatures)
{
if (aDoc) {
// Fire a "DOMPopupBlocked" event so that the UI can hear about

View File

@ -481,6 +481,11 @@ public:
mCleanedUp);
}
static void FirePopupBlockedEvent(nsIDOMDocument* aDoc,
nsIDOMWindow *aRequestingWindow, nsIURI *aPopupURI,
const nsAString &aPopupWindowName,
const nsAString &aPopupWindowFeatures);
protected:
// Object Management
virtual ~nsGlobalWindow();