mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out 57bb160f49d5:4e6b16f0d753 (bug 875157) for breaking master password tests
This commit is contained in:
parent
7ca93f4da4
commit
fd773744df
@ -3286,36 +3286,6 @@ nsDOMWindowUtils::AllowScriptsToClose()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::GetIsParentWindowMainWidgetVisible(bool* aIsVisible)
|
||||
{
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
// this should reflect the "is parent window visible" logic in
|
||||
// nsWindowWatcher::OpenWindowInternal()
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
|
||||
nsCOMPtr<nsIWidget> parentWidget;
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIDocShellTreeOwner> parentTreeOwner;
|
||||
docShell->GetTreeOwner(getter_AddRefs(parentTreeOwner));
|
||||
nsCOMPtr<nsIBaseWindow> parentWindow(do_GetInterface(parentTreeOwner));
|
||||
if (parentWindow) {
|
||||
parentWindow->GetMainWidget(getter_AddRefs(parentWidget));
|
||||
}
|
||||
}
|
||||
if (!parentWidget) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
*aIsVisible = parentWidget->IsVisible();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::IsNodeDisabledForEvents(nsIDOMNode* aNode, bool* aRetVal)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ interface nsIURI;
|
||||
interface nsIDOMEventTarget;
|
||||
interface nsIRunnable;
|
||||
|
||||
[scriptable, uuid(cbe333d7-5b2c-4a9b-b99b-e6e388afa62b)]
|
||||
[scriptable, uuid(a806d366-cc52-11e2-bc9a-ba3212c84021)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
@ -1366,17 +1366,6 @@ interface nsIDOMWindowUtils : nsISupports {
|
||||
*/
|
||||
void allowScriptsToClose();
|
||||
|
||||
/**
|
||||
* Is the parent window's main widget visible? If it isn't, we probably
|
||||
* don't want to display any dialogs etc it may request. This corresponds
|
||||
* to the visibility check in nsWindowWatcher::OpenWindowInternal().
|
||||
*
|
||||
* Will throw a DOM security error if called without chrome privileges or
|
||||
* NS_ERROR_NOT_AVAILABLE in the unlikely event that the parent window's
|
||||
* main widget can't be reached.
|
||||
*/
|
||||
readonly attribute boolean isParentWindowMainWidgetVisible;
|
||||
|
||||
/**
|
||||
* In certain cases the event handling of nodes, form controls in practice,
|
||||
* may be disabled. Such cases are for example the existence of disabled
|
||||
|
@ -636,10 +636,6 @@ nsWindowWatcher::OpenWindowInternal(nsIDOMWindow *aParent,
|
||||
nsCOMPtr<nsIWidget> parentWidget;
|
||||
if (parentWindow)
|
||||
parentWindow->GetMainWidget(getter_AddRefs(parentWidget));
|
||||
// NOTE: the logic for this visibility check is duplicated in
|
||||
// nsIDOMWindowUtils::isParentWindowMainWidgetVisible - if we change
|
||||
// how a window is determined "visible" in this context then we should
|
||||
// also adjust that attribute and/or any consumers of it...
|
||||
if (parentWidget && !parentWidget->IsVisible())
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
@ -365,14 +365,16 @@ XPCOMUtils.defineLazyGetter(PromptUtils, "ellipsis", function () {
|
||||
|
||||
|
||||
function openModalWindow(domWin, uri, args) {
|
||||
// We don't want to show prompts for hidden windows, and we can't know
|
||||
// that unless we are passed a window, so not doing that is evil...
|
||||
// XXX Investigate supressing modal state when we're called without a
|
||||
// window? Seems odd to affect whatever window happens to be active.
|
||||
if (!domWin)
|
||||
throw Components.Exception("openModalWindow, but no parent passed", Cr.NS_ERROR_NOT_AVAILABLE);
|
||||
let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
if (!winUtils.isParentWindowMainWidgetVisible)
|
||||
throw Components.Exception("Cannot call openModalWindow on a hidden window", Cr.NS_ERROR_NOT_AVAILABLE);
|
||||
domWin = Services.ww.activeWindow;
|
||||
|
||||
// domWin may still be null here if there are _no_ windows open.
|
||||
|
||||
// Note that we don't need to fire DOMWillOpenModalDialog and
|
||||
// DOMModalDialogClosed events here, wwatcher's OpenWindowInternal
|
||||
// will do that. Similarly for enterModalState / leaveModalState.
|
||||
|
||||
Services.ww.openWindow(domWin, uri, "_blank", "centerscreen,chrome,modal,titlebar", args);
|
||||
}
|
||||
|
@ -11,13 +11,6 @@ Cu.import("resource://gre/modules/PageThumbs.jsm");
|
||||
const backgroundPageThumbsContent = {
|
||||
|
||||
init: function () {
|
||||
// Arrange to prevent (most) popup dialogs for this window - popups done
|
||||
// in the parent (eg, auth) aren't prevented, but alert() etc are.
|
||||
let dwu = content.
|
||||
QueryInterface(Ci.nsIInterfaceRequestor).
|
||||
getInterface(Ci.nsIDOMWindowUtils);
|
||||
dwu.preventFurtherDialogs();
|
||||
|
||||
// Stop about:blank from loading. If it finishes loading after a capture
|
||||
// request is received, it could trigger the capture's load listener.
|
||||
this._webNav.stop(Ci.nsIWebNavigation.STOP_NETWORK);
|
||||
|
@ -227,43 +227,10 @@ let tests = [
|
||||
isnot([r, g, b].toString(), [0, 255, 0].toString(),
|
||||
"The captured page should not be green.");
|
||||
gBrowser.removeTab(tab);
|
||||
file.remove(false);
|
||||
deferred.resolve();
|
||||
});
|
||||
yield deferred.promise;
|
||||
},
|
||||
|
||||
// the following tests attempt to display modal dialogs. The test just
|
||||
// relies on the fact that if the dialog was displayed the test will hang
|
||||
// and timeout. IOW - the tests would pass if the dialogs appear and are
|
||||
// manually closed by the user - so don't do that :) (obviously there is
|
||||
// noone available to do that when run via tbpl etc, so this should be safe,
|
||||
// and it's tricky to use the window-watcher to check a window *does not*
|
||||
// appear - how long should the watcher be active before assuming it's not
|
||||
// going to appear?)
|
||||
function noAuthPrompt() {
|
||||
let url = "http://mochi.test:8888/browser/browser/base/content/test/authenticate.sjs?user=anyone";
|
||||
let file = fileForURL(url);
|
||||
ok(!file.exists(), "Thumbnail file should not already exist.");
|
||||
|
||||
let capturedURL = yield capture(url);
|
||||
is(capturedURL, url, "Captured URL should be URL passed to capture.");
|
||||
ok(file.exists(),
|
||||
"Thumbnail file should exist even though it requires auth.");
|
||||
file.remove(false);
|
||||
},
|
||||
|
||||
function noAlert() {
|
||||
let url = "data:text/html,<script>alert('yo!');</script>";
|
||||
let file = fileForURL(url);
|
||||
ok(!file.exists(), "Thumbnail file should not already exist.");
|
||||
|
||||
let capturedURL = yield capture(url);
|
||||
is(capturedURL, url, "Captured URL should be URL passed to capture.");
|
||||
ok(file.exists(),
|
||||
"Thumbnail file should exist even though it alerted.");
|
||||
file.remove(false);
|
||||
},
|
||||
];
|
||||
|
||||
function capture(url, options) {
|
||||
|
Loading…
Reference in New Issue
Block a user