Backed out changeset dc22b1e92554 (bug 1009648) for Windows debug shutdown crashes.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-08-09 00:49:19 -04:00
parent ce0490d6fb
commit 1b6596a43d
3 changed files with 29 additions and 70 deletions

View File

@ -1135,14 +1135,11 @@ nsStandardURL::SetSpec(const nsACString &input)
LOG(("nsStandardURL::SetSpec [spec=%s]\n", spec));
if (!spec || !*spec)
return NS_ERROR_MALFORMED_URI;
// Make a backup of the curent URL
nsStandardURL prevURL;
prevURL.CopyMembers(this, eHonorRef);
Clear();
if (!spec || !*spec)
return NS_OK;
// filter out unexpected chars "\r\n\t" if necessary
nsAutoCString buf1;
if (net_FilterURIString(spec, buf1)) {
@ -1160,9 +1157,6 @@ nsStandardURL::SetSpec(const nsACString &input)
if (NS_FAILED(rv)) {
Clear();
// If parsing the spec has failed, restore the old URL
// so we don't end up with an empty URL.
CopyMembers(&prevURL, eHonorRef);
return rv;
}
@ -1841,54 +1835,36 @@ nsStandardURL::CloneInternal(nsStandardURL::RefHandlingEnum refHandlingMode,
if (!clone)
return NS_ERROR_OUT_OF_MEMORY;
// Copy local members into clone.
// Also copies the cached members mFile, mHostA
clone->CopyMembers(this, refHandlingMode, true);
clone.forget(result);
return NS_OK;
}
nsresult nsStandardURL::CopyMembers(nsStandardURL * source,
nsStandardURL::RefHandlingEnum refHandlingMode, bool copyCached)
{
mSpec = source->mSpec;
mDefaultPort = source->mDefaultPort;
mPort = source->mPort;
mScheme = source->mScheme;
mAuthority = source->mAuthority;
mUsername = source->mUsername;
mPassword = source->mPassword;
mHost = source->mHost;
mPath = source->mPath;
mFilepath = source->mFilepath;
mDirectory = source->mDirectory;
mBasename = source->mBasename;
mExtension = source->mExtension;
mQuery = source->mQuery;
mRef = source->mRef;
mOriginCharset = source->mOriginCharset;
mURLType = source->mURLType;
mParser = source->mParser;
mMutable = true;
mSupportsFileURL = source->mSupportsFileURL;
mHostEncoding = source->mHostEncoding;
if (copyCached) {
mFile = source->mFile;
mHostA = source->mHostA ? strdup(source->mHostA) : nullptr;
mSpecEncoding = source->mSpecEncoding;
} else {
// The same state as after calling InvalidateCache()
mFile = nullptr;
mHostA = nullptr;
mSpecEncoding = eEncoding_Unknown;
}
clone->mSpec = mSpec;
clone->mDefaultPort = mDefaultPort;
clone->mPort = mPort;
clone->mScheme = mScheme;
clone->mAuthority = mAuthority;
clone->mUsername = mUsername;
clone->mPassword = mPassword;
clone->mHost = mHost;
clone->mPath = mPath;
clone->mFilepath = mFilepath;
clone->mDirectory = mDirectory;
clone->mBasename = mBasename;
clone->mExtension = mExtension;
clone->mQuery = mQuery;
clone->mRef = mRef;
clone->mOriginCharset = mOriginCharset;
clone->mURLType = mURLType;
clone->mParser = mParser;
clone->mFile = mFile;
clone->mHostA = mHostA ? strdup(mHostA) : nullptr;
clone->mMutable = true;
clone->mSupportsFileURL = mSupportsFileURL;
clone->mHostEncoding = mHostEncoding;
clone->mSpecEncoding = mSpecEncoding;
if (refHandlingMode == eIgnoreRef) {
SetRef(EmptyCString());
clone->SetRef(EmptyCString());
}
clone.forget(result);
return NS_OK;
}

View File

@ -156,10 +156,6 @@ protected:
// Helper to share code between Clone methods.
nsresult CloneInternal(RefHandlingEnum aRefHandlingMode,
nsIURI** aClone);
// Helper method that copies member variables from the source StandardURL
// if copyCached = true, it will also copy mFile and mHostA
nsresult CopyMembers(nsStandardURL * source, RefHandlingEnum mode,
bool copyCached = false);
// Helper for subclass implementation of GetFile(). Subclasses that map
// URIs to files in a special way should implement this method. It should

View File

@ -208,18 +208,6 @@ function test_ipv6_fail()
Assert.throws(() => { url.hostPort = "[2001::1]:bad"; }, "bad port number");
}
function test_clearedSpec()
{
var url = stringToURL("http://example.com/path");
Assert.throws(() => { url.spec = "http: example"; }, "set bad spec");
Assert.throws(() => { url.spec = ""; }, "set empty spec");
do_check_eq(url.spec, "http://example.com/path");
url.host = "allizom.org";
var ref = stringToURL("http://allizom.org/path");
symmetricEquality(true, url, ref);
}
function run_test()
{
test_setEmptyPath();
@ -227,5 +215,4 @@ function run_test()
test_setRef();
test_ipv6();
test_ipv6_fail();
test_clearedSpec();
}