зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 9059416d26cf to see whether that fixes Linux unit tests
This commit is contained in:
Родитель
d25d7b370c
Коммит
6fbd73ca25
|
@ -22,7 +22,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Neil Deakin <enndeakin@sympatico.ca>
|
* Neil Deakin <enndeakin@sympatico.ca>
|
||||||
* Johnny Stenback <jst@mozilla.com>
|
* Johnny Stenback <jst@mozilla.com>
|
||||||
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||||
|
@ -60,8 +59,6 @@
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsIOfflineCacheUpdate.h"
|
#include "nsIOfflineCacheUpdate.h"
|
||||||
#include "nsIJSContextStack.h"
|
#include "nsIJSContextStack.h"
|
||||||
#include "nsIPrivateBrowsingService.h"
|
|
||||||
#include "nsNetCID.h"
|
|
||||||
|
|
||||||
static const PRUint32 ASK_BEFORE_ACCEPT = 1;
|
static const PRUint32 ASK_BEFORE_ACCEPT = 1;
|
||||||
static const PRUint32 ACCEPT_SESSION = 2;
|
static const PRUint32 ACCEPT_SESSION = 2;
|
||||||
|
@ -213,11 +210,6 @@ nsSessionStorageEntry::~nsSessionStorageEntry()
|
||||||
|
|
||||||
nsDOMStorageManager* nsDOMStorageManager::gStorageManager;
|
nsDOMStorageManager* nsDOMStorageManager::gStorageManager;
|
||||||
|
|
||||||
nsDOMStorageManager::nsDOMStorageManager()
|
|
||||||
: mInPrivateBrowsing(PR_FALSE)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS2(nsDOMStorageManager,
|
NS_IMPL_ISUPPORTS2(nsDOMStorageManager,
|
||||||
nsIDOMStorageManager,
|
nsIDOMStorageManager,
|
||||||
nsIObserver)
|
nsIObserver)
|
||||||
|
@ -242,12 +234,6 @@ nsDOMStorageManager::Initialize()
|
||||||
if (os) {
|
if (os) {
|
||||||
os->AddObserver(gStorageManager, "cookie-changed", PR_FALSE);
|
os->AddObserver(gStorageManager, "cookie-changed", PR_FALSE);
|
||||||
os->AddObserver(gStorageManager, "offline-app-removed", PR_FALSE);
|
os->AddObserver(gStorageManager, "offline-app-removed", PR_FALSE);
|
||||||
os->AddObserver(gStorageManager, NS_PRIVATE_BROWSING_SWITCH_TOPIC, PR_FALSE);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIPrivateBrowsingService> pbs =
|
|
||||||
do_GetService(NS_PRIVATE_BROWSING_SERVICE_CONTRACTID);
|
|
||||||
if (pbs)
|
|
||||||
pbs->GetPrivateBrowsingEnabled(&gStorageManager->mInPrivateBrowsing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -346,12 +332,6 @@ nsDOMStorageManager::Observe(nsISupports *aSubject,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
return nsDOMStorage::gStorageDB->RemoveOwners(domains, PR_FALSE);
|
return nsDOMStorage::gStorageDB->RemoveOwners(domains, PR_FALSE);
|
||||||
#endif
|
#endif
|
||||||
} else if (!strcmp(aTopic, NS_PRIVATE_BROWSING_SWITCH_TOPIC)) {
|
|
||||||
mStorages.EnumerateEntries(ClearStorage, nsnull);
|
|
||||||
if (!nsCRT::strcmp(aData, NS_LITERAL_STRING(NS_PRIVATE_BROWSING_ENTER).get()))
|
|
||||||
mInPrivateBrowsing = PR_TRUE;
|
|
||||||
else if (!nsCRT::strcmp(aData, NS_LITERAL_STRING(NS_PRIVATE_BROWSING_LEAVE).get()))
|
|
||||||
mInPrivateBrowsing = PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -1030,7 +1010,6 @@ void
|
||||||
nsDOMStorage::ClearAll()
|
nsDOMStorage::ClearAll()
|
||||||
{
|
{
|
||||||
mItems.EnumerateEntries(ClearStorageItem, nsnull);
|
mItems.EnumerateEntries(ClearStorageItem, nsnull);
|
||||||
mItemsCached = PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PLDHashOperator
|
static PLDHashOperator
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
* Neil Deakin <enndeakin@sympatico.ca>
|
* Neil Deakin <enndeakin@sympatico.ca>
|
||||||
* Johnny Stenback <jst@mozilla.com>
|
* Johnny Stenback <jst@mozilla.com>
|
||||||
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
|
||||||
*
|
*
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||||
|
@ -97,15 +96,11 @@ public:
|
||||||
// nsIObserver
|
// nsIObserver
|
||||||
NS_DECL_NSIOBSERVER
|
NS_DECL_NSIOBSERVER
|
||||||
|
|
||||||
nsDOMStorageManager();
|
|
||||||
|
|
||||||
void AddToStoragesHash(nsDOMStorage* aStorage);
|
void AddToStoragesHash(nsDOMStorage* aStorage);
|
||||||
void RemoveFromStoragesHash(nsDOMStorage* aStorage);
|
void RemoveFromStoragesHash(nsDOMStorage* aStorage);
|
||||||
|
|
||||||
nsresult ClearAllStorages();
|
nsresult ClearAllStorages();
|
||||||
|
|
||||||
PRBool InPrivateBrowsingMode() { return mInPrivateBrowsing; }
|
|
||||||
|
|
||||||
static nsresult Initialize();
|
static nsresult Initialize();
|
||||||
static nsDOMStorageManager* GetInstance();
|
static nsDOMStorageManager* GetInstance();
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
|
@ -115,7 +110,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
nsTHashtable<nsDOMStorageEntry> mStorages;
|
nsTHashtable<nsDOMStorageEntry> mStorages;
|
||||||
PRBool mInPrivateBrowsing;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsDOMStorage : public nsIDOMStorage,
|
class nsDOMStorage : public nsIDOMStorage,
|
||||||
|
@ -146,10 +140,7 @@ public:
|
||||||
// This call relies on mSessionOnly, and should only be used
|
// This call relies on mSessionOnly, and should only be used
|
||||||
// after a CacheStoragePermissions() call. See the comments
|
// after a CacheStoragePermissions() call. See the comments
|
||||||
// for mSessionOnly below.
|
// for mSessionOnly below.
|
||||||
PRBool UseDB() {
|
PRBool UseDB() { return mUseDB && !mSessionOnly; }
|
||||||
return mUseDB && !mSessionOnly &&
|
|
||||||
!nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check whether storage may be used by the caller, and whether it
|
// Check whether storage may be used by the caller, and whether it
|
||||||
// is session only. Returns true if storage may be used.
|
// is session only. Returns true if storage may be used.
|
||||||
|
|
|
@ -93,8 +93,6 @@ _TEST_FILES = \
|
||||||
test_bug458091.html \
|
test_bug458091.html \
|
||||||
bug458091_child.html \
|
bug458091_child.html \
|
||||||
test_bug459848.html \
|
test_bug459848.html \
|
||||||
test_bug463000.html \
|
|
||||||
iframe_bug463000.html \
|
|
||||||
test_bug465263.html \
|
test_bug465263.html \
|
||||||
test_bug479143.html \
|
test_bug479143.html \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
|
@ -1,152 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Child window for the private browsing test</title>
|
|
||||||
<script type="application/javascript">
|
|
||||||
|
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
const Cc = Components.classes;
|
|
||||||
const Ci = Components.interfaces;
|
|
||||||
const Cr = Components.results;
|
|
||||||
|
|
||||||
var _PBSvc = null;
|
|
||||||
function get_PBSvc() {
|
|
||||||
if (_PBSvc)
|
|
||||||
return _PBSvc;
|
|
||||||
|
|
||||||
try {
|
|
||||||
_PBSvc = Cc["@mozilla.org/privatebrowsing;1"].
|
|
||||||
getService(Ci.nsIPrivateBrowsingService);
|
|
||||||
return _PBSvc;
|
|
||||||
} catch (e) {}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function run()
|
|
||||||
{
|
|
||||||
var storage;
|
|
||||||
|
|
||||||
var message = "child-response";
|
|
||||||
|
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
|
|
||||||
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
|
||||||
getService(Ci.nsIPrefBranch);
|
|
||||||
prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
|
||||||
|
|
||||||
var pb = get_PBSvc();
|
|
||||||
// The private browsing service might not be available
|
|
||||||
if (pb) {
|
|
||||||
try {
|
|
||||||
storage = globalStorage["example.org"];
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
message += "\n failed globalStorage[\"example.org\"]";
|
|
||||||
}
|
|
||||||
|
|
||||||
// save Pair-A
|
|
||||||
try {
|
|
||||||
storage.key1 = "value-1";
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
message += "\n failed to store Pair-A";
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure that Pair-A exists
|
|
||||||
try {
|
|
||||||
if (storage.key1 != "value-1")
|
|
||||||
throw "error";
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
if (ex == "error")
|
|
||||||
message += "\n Pair-A was not saved correctly";
|
|
||||||
else
|
|
||||||
message += "\n Unexpected exception encountered while checking Pair-A: " + ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
// enter the private browsing mode
|
|
||||||
try {
|
|
||||||
pb.privateBrowsingEnabled = true;
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
message += "\n failed to enter the private browsing mode";
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure that Pair-A does not exist
|
|
||||||
try {
|
|
||||||
// because of bug 426436, |typeof storage.key1 != "undefined"| wouldn't work here
|
|
||||||
if (storage.key1 != "")
|
|
||||||
throw "error";
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
if (ex == "error")
|
|
||||||
message += "\n Pair-A existed unexpectedly";
|
|
||||||
else
|
|
||||||
message += "\n Unexpected exception encountered while checking Pair-A (2): " + ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
// attempt to save Pair-B
|
|
||||||
try {
|
|
||||||
storage.key2 = "value-2";
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
message += "\n failed to store Pair-B";
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure that Pair-B exists
|
|
||||||
try {
|
|
||||||
if (storage.key2 != "value-2")
|
|
||||||
throw "error";
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
if (ex == "error")
|
|
||||||
message += "\n Pair-B was not retrieved correctly";
|
|
||||||
else
|
|
||||||
message += "\n Unexpected exception encountered while checking Pair-B: " + ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
// exit the private browsing mode
|
|
||||||
try {
|
|
||||||
pb.privateBrowsingEnabled = false;
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
message += "\n failed to exit the private browsing mode";
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure that Pair-A exists
|
|
||||||
try {
|
|
||||||
if (storage.key1 != "value-1")
|
|
||||||
throw "error";
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
if (ex == "error")
|
|
||||||
message += "\n Pair-A was not retrieved correctly";
|
|
||||||
else
|
|
||||||
message += "\n Unexpected exception encountered while checking Pair-A (3): " + ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure that Pair-B does not exist
|
|
||||||
try {
|
|
||||||
// because of bug 426436, |typeof storage.key2 != "undefined"| wouldn't work here
|
|
||||||
if (storage.key2 != "")
|
|
||||||
throw "error";
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
if (ex == "error")
|
|
||||||
message += "\n Pair-B existed unexpectedly";
|
|
||||||
else
|
|
||||||
message += "\n Unexpected exception encountered while checking Pair-B (2): " + ex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
|
|
||||||
|
|
||||||
window.parent.postMessage(message, "http://localhost:8888");
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener("load", run, false);
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,39 +0,0 @@
|
||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<!--
|
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=463000
|
|
||||||
-->
|
|
||||||
<head>
|
|
||||||
<title>Test for Bug 463000</title>
|
|
||||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
|
||||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
||||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=463000">Mozilla Bug 463000</a>
|
|
||||||
<p id="display"></p>
|
|
||||||
<div id="content" style="display: none">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<iframe src="http://example.org/tests/dom/tests/mochitest/bugs/iframe_bug463000.html"></iframe>
|
|
||||||
<pre id="test">
|
|
||||||
<script class="testbody" type="text/javascript">
|
|
||||||
/** Test for Bug 463000 **/
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
|
|
||||||
function receiveMessage(evt)
|
|
||||||
{
|
|
||||||
is(evt.data, "child-response", "got wrong response");
|
|
||||||
|
|
||||||
SimpleTest.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener("message", receiveMessage, false);
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</pre>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Загрузка…
Ссылка в новой задаче