Merge the last green changeset on mozilla-inbound to mozilla-central

This commit is contained in:
Ehsan Akhgari 2011-07-21 11:11:45 -04:00
Родитель 12fb31c956 c995e5116d
Коммит cd1a1bbd1b
17 изменённых файлов: 190 добавлений и 74 удалений

Просмотреть файл

@ -643,7 +643,7 @@ nsHTMLSelectElement::GetSelectFrame()
return select_frame;
}
NS_IMETHODIMP
nsresult
nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement,
nsIDOMHTMLElement* aBefore)
{
@ -679,6 +679,44 @@ nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement,
return parent->InsertBefore(aElement, aBefore, getter_AddRefs(added));
}
NS_IMETHODIMP
nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement,
nsIVariant* aBefore)
{
PRUint16 dataType;
nsresult rv = aBefore->GetDataType(&dataType);
NS_ENSURE_SUCCESS(rv, rv);
// aBefore is omitted or null
if (dataType == nsIDataType::VTYPE_EMPTY) {
return Add(aElement);
}
nsCOMPtr<nsISupports> supports;
nsCOMPtr<nsIDOMHTMLElement> beforeElement;
// whether aBefore is nsIDOMHTMLElement...
if (NS_SUCCEEDED(aBefore->GetAsISupports(getter_AddRefs(supports)))) {
beforeElement = do_QueryInterface(supports);
NS_ENSURE_TRUE(beforeElement, NS_ERROR_DOM_SYNTAX_ERR);
return Add(aElement, beforeElement);
}
// otherwise, whether aBefore is long
PRInt32 index;
NS_ENSURE_SUCCESS(aBefore->GetAsInt32(&index), NS_ERROR_DOM_SYNTAX_ERR);
// If item index is out of range, insert to last.
// (since beforeElement becomes null, it is inserted to last)
nsCOMPtr<nsIDOMNode> beforeNode;
if (NS_SUCCEEDED(Item(index, getter_AddRefs(beforeNode)))) {
beforeElement = do_QueryInterface(beforeNode);
}
return Add(aElement, beforeElement);
}
NS_IMETHODIMP
nsHTMLSelectElement::Remove(PRInt32 aIndex)
{
@ -2194,35 +2232,17 @@ nsHTMLOptionCollection::GetSelect(nsIDOMHTMLSelectElement **aReturn)
NS_IMETHODIMP
nsHTMLOptionCollection::Add(nsIDOMHTMLOptionElement *aOption,
PRInt32 aIndex, PRUint8 optional_argc)
nsIVariant *aBefore)
{
if (!aOption) {
return NS_ERROR_INVALID_ARG;
}
if (aIndex < -1) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
if (!mSelect) {
return NS_ERROR_NOT_INITIALIZED;
}
PRUint32 length;
GetLength(&length);
if (optional_argc == 0 || aIndex == -1 || aIndex > (PRInt32)length) {
// IE appends in these cases
aIndex = length;
}
nsCOMPtr<nsIDOMNode> beforeNode;
Item(aIndex, getter_AddRefs(beforeNode));
nsCOMPtr<nsIDOMHTMLOptionElement> beforeElement =
do_QueryInterface(beforeNode);
return mSelect->Add(aOption, beforeElement);
return mSelect->Add(aOption, aBefore);
}
NS_IMETHODIMP

Просмотреть файл

@ -612,6 +612,11 @@ protected:
return mSelectionHasChanged;
}
/**
* Insert aElement before the node given by aBefore
*/
nsresult Add(nsIDOMHTMLElement* aElement, nsIDOMHTMLElement* aBefore = nsnull);
/** The options[] array */
nsRefPtr<nsHTMLOptionCollection> mOptions;
/** false if the parser is in the middle of adding children. */

Просмотреть файл

@ -276,6 +276,7 @@ _TEST_FILES = \
test_bug659743.xml \
test_bug660663.html \
test_bug664299.html \
test_bug666200.html \
test_bug666666.html \
test_restore_from_parser_fragment.html \
$(NULL)

Просмотреть файл

@ -0,0 +1,40 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=666200
-->
<head>
<title>Test for Bug 666200</title>
<script type="text/javascript" src="/MochiKit/packed.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=666200">Mozilla Bug 666200</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 666200 **/
var sel = document.createElement("select");
var opt1 = new Option();
var opt2 = new Option();
var opt3 = new Option();
var opt4 = new Option();
opt1.value = 1;
opt2.value = 2;
opt3.value = 3;
opt4.value = 4;
sel.add(opt1);
sel.add(opt2, 0);
sel.add(opt3, 1000);
sel.options.add(opt4, opt3);
is(sel[0], opt2, "1st item should be 2");
is(sel[1], opt1, "2nd item should be 1");
is(sel[2], opt4, "3rd item should be 4");
is(sel[3], opt3, "4th item should be 3");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -77,17 +77,6 @@ export:: sqlite-version.h
endif
endif
ifdef GNU_CC
MODULE_OPTIMIZE_FLAGS = -O2
else
ifeq ($(OS_ARCH),SunOS)
MODULE_OPTIMIZE_FLAGS = -xO5
endif
ifeq ($(OS_ARCH),WINNT)
MODULE_OPTIMIZE_FLAGS = -O2
endif
endif
EXPORTS = \
sqlite3.h \
$(NULL)

Просмотреть файл

@ -53,7 +53,7 @@
interface nsIDOMValidityState;
[scriptable, uuid(5aeb2480-cb21-4483-b9b3-0c914502eb81)]
[scriptable, uuid(069bc0d8-d16d-406a-8555-2f84384c9b3b)]
interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement
{
attribute boolean autofocus;
@ -69,8 +69,12 @@ interface nsIDOMHTMLSelectElement : nsIDOMHTMLElement
attribute unsigned long length;
nsIDOMNode item(in unsigned long index);
nsIDOMNode namedItem(in DOMString name);
// This add method implementation means the following
// since IDL doesn't support overfload.
// void add(in nsIDOMHTMLElement, [optional] in nsIDOMHTMLElement)
// void add(in nsIDOMHTMLElement, in long)
void add(in nsIDOMHTMLElement element,
[optional] in nsIDOMHTMLElement before)
[optional] in nsIVariant before)
raises(DOMException);
void remove(in long index);

Просмотреть файл

@ -41,8 +41,9 @@
interface nsIDOMHTMLOptionElement;
interface nsIDOMHTMLSelectElement;
interface nsIVariant;
[scriptable, uuid(a4f2b279-8096-48ea-8a95-640c5a55b697)]
[scriptable, uuid(03bd61d6-b851-465a-ab3f-99945f77cfa5)]
interface nsIDOMNSHTMLOptionCollection : nsISupports
{
attribute long selectedIndex;
@ -52,7 +53,12 @@ interface nsIDOMNSHTMLOptionCollection : nsISupports
[noscript] readonly attribute nsIDOMHTMLSelectElement select;
[optional_argc] void add(in nsIDOMHTMLOptionElement option,
[optional] in long index);
// This add method implementation means the following
// since IDL doesn't support overfload.
// void add(in nsIDOMHTMLOptionElement,
// [optional] in nsIDOMHTMLOptionElement)
// void add(in nsIDOMHTMLOptionElement, in long)
void add(in nsIDOMHTMLOptionElement option,
[optional] in nsIVariant before);
void remove(in long index);
};

Просмотреть файл

@ -49,14 +49,6 @@ LIBXUL_LIBRARY = 1
ifdef GNU_CC
OS_CXXFLAGS := $(filter-out -pedantic,$(OS_CXXFLAGS))
MODULE_OPTIMIZE_FLAGS = -O2
else
ifeq ($(OS_ARCH),SunOS)
MODULE_OPTIMIZE_FLAGS = -xO5
endif
ifeq ($(OS_ARCH),WINNT)
MODULE_OPTIMIZE_FLAGS = -O2
endif
endif

Просмотреть файл

@ -48,17 +48,6 @@ MODULE = libpixman
LIBRARY_NAME = mozlibpixman
LIBXUL_LIBRARY = 1
ifdef GNU_CC
MODULE_OPTIMIZE_FLAGS = -O2
else
ifeq ($(OS_ARCH),SunOS)
MODULE_OPTIMIZE_FLAGS = -xO5
endif
ifeq ($(OS_ARCH),WINNT)
MODULE_OPTIMIZE_FLAGS = -O2
endif
endif
DEFINES += -DPIXMAN_NO_TLS
# Build MMX code either with VC or with gcc-on-x86

Просмотреть файл

@ -449,7 +449,16 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
# ifdef ANDROID
path += "/lib";
# endif // ANDROID
newEnvVars["LD_LIBRARY_PATH"] = path.get();
const char *ld_library_path = PR_GetEnv("LD_LIBRARY_PATH");
nsCString new_ld_lib_path;
if (ld_library_path && *ld_library_path) {
new_ld_lib_path.Assign(ld_library_path);
new_ld_lib_path.AppendLiteral(":");
new_ld_lib_path.Append(path.get());
newEnvVars["LD_LIBRARY_PATH"] = new_ld_lib_path.get();
} else {
newEnvVars["LD_LIBRARY_PATH"] = path.get();
}
# elif OS_MACOSX
newEnvVars["DYLD_LIBRARY_PATH"] = path.get();
// XXX DYLD_INSERT_LIBRARIES should only be set when launching a plugin

Просмотреть файл

@ -276,7 +276,7 @@ CompartmentCallback(JSContext *cx, JSCompartment *compartment, uintN op)
XPCCompartmentMap &map = self->GetCompartmentMap();
#ifdef DEBUG
{
JSCompartment *current;
JSCompartment *current = NULL; // init to shut GCC up
NS_ASSERTION(map.Get(key, &current), "no compartment?");
NS_ASSERTION(current == compartment, "compartment mismatch");
}
@ -1300,6 +1300,59 @@ NS_MEMORY_REPORTER_IMPLEMENT(XPConnectJSStack,
"of the stack; any uncommitted portion is not measured because it "
"hardly costs anything.")
static PRInt64
GetJSSystemCompartmentCount()
{
JSRuntime *rt = nsXPConnect::GetRuntimeInstance()->GetJSRuntime();
size_t n = 0;
for (size_t i = 0; i < rt->compartments.length(); i++) {
if (rt->compartments[i]->isSystemCompartment) {
n++;
}
}
return n;
}
static PRInt64
GetJSUserCompartmentCount()
{
JSRuntime *rt = nsXPConnect::GetRuntimeInstance()->GetJSRuntime();
size_t n = 0;
for (size_t i = 0; i < rt->compartments.length(); i++) {
if (!rt->compartments[i]->isSystemCompartment) {
n++;
}
}
return n;
}
// Nb: js-system-compartment-count + js-user-compartment-count could be
// different to the number of compartments reported by
// XPConnectJSCompartmentsMultiReporter if a garbage collection occurred
// between them being consulted. We could move these reporters into
// XPConnectJSCompartmentCount to avoid that problem, but then we couldn't
// easily report them via telemetry, so we live with the small risk of
// inconsistencies.
NS_MEMORY_REPORTER_IMPLEMENT(XPConnectJSSystemCompartmentCount,
"js-compartments-system",
KIND_OTHER,
nsIMemoryReporter::UNITS_COUNT,
GetJSSystemCompartmentCount,
"The number of JavaScript compartments for system code. The sum of this "
"and 'js-compartments-user' might not match the number of "
"compartments listed under 'js' if a garbage collection occurs at an "
"inopportune time, but such cases should be rare.")
NS_MEMORY_REPORTER_IMPLEMENT(XPConnectJSUserCompartmentCount,
"js-compartments-user",
KIND_OTHER,
nsIMemoryReporter::UNITS_COUNT,
GetJSUserCompartmentCount,
"The number of JavaScript compartments for user code. The sum of this "
"and 'js-compartments-system' might not match the number of "
"compartments listed under 'js' if a garbage collection occurs at an "
"inopportune time, but such cases should be rare.")
class XPConnectJSCompartmentsMultiReporter : public nsIMemoryMultiReporter
{
private:
@ -1798,6 +1851,8 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSGCHeap));
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSStack));
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSSystemCompartmentCount));
NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(XPConnectJSUserCompartmentCount));
NS_RegisterMemoryMultiReporter(new XPConnectJSCompartmentsMultiReporter);
}

Просмотреть файл

@ -126,7 +126,6 @@ NO_INSTALL_IMPORT_LIBRARY = 1
endif
else # Not Windows
MODULE_OPTIMIZE_FLAGS = -O2
ifeq ($(OS_ARCH),SunOS)
ifndef GNU_CC
MODULE_OPTIMIZE_FLAGS = -xO5

Просмотреть файл

@ -359,6 +359,8 @@ function run_test() {
// loading our former savePrefFile should allow us to read former prefs
ps.readUserPrefs(savePrefFile);
// cleanup the file now we don't need it
savePrefFile.remove(false);
do_check_eq(ps.getBoolPref("ReadPref.bool"), true);
do_check_eq(ps.getIntPref("ReadPref.int"), 230);
do_check_eq(ps.getCharPref("ReadPref.char"), "hello");

Просмотреть файл

@ -80,7 +80,7 @@ function submitPendingReport(event) {
if (CrashSubmit.submit(id, { submitSuccess: submitSuccess,
submitError: submitError,
noThrottle: true })) {
link.className = "submitting";
link.className = "submitting";
}
event.preventDefault();
return false;

Просмотреть файл

@ -46,6 +46,7 @@
#include <CoreFoundation/CoreFoundation.h>
#elif defined(XP_UNIX)
#include <sys/stat.h>
#include <string.h>
#endif
namespace mozilla {
@ -102,10 +103,11 @@ private:
// multiple applications, we will try a series of techniques:
//
// 1) use realpath() on argv[0], which works unless we're loaded from the
// PATH
// PATH. Only do so if argv[0] looks like a path (contains a /).
// 2) manually walk through the PATH and look for ourself
// 3) give up
if (realpath(argv0, aResult) && stat(aResult, &fileStat) == 0)
if (strchr(argv0, '/') && realpath(argv0, aResult) &&
stat(aResult, &fileStat) == 0)
return NS_OK;
const char *path = getenv("PATH");

Просмотреть файл

@ -422,34 +422,33 @@ NS_InitXPCOM2(nsIServiceManager* *result,
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIFile> xpcomLib;
PRBool value;
if (binDirectory)
{
rv = binDirectory->IsDirectory(&value);
if (NS_SUCCEEDED(rv) && value) {
nsDirectoryService::gService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory);
binDirectory->Clone(getter_AddRefs(xpcomLib));
}
}
else {
nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
NS_GET_IID(nsIFile),
getter_AddRefs(xpcomLib));
if (appFileLocationProvider) {
rv = nsDirectoryService::gService->RegisterProvider(appFileLocationProvider);
if (NS_FAILED(rv)) return rv;
}
nsCOMPtr<nsIFile> xpcomLib;
nsDirectoryService::gService->Get(NS_GRE_DIR,
NS_GET_IID(nsIFile),
getter_AddRefs(xpcomLib));
if (xpcomLib) {
xpcomLib->AppendNative(nsDependentCString(XPCOM_DLL));
nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib);
}
if (appFileLocationProvider) {
rv = nsDirectoryService::gService->RegisterProvider(appFileLocationProvider);
if (NS_FAILED(rv)) return rv;
}
NS_TIME_FUNCTION_MARK("Next: Omnijar init");
if (!mozilla::Omnijar::IsInitialized()) {

Просмотреть файл

@ -117,6 +117,8 @@ for (testnum = 1; testnum <= 15; testnum++) {
// read new file and make sure the contents are the same.
parser = parserForFile(newfilename);
checkParserOutput(parser, testdata[testnum - 1].reference);
// cleanup after the test
newfile.remove(false);
}
/* ========== 16 ========== */
@ -143,6 +145,8 @@ checkParserOutput(parser, {section: {key: "value"} });
// read it in again, check for same data.
parser = parserForFile("data/nonexistent-file.ini");
checkParserOutput(parser, {section: {key: "value"} });
// cleanup after the test
newfile.remove(false);
/* ========== 17 ========== */