diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 377eb0c7cfda..cae6adc5a82c 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -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 diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 7ef3f02f4820..ac117796e3d6 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -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 domDoc = do_QueryInterface(doc); + nsGlobalWindow::FirePopupBlockedEvent(domDoc, win, nsnull, EmptyString(), EmptyString()); return NS_OK; + } } // Get Loc title diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 142cf05cb14c..d2aba34092c5 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -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 diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index cbfd9e217930..6f6b65ccdcec 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -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();