mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 35c6e7e9c205 (bug 1135261) for test failures in gij in bookmark_edit_test.js on a CLOSED TREE
This commit is contained in:
parent
fb5ef71756
commit
d382c43cbc
@ -158,9 +158,7 @@ function loadFrameScript(mm) {
|
||||
checkWidget(widget); \
|
||||
}; \
|
||||
request.onerror = onError; \
|
||||
var win = content.window.open("about:blank"); /*test mozbrowseropenwindow*/ \
|
||||
/*Close new window to avoid mochitest "unable to restore focus" failures.*/ \
|
||||
win.close(); \
|
||||
content.window.open("about:blank"); /*test mozbrowseropenwindow*/ \
|
||||
content.window.scrollTo(4000, 4000); /*test mozbrowser(async)scroll*/ \
|
||||
';
|
||||
mm.loadFrameScript(script, /* allowDelayedLoad = */ false);
|
||||
|
@ -123,7 +123,7 @@ DispatchCustomDOMEvent(Element* aFrameElement, const nsAString& aEventName,
|
||||
}
|
||||
customEvent->SetTrusted(true);
|
||||
// Dispatch the event.
|
||||
// We don't initialize aStatus here, as our callers have already done so.
|
||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||
nsresult rv =
|
||||
EventDispatcher::DispatchDOMEvent(aFrameElement, nullptr,
|
||||
domEvent, presContext, aStatus);
|
||||
@ -182,7 +182,7 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
|
||||
return BrowserElementParent::OPEN_WINDOW_CANCELLED;
|
||||
}
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEventStatus status;
|
||||
bool dispatchSucceeded =
|
||||
DispatchCustomDOMEvent(aOpenerFrameElement,
|
||||
NS_LITERAL_STRING("mozbrowseropenwindow"),
|
||||
|
@ -20,6 +20,11 @@ XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter",
|
||||
"nsICrashReporter");
|
||||
#endif
|
||||
|
||||
function isSameOrigin(url) {
|
||||
let origin = Services.io.newURI(url, null, null).prePath;
|
||||
return (origin == WebappRT.config.app.origin);
|
||||
}
|
||||
|
||||
let progressListener = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
|
||||
Ci.nsISupportsWeakReference]),
|
||||
@ -46,30 +51,15 @@ let progressListener = {
|
||||
}
|
||||
}
|
||||
|
||||
let isSameOrigin = (location.prePath === WebappRT.config.app.origin);
|
||||
|
||||
// Set the title of the window to the name of the webapp, adding the origin
|
||||
// of the page being loaded if it's from a different origin than the app
|
||||
// (per security bug 741955, which specifies that other-origin pages loaded
|
||||
// in runtime windows must be identified in chrome).
|
||||
let title = WebappRT.localeManifest.name;
|
||||
if (!isSameOrigin) {
|
||||
if (!isSameOrigin(location.spec)) {
|
||||
title = location.prePath + " - " + title;
|
||||
}
|
||||
document.documentElement.setAttribute("title", title);
|
||||
|
||||
#ifndef XP_WIN
|
||||
#ifndef XP_MACOSX
|
||||
if (isSameOrigin) {
|
||||
// On non-Windows platforms, we open new windows in fullscreen mode
|
||||
// if the opener window is in fullscreen mode, so we hide the menubar;
|
||||
// but on Mac we don't need to hide the menubar.
|
||||
if (document.mozFullScreenElement) {
|
||||
document.getElementById("main-menubar").style.display = "none";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
},
|
||||
|
||||
onStateChange: function onStateChange(aProgress, aRequest, aFlags, aStatus) {
|
||||
@ -82,38 +72,42 @@ let progressListener = {
|
||||
};
|
||||
|
||||
function onOpenWindow(event) {
|
||||
if (event.detail.name === "_blank") {
|
||||
let uri = Services.io.newURI(event.detail.url, null, null);
|
||||
let name = event.detail.name;
|
||||
|
||||
// Prevent the default handler so nsContentTreeOwner.ProvideWindow
|
||||
// doesn't create the window itself.
|
||||
event.preventDefault();
|
||||
if (name == "_blank") {
|
||||
let uri = Services.io.newURI(event.detail.url, null, null);
|
||||
|
||||
// Direct the URL to the browser.
|
||||
Cc["@mozilla.org/uriloader/external-protocol-service;1"].
|
||||
getService(Ci.nsIExternalProtocolService).
|
||||
getProtocolHandlerInfo(uri.scheme).
|
||||
launchWithURI(uri);
|
||||
}
|
||||
} else {
|
||||
let win = window.openDialog("chrome://webapprt/content/webapp.xul",
|
||||
name,
|
||||
"chrome,dialog=no,resizable," + event.detail.features);
|
||||
|
||||
// Otherwise, don't do anything to make nsContentTreeOwner.ProvideWindow
|
||||
// create the window itself and return it to the window.open caller.
|
||||
}
|
||||
win.addEventListener("load", function onLoad() {
|
||||
win.removeEventListener("load", onLoad, false);
|
||||
|
||||
function onDOMContentLoaded() {
|
||||
window.removeEventListener("DOMContentLoaded", onDOMContentLoaded, false);
|
||||
// The initial window's app ID is set by Startup.jsm before the app
|
||||
// is loaded, so this code only handles subsequent windows that are opened
|
||||
// by the app via window.open calls. We do this on DOMContentLoaded
|
||||
// in order to ensure it gets set before the window's content is loaded.
|
||||
if (gAppBrowser.docShell.appId === Ci.nsIScriptSecurityManager.NO_APP_ID) {
|
||||
// Set the principal to the correct app ID. Since this is a subsequent
|
||||
// window, we know that WebappRT.configPromise has been resolved, so we
|
||||
// don't have to yield to it before accessing WebappRT.appID.
|
||||
gAppBrowser.docShell.setIsApp(WebappRT.appID);
|
||||
#ifndef XP_WIN
|
||||
#ifndef XP_MACOSX
|
||||
if (isSameOrigin(event.detail.url)) {
|
||||
// On non-Windows platforms, we open new windows in fullscreen mode
|
||||
// if the opener window is in fullscreen mode, so we hide the menubar;
|
||||
// but on Mac we don't need to hide the menubar.
|
||||
if (document.mozFullScreenElement) {
|
||||
win.document.getElementById("main-menubar").style.display = "none";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
win.document.getElementById("content").docShell.setIsApp(WebappRT.appID);
|
||||
win.document.getElementById("content").setAttribute("src", event.detail.url);
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
window.addEventListener("DOMContentLoaded", onDOMContentLoaded, false);
|
||||
|
||||
function onLoad() {
|
||||
window.removeEventListener("load", onLoad, false);
|
||||
|
@ -27,12 +27,7 @@ function test() {
|
||||
winAppBrowser.addEventListener("load", function onLoadBrowser() {
|
||||
winAppBrowser.removeEventListener("load", onLoadBrowser, true);
|
||||
|
||||
let contentWindow = Cu.waiveXrays(gAppBrowser.contentDocument.defaultView);
|
||||
is(contentWindow.openedWindow.location.href,
|
||||
"http://test/webapprtChrome/webapprt/test/chrome/sample.html",
|
||||
"window.open returns window with correct URL");
|
||||
|
||||
is(winAppBrowser.documentURI.spec,
|
||||
is(winAppBrowser.getAttribute("src"),
|
||||
"http://test/webapprtChrome/webapprt/test/chrome/sample.html",
|
||||
"New window browser has correct src");
|
||||
|
||||
|
@ -4,9 +4,8 @@
|
||||
<title>Window Open Test App</title>
|
||||
<meta charset="utf-8">
|
||||
<script>
|
||||
var openedWindow;
|
||||
function onLoad() {
|
||||
openedWindow = window.open("sample.html");
|
||||
window.open("sample.html");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
Loading…
Reference in New Issue
Block a user