author | Neil Rashbrook <neil@parkwaycc.co.uk> |
Mon, 05 Jul 2010 13:03:07 +0100 | |
changeset 47224 | a9d27938bb2dc2dec5f6c7cc2b9654af1b0cd841 |
parent 47223 | dd73fb7289a4074c23d5446f858e97744aaf74fe |
child 47225 | f469d7357b5b19e64236302302346098a3b00b33 |
push id | unknown |
push user | unknown |
push date | unknown |
reviewers | bzbarsky |
bugs | 351235 |
milestone | 2.0b2pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/embedding/base/nsIWindowProvider.idl +++ b/embedding/base/nsIWindowProvider.idl @@ -51,17 +51,17 @@ interface nsIURI; /** * The nsIWindowProvider interface exists so that the window watcher's default * behavior of opening a new window can be easly modified. When the window * watcher needs to open a new window, it will first check with the * nsIWindowProvider it gets from the parent window. If there is no provider * or the provider does not provide a window, the window watcher will proceed * to actually open a new window. */ -[scriptable, uuid(5119ac7f-81dd-4061-96a7-71f2cf5efee4)] +[scriptable, uuid(f607bd66-08e5-4d2e-ad83-9f9f3ca17658)] interface nsIWindowProvider : nsISupports { /** * A method to request that this provider provide a window. The window * returned need not to have the right name or parent set on it; setting * those is the caller's responsibility. The provider can always return null * to have the caller create a brand-new window. * @@ -109,15 +109,16 @@ interface nsIWindowProvider : nsISupport * the nsIWindowProvider implementation or may be a window that * already existed. * * @see nsIWindowWatcher for more information on aFeatures. * @see nsIWebBrowserChrome for more information on aChromeFlags. */ nsIDOMWindow provideWindow(in nsIDOMWindow aParent, in unsigned long aChromeFlags, + in boolean aCalledFromJS, in boolean aPositionSpecified, in boolean aSizeSpecified, in nsIURI aURI, in AString aName, in AUTF8String aFeatures, out boolean aWindowIsNew); };
--- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -618,17 +618,17 @@ nsWindowWatcher::OpenWindowJSInternal(ns !(chromeFlags & (nsIWebBrowserChrome::CHROME_MODAL | nsIWebBrowserChrome::CHROME_OPENAS_DIALOG | nsIWebBrowserChrome::CHROME_OPENAS_CHROME))) { nsCOMPtr<nsIWindowProvider> provider = do_GetInterface(parentTreeOwner); if (provider) { NS_ASSERTION(aParent, "We've _got_ to have a parent here!"); nsCOMPtr<nsIDOMWindow> newWindow; - rv = provider->ProvideWindow(aParent, chromeFlags, + rv = provider->ProvideWindow(aParent, chromeFlags, aCalledFromJS, sizeSpec.PositionSpecified(), sizeSpec.SizeSpecified(), uriToLoad, name, features, &windowIsNew, getter_AddRefs(newWindow)); if (NS_SUCCEEDED(rv)) { GetWindowTreeItem(newWindow, getter_AddRefs(newDocShellItem)); if (windowIsNew && newDocShellItem) { // Make sure to stop any loads happening in this window that the
--- a/xpfe/appshell/src/nsContentTreeOwner.cpp +++ b/xpfe/appshell/src/nsContentTreeOwner.cpp @@ -812,16 +812,17 @@ private: }; //***************************************************************************** // nsContentTreeOwner: nsIWindowProvider //***************************************************************************** NS_IMETHODIMP nsContentTreeOwner::ProvideWindow(nsIDOMWindow* aParent, PRUint32 aChromeFlags, + PRBool aCalledFromJS, PRBool aPositionSpecified, PRBool aSizeSpecified, nsIURI* aURI, const nsAString& aName, const nsACString& aFeatures, PRBool* aWindowIsNew, nsIDOMWindow** aReturn) { @@ -861,16 +862,17 @@ nsContentTreeOwner::ProvideWindow(nsIDOM } if (containerPref != nsIBrowserDOMWindow::OPEN_NEWTAB && containerPref != nsIBrowserDOMWindow::OPEN_CURRENTWINDOW) { // Just open a window normally return NS_OK; } + if (aCalledFromJS) { /* Now check our restriction pref. The restriction pref is a power-user's fine-tuning pref. values: 0: no restrictions - divert everything 1: don't divert window.open at all 2: don't divert window.open with features */ PRInt32 restrictionPref; if (NS_FAILED(branch->GetIntPref("open_newwindow.restriction", @@ -885,16 +887,17 @@ nsContentTreeOwner::ProvideWindow(nsIDOM } if (restrictionPref == 2 && // Only continue if there are no size/position features and no special // chrome flags. (aChromeFlags != nsIWebBrowserChrome::CHROME_ALL || aPositionSpecified || aSizeSpecified)) { return NS_OK; + } } nsCOMPtr<nsIDOMWindowInternal> domWin; mXULWindow->GetWindowDOMWindow(getter_AddRefs(domWin)); nsCOMPtr<nsIDOMChromeWindow> chromeWin = do_QueryInterface(domWin); if (!chromeWin) { // Really odd... but whatever NS_WARNING("nsXULWindow's DOMWindow is not a chrome window");