Backout 99caa1f41fe1 (bug 797515) and a04b83c53297 (bug 789392) for M2 orange.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 03 Oct 2012 21:59:41 -0400
changeset 109296 16ac5cbc7793e3271fbe0467fbd29428ce783ef2
parent 109295 b768892d382529bf77db3b40de12fb55d2cdd56e
child 109297 3d6caa803dca37534fd4d4c8d1139579813b6bd3
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
bugs797515, 789392
milestone18.0a1
backs out99caa1f41fe18c7a997a6a3d6d619bbd876c07ba
Backout 99caa1f41fe1 (bug 797515) and a04b83c53297 (bug 789392) for M2 orange.
dom/base/nsGlobalWindow.cpp
dom/browser-element/mochitest/Makefile.in
dom/browser-element/mochitest/browserElement_CloseApp.js
dom/browser-element/mochitest/file_browserElement_CloseApp.html
dom/browser-element/mochitest/test_browserElement_inproc_CloseApp.html
dom/browser-element/mochitest/test_browserElement_oop_CloseApp.html
dom/ipc/ContentParent.cpp
testing/mochitest/android.json
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -6543,20 +6543,19 @@ nsGlobalWindow::Close()
   if (mBlockScriptedClosingFlag)
   {
     // A script's popup has been blocked and we don't want
     // the window to be closed directly after this event,
     // so the user can see that there was a blocked popup.
     return NS_OK;
   }
 
-  // Don't allow scripts from content to close non-app windows that were not
-  // opened by script.
-  if (!mDocShell->GetIsApp() &&
-      !mHadOriginalOpener && !nsContentUtils::IsCallerTrustedForWrite()) {
+  // Don't allow scripts from content to close windows
+  // that were not opened by script
+  if (!mHadOriginalOpener && !nsContentUtils::IsCallerTrustedForWrite()) {
     bool allowClose =
       Preferences::GetBool("dom.allow_scripts_to_close_windows", true);
     if (!allowClose) {
       // We're blocking the close operation
       // report localized error msg in JS console
       nsContentUtils::ReportToConsole(
           nsIScriptError::warningFlag,
           "DOM Window", mDoc,  // Better name for the category?
--- a/dom/browser-element/mochitest/Makefile.in
+++ b/dom/browser-element/mochitest/Makefile.in
@@ -88,19 +88,16 @@ MOCHITEST_FILES = \
 		test_browserElement_inproc_PromptCheck.html \
 		browserElement_PromptConfirm.js \
 		test_browserElement_inproc_PromptConfirm.html \
 		browserElement_Close.js \
 		test_browserElement_inproc_Close.html \
 		browserElement_CloseFromOpener.js \
 		test_browserElement_inproc_CloseFromOpener.html \
 		file_browserElement_CloseFromOpener.html \
-		browserElement_CloseApp.js \
-		test_browserElement_inproc_CloseApp.html \
-		file_browserElement_CloseApp.html \
 		browserElement_OpenWindow.js \
 		test_browserElement_inproc_OpenWindow.html \
 		file_browserElement_Open1.html \
 		file_browserElement_Open2.html \
 		browserElement_OpenWindowInFrame.js \
 		test_browserElement_inproc_OpenWindowInFrame.html \
 		file_browserElement_OpenWindowInFrame.html \
 		browserElement_OpenWindowRejected.js \
@@ -179,17 +176,16 @@ MOCHITEST_FILES += \
 		test_browserElement_oop_AlertInFrame.html \
 		test_browserElement_oop_TargetTop.html \
 		test_browserElement_oop_ForwardName.html \
 		test_browserElement_oop_TargetBlank.html \
 		test_browserElement_oop_PromptCheck.html \
 		test_browserElement_oop_PromptConfirm.html \
 		test_browserElement_oop_Close.html \
 		test_browserElement_oop_CloseFromOpener.html \
-		test_browserElement_oop_CloseApp.html \
 		test_browserElement_oop_OpenWindow.html \
 		test_browserElement_oop_OpenWindowInFrame.html \
 		test_browserElement_oop_OpenWindowRejected.html \
 		test_browserElement_oop_OpenWindowDifferentOrigin.html \
 		test_browserElement_oop_OpenNamed.html \
 		test_browserElement_oop_SecurityChange.html \
 		test_browserElement_oop_BackForward.html \
 		test_browserElement_oop_Reload.html \
deleted file mode 100644
--- a/dom/browser-element/mochitest/browserElement_CloseApp.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Any copyright is dedicated to the public domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Bug 789392 - Test that apps frames can trigger mozbrowserclose by calling
-// window.close(), but browser frames cannot.
-"use strict";
-
-SimpleTest.waitForExplicitFinish();
-
-function runTest() {
-  browserElementTestHelpers.setEnabledPref(true);
-  browserElementTestHelpers.addPermission();
-
-  // Our app frame and browser frame load the same content.  That content calls
-  // window.close() and then alert().  We should get a mozbrowserclose event on
-  // the app frame before the mozbrowsershowmodalprompt, but not on the browser
-  // frame.
-
-  var appFrame = document.createElement('iframe');
-  appFrame.mozbrowser = true;
-  appFrame.setAttribute('mozapp', 'http://example.org/manifest.webapp');
-
-  var browserFrame = document.createElement('iframe');
-  browserFrame.mozbrowser = true;
-
-  var gotAppFrameClose = false;
-  appFrame.addEventListener('mozbrowserclose', function() {
-    ok(true, "Got close from app frame.");
-    gotAppFrameClose = true;
-  });
-
-  var gotAppFrameAlert = false;
-  appFrame.addEventListener('mozbrowsershowmodalprompt', function() {
-    ok(gotAppFrameClose, "Should have gotten app frame close by now.");
-    ok(!gotAppFrameAlert, "Just one alert from the app frame.");
-    gotAppFrameAlert = true;
-    if (gotBrowserFrameAlert && gotAppFrameAlert) {
-      SimpleTest.finish();
-    }
-  });
-
-  browserFrame.addEventListener('mozbrowserclose', function() {
-    ok(false, "Got close from browser frame.");
-  });
-
-  var gotBrowserFrameAlert = false;
-  browserFrame.addEventListener('mozbrowsershowmodalprompt', function() {
-    ok(!gotBrowserFrameAlert, "Just one browser frame alert.");
-    gotBrowserFrameAlert = true;
-    if (gotBrowserFrameAlert && gotAppFrameAlert) {
-      SimpleTest.finish();
-    }
-  });
-
-  document.body.appendChild(appFrame);
-  document.body.appendChild(browserFrame);
-
-  appFrame.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_CloseApp.html';
-  browserFrame.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_CloseApp.html';
-}
-
-// The test harness sets dom.allow_scripts_to_close_windows to true (as of
-// writing, anyway).  But that means that browser tabs can close themselves,
-// which is what we want to test /can't/ happen!   For the purposes of this
-// test (and normal browser operation), this pref should be false.
-SpecialPowers.pushPrefEnv({'set': [['dom.allow_scripts_to_close_windows', false]]}, runTest);
deleted file mode 100644
--- a/dom/browser-element/mochitest/file_browserElement_CloseApp.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<html>
-<body>
-
-file_browserElement_CloseApp.html
-
-<script>
-window.close();
-alert('called close');
-</script>
-
-</body>
-</html>
deleted file mode 100644
--- a/dom/browser-element/mochitest/test_browserElement_inproc_CloseApp.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for Bug 789392</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<script type="application/javascript;version=1.7" src="browserElement_CloseApp.js">
-</script>
-</body>
-</html>
\ No newline at end of file
deleted file mode 100644
--- a/dom/browser-element/mochitest/test_browserElement_oop_CloseApp.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for Bug 789392</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="browserElementTestHelpers.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<script type="application/javascript;version=1.7" src="browserElement_CloseApp.js">
-</script>
-</body>
-</html>
\ No newline at end of file
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -769,22 +769,18 @@ ContentParent::~ContentParent()
     NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
     // We should be removed from all these lists in ActorDestroy.
     MOZ_ASSERT(!gPrivateContent || !gPrivateContent->Contains(this));
     if (mAppManifestURL.IsEmpty()) {
         MOZ_ASSERT(!gNonAppContentParents ||
                    !gNonAppContentParents->Contains(this));
     } else {
-        // In general, we expect gAppContentParents->Get(mAppManifestURL) to be
-        // NULL.  But it could be that we created another ContentParent for this
-        // app after we did this->ActorDestroy(), so the right check is that
-        // gAppContentParent->Get(mAppManifestURL) != this.
         MOZ_ASSERT(!gAppContentParents ||
-                   gAppContentParents->Get(mAppManifestURL) != this);
+                   !gAppContentParents->Get(mAppManifestURL));
     }
 }
 
 bool
 ContentParent::IsAlive()
 {
     return mIsAlive;
 }
--- a/testing/mochitest/android.json
+++ b/testing/mochitest/android.json
@@ -125,17 +125,16 @@
  "docshell/test/test_bug413310.html": "",
  "docshell/test/test_bug598895.html": "",
  "docshell/test/test_bug637644.html": "",
  "docshell/test/test_bug668513.html": "RANDOM",
  "dom/browser-element/mochitest/test_browserElement_oop_SecurityChange.html": "TIMED_OUT, bug 766586",
  "dom/browser-element/mochitest/test_browserElement_inproc_AppFramePermission.html": "",
  "dom/browser-element/mochitest/test_browserElement_inproc_AppWindowNamespace.html": "TIMED_OUT, bug 783509",
  "dom/browser-element/mochitest/test_browserElement_inproc_SecurityChange.html": "TIMED_OUT, bug 766586",
- "dom/browser-element/mochitest/test_browserElement_inproc_CloseApp.html": "FAILS, bug 796982",
  "dom/devicestorage": "bug 781789 & bug 782275",
  "dom/imptests/editing/conformancetest/test_event.html": "",
  "dom/imptests/editing/conformancetest/test_runtest.html": "",
  "dom/imptests/editing/selecttest/test_addRange.html": "bug 775227",
  "dom/imptests/html/tests/submission/Mozilla/test_window-onerror-parse-error.html": "",
  "dom/imptests/html/tests/submission/Mozilla/test_window-onerror-runtime-error-throw.html": "",
  "dom/imptests/html/tests/submission/Mozilla/test_window-onerror-runtime-error.html": "",
  "dom/imptests/webapps/DOMCore/tests/approved/test_Range-cloneContents.html": "bug 775227",