author | Bobby Holley <bobbyholley@gmail.com> |
Thu, 11 Oct 2012 19:44:20 +0200 (2012-10-11) | |
changeset 109971 | f6d177ffd4baf0d89bec3e417ba374adf7843a76 |
parent 109970 | 129f5457378ebb43c601bedb2db495704dbf2d11 |
child 109972 | 651bd0042def36d5b541cfc48c96f7bbb9dbe5ee |
push id | 23667 |
push user | emorley@mozilla.com |
push date | Fri, 12 Oct 2012 11:04:11 +0000 (2012-10-12) |
treeherder | mozilla-central@83e8792a147a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bz |
bugs | 799348 |
milestone | 19.0a1 |
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/js/xpconnect/tests/chrome/Makefile.in +++ b/js/xpconnect/tests/chrome/Makefile.in @@ -36,16 +36,17 @@ MOCHITEST_CHROME_FILES = \ test_bug743843.xul \ test_bug760076.xul \ test_bug760109.xul \ test_bug763343.xul \ test_bug771429.xul \ test_bug773962.xul \ test_bug793433.xul \ test_bug795275.xul \ + test_bug799348.xul \ test_APIExposer.xul \ test_chrometoSource.xul \ outoflinexulscript.js \ subscript.js \ test_cows.xul \ test_documentdomain.xul \ test_doublewrappedcompartments.xul \ test_evalInSandbox.xul \
new file mode 100644 --- /dev/null +++ b/js/xpconnect/tests/chrome/test_bug799348.xul @@ -0,0 +1,50 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/css" href="chrome://global/skin"?> +<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=799348 +--> +<window title="Mozilla Bug 799348" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> + + <!-- test results are displayed in the html:body --> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=799348" + target="_blank">Mozilla Bug 799348</a> + </body> + + <!-- test code goes here --> + <script type="application/javascript"> + <![CDATA[ + /** Test for Bug 799348 **/ + SimpleTest.waitForExplicitFinish(); + Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + Components.utils.import("resource://gre/modules/Services.jsm"); + gCalledOnload = false; + var myObserver = { + QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver]), + observe: function(win, topic, data) { + if (topic == "domwindowopened") { + ok(!gCalledOnload, "domwindowopened notification fired before onload"); + win.addEventListener("load", function(evt) { + gCalledOnload = true; + win.close(); + }, false); + } else if (topic == "domwindowclosed") { + ok(gCalledOnload, "should have called onload"); + Services.ww.unregisterNotification(myObserver); + SimpleTest.finish(); + } + else { + ok(false, "unknown topic"); + } + } + }; + Services.ww.registerNotification(myObserver); + + + ]]> + </script> + <iframe id="frame" type="content" src="http://test1.example.org/tests/js/xpconnect/tests/mochitest/file_bug799348.html" /> +</window>
--- a/js/xpconnect/tests/mochitest/Makefile.in +++ b/js/xpconnect/tests/mochitest/Makefile.in @@ -64,16 +64,17 @@ MOCHITEST_FILES = bug500931_helper.html file_bug760131.html \ test_bug764389.html \ test_bug772288.html \ test_bug781476.html \ file_bug781476.html \ test_bug789713.html \ file_bug795275.html \ file_bug795275.xml \ + file_bug799348.html \ file_nodelists.html \ file_exnstack.html \ file_expandosharing.html \ file_empty.html \ file_documentdomain.html \ test_lookupMethod.html \ file_bug738244.html \ file_mozMatchesSelector.html \
new file mode 100644 --- /dev/null +++ b/js/xpconnect/tests/mochitest/file_bug799348.html @@ -0,0 +1,11 @@ +<!DOCTYPE HTML> +<html> +<head> +<script> + var foo = window.open('file_empty.html', '', 'width=550, height=420, status=no, resizable=yes, scrollbars=yes, toolbar=no, left=945, top=225'); +</script> +</head> +<body> +</body> +</html> +
--- a/xpfe/appshell/src/nsXULWindow.cpp +++ b/xpfe/appshell/src/nsXULWindow.cpp @@ -1741,22 +1741,29 @@ NS_IMETHODIMP nsXULWindow::CreateNewCont } nsCOMPtr<nsIIOService> service(do_GetService(NS_IOSERVICE_CONTRACTID)); if (service) { service->NewURI(urlStr, nullptr, nullptr, getter_AddRefs(uri)); } NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE); + // We need to create a chrome window to contain the content window we're about + // to pass back. The subject principal needs to be system while we're creating + // it to make things work right, so push a null cx. See bug 799348 comment 13 + // for a description of what happens when we don't. + nsCxPusher pusher; + if (!pusher.PushNull()) + return NS_ERROR_FAILURE; nsCOMPtr<nsIXULWindow> newWindow; appShell->CreateTopLevelWindow(this, uri, aChromeFlags, 615, 480, getter_AddRefs(newWindow)); - NS_ENSURE_TRUE(newWindow, NS_ERROR_FAILURE); + pusher.Pop(); // Specify that we want the window to remain locked until the chrome has loaded. nsXULWindow *xulWin = static_cast<nsXULWindow*> (static_cast<nsIXULWindow*> (newWindow)); xulWin->LockUntilChromeLoad();