From b0d05a91f9617bae647eedef31ba137274cacd64 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Fri, 25 Mar 2011 11:45:00 -0700 Subject: [PATCH 01/57] Bug 645111 - Insert .cfi directives into inline assembly to provide debug info (r=jimb) --HG-- extra : rebase_source : b5bba03505b1c089e9c67554b015e70fded73a54 --- js/src/methodjit/MethodJIT.cpp | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/js/src/methodjit/MethodJIT.cpp b/js/src/methodjit/MethodJIT.cpp index 00d2ba28dfd..2257ccef432 100644 --- a/js/src/methodjit/MethodJIT.cpp +++ b/js/src/methodjit/MethodJIT.cpp @@ -58,6 +58,17 @@ using namespace js; using namespace js::mjit; +#ifdef __GCC_HAVE_DWARF2_CFI_ASM +# define CFI(str) str +#else +# define CFI(str) +#endif + +// Put manually-inserted call frame unwinding information into .debug_frame +// rather than .eh_frame, because we compile with -fno-exceptions which might +// discard the .eh_frame section. (See +// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43232). +CFI(asm(".cfi_sections .debug_frame");) js::mjit::CompilerAllocPolicy::CompilerAllocPolicy(JSContext *cx, Compiler &compiler) : TempAllocPolicy(cx), @@ -208,14 +219,24 @@ asm ( ".globl " SYMBOL_STRING(JaegerTrampoline) "\n" SYMBOL_STRING(JaegerTrampoline) ":" "\n" /* Prologue. */ + CFI(".cfi_startproc" "\n") + CFI(".cfi_def_cfa rsp, 8" "\n") "pushq %rbp" "\n" + CFI(".cfi_def_cfa_offset 16" "\n") + CFI(".cfi_offset rbp, -16" "\n") "movq %rsp, %rbp" "\n" + CFI(".cfi_def_cfa_register rbp" "\n") /* Save non-volatile registers. */ "pushq %r12" "\n" + CFI(".cfi_offset r12, -24" "\n") "pushq %r13" "\n" + CFI(".cfi_offset r13, -32" "\n") "pushq %r14" "\n" + CFI(".cfi_offset r14, -40" "\n") "pushq %r15" "\n" + CFI(".cfi_offset r15, -48" "\n") "pushq %rbx" "\n" + CFI(".cfi_offset rbx, -56" "\n") /* Load mask registers. */ "movq $0xFFFF800000000000, %r13" "\n" @@ -250,12 +271,21 @@ SYMBOL_STRING(JaegerTrampoline) ":" "\n" /* Jump into the JIT'd code. */ "jmp *0(%rsp)" "\n" + CFI(".cfi_endproc" "\n") ); asm ( ".text\n" ".globl " SYMBOL_STRING(JaegerTrampolineReturn) "\n" SYMBOL_STRING(JaegerTrampolineReturn) ":" "\n" + CFI(".cfi_startproc" "\n") + CFI(".cfi_def_cfa rbp, 16" "\n") + CFI(".cfi_offset rbp, -16" "\n") + CFI(".cfi_offset r12, -24" "\n") + CFI(".cfi_offset r13, -32" "\n") + CFI(".cfi_offset r14, -40" "\n") + CFI(".cfi_offset r15, -48" "\n") + CFI(".cfi_offset rbx, -56" "\n") "or %rdi, %rsi" "\n" "movq %rsi, 0x30(%rbx)" "\n" "movq %rsp, %rdi" "\n" @@ -268,14 +298,24 @@ SYMBOL_STRING(JaegerTrampolineReturn) ":" "\n" "popq %r13" "\n" "popq %r12" "\n" "popq %rbp" "\n" + CFI(".cfi_def_cfa rsp, 8" "\n") "movq $1, %rax" "\n" "ret" "\n" + CFI(".cfi_endproc" "\n") ); asm ( ".text\n" ".globl " SYMBOL_STRING(JaegerThrowpoline) "\n" SYMBOL_STRING(JaegerThrowpoline) ":" "\n" + CFI(".cfi_startproc" "\n") + CFI(".cfi_def_cfa rbp, 16" "\n") + CFI(".cfi_offset rbp, -16" "\n") + CFI(".cfi_offset r12, -24" "\n") + CFI(".cfi_offset r13, -32" "\n") + CFI(".cfi_offset r14, -40" "\n") + CFI(".cfi_offset r15, -48" "\n") + CFI(".cfi_offset rbx, -56" "\n") "movq %rsp, %rdi" "\n" "call " SYMBOL_STRING_RELOC(js_InternalThrow) "\n" "testq %rax, %rax" "\n" @@ -291,8 +331,10 @@ SYMBOL_STRING(JaegerThrowpoline) ":" "\n" "popq %r13" "\n" "popq %r12" "\n" "popq %rbp" "\n" + CFI(".cfi_def_cfa rsp, 8" "\n") "xorq %rax,%rax" "\n" "ret" "\n" + CFI(".cfi_endproc" "\n") ); asm ( @@ -352,12 +394,20 @@ asm ( ".globl " SYMBOL_STRING(JaegerTrampoline) "\n" SYMBOL_STRING(JaegerTrampoline) ":" "\n" /* Prologue. */ + CFI(".cfi_startproc" "\n") + CFI(".cfi_def_cfa esp, 4" "\n") "pushl %ebp" "\n" + CFI(".cfi_def_cfa_offset 8" "\n") + CFI(".cfi_offset ebp, -8" "\n") "movl %esp, %ebp" "\n" + CFI(".cfi_def_cfa_register ebp" "\n") /* Save non-volatile registers. */ "pushl %esi" "\n" + CFI(".cfi_offset esi, -12" "\n") "pushl %edi" "\n" + CFI(".cfi_offset edi, -16" "\n") "pushl %ebx" "\n" + CFI(".cfi_offset ebx, -20" "\n") /* Build the JIT frame. Push fields in order, * then align the stack to form esp == VMFrame. */ @@ -380,12 +430,19 @@ SYMBOL_STRING(JaegerTrampoline) ":" "\n" "movl 28(%esp), %ebp" "\n" /* load fp for JIT code */ "jmp *88(%esp)" "\n" + CFI(".cfi_endproc" "\n") ); asm ( ".text\n" ".globl " SYMBOL_STRING(JaegerTrampolineReturn) "\n" SYMBOL_STRING(JaegerTrampolineReturn) ":" "\n" + CFI(".cfi_startproc" "\n") + CFI(".cfi_def_cfa ebp, 8" "\n") + CFI(".cfi_offset ebp, -8" "\n") + CFI(".cfi_offset esi, -12" "\n") + CFI(".cfi_offset edi, -16" "\n") + CFI(".cfi_offset ebx, -20" "\n") "movl %esi, 0x18(%ebp)" "\n" "movl %edi, 0x1C(%ebp)" "\n" "movl %esp, %ebp" "\n" @@ -398,8 +455,10 @@ SYMBOL_STRING(JaegerTrampolineReturn) ":" "\n" "popl %edi" "\n" "popl %esi" "\n" "popl %ebp" "\n" + CFI(".cfi_def_cfa esp, 4" "\n") "movl $1, %eax" "\n" "ret" "\n" + CFI(".cfi_endproc" "\n") ); asm ( @@ -407,6 +466,12 @@ asm ( ".globl " SYMBOL_STRING(JaegerThrowpoline) "\n" SYMBOL_STRING(JaegerThrowpoline) ":" "\n" /* Align the stack to 16 bytes. */ + CFI(".cfi_startproc" "\n") + CFI(".cfi_def_cfa ebp, 8" "\n") + CFI(".cfi_offset ebp, -8" "\n") + CFI(".cfi_offset esi, -12" "\n") + CFI(".cfi_offset edi, -16" "\n") + CFI(".cfi_offset ebx, -20" "\n") "pushl %esp" "\n" "pushl (%esp)" "\n" "pushl (%esp)" "\n" @@ -427,8 +492,10 @@ SYMBOL_STRING(JaegerThrowpoline) ":" "\n" "popl %edi" "\n" "popl %esi" "\n" "popl %ebp" "\n" + CFI(".cfi_def_cfa esp, 4" "\n") "xorl %eax, %eax" "\n" "ret" "\n" + CFI(".cfi_endproc" "\n") ); asm ( From fecaaceb601780a7b73a306196877f7e07bb5a35 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Sun, 11 Sep 2011 11:37:43 -0700 Subject: [PATCH 02/57] Bug 686230 - Add JS_CallOnce to the JSAPI for module initialization (r=luke) --HG-- extra : rebase_source : 9ff798670edf9a55249530ca94d07c2edd9d7577 --- js/src/jsapi.h | 11 +++++++++++ js/src/jslock.cpp | 29 +++++++++++++++++++++++++++-- js/src/jslock.h | 1 + js/src/jspubtd.h | 7 +++++++ 4 files changed, 46 insertions(+), 2 deletions(-) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 45332b9b3e4..9f572cb821e 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -1697,6 +1697,17 @@ extern JS_PUBLIC_DATA(jsid) JSID_EMPTY; */ #define JSFUN_GENERIC_NATIVE JSFUN_LAMBDA +/* + * The first call to JS_CallOnce by any thread in a process will call 'func'. + * Later calls to JS_CallOnce with the same JSCallOnceType object will be + * suppressed. + * + * Equivalently: each distinct JSCallOnceType object will allow one JS_CallOnce + * to invoke its JSInitCallback. + */ +extern JS_PUBLIC_API(JSBool) +JS_CallOnce(JSCallOnceType *once, JSInitCallback func); + /* * Microseconds since the epoch, midnight, January 1, 1970 UTC. See the * comment in jstypes.h regarding safe int64 usage. diff --git a/js/src/jslock.cpp b/js/src/jslock.cpp index 72dc767391f..449e7c790b6 100644 --- a/js/src/jslock.cpp +++ b/js/src/jslock.cpp @@ -37,6 +37,9 @@ * * ***** END LICENSE BLOCK ***** */ +#include "jstypes.h" +#include "jspubtd.h" + #ifdef JS_THREADSAFE /* @@ -51,9 +54,7 @@ # include #endif -#include "jspubtd.h" #include "jsutil.h" -#include "jstypes.h" #include "jsstdint.h" #include "jscntxt.h" #include "jsgc.h" @@ -762,4 +763,28 @@ js_IsRuntimeLocked(JSRuntime *rt) return js_CurrentThreadId() == rt->rtLockOwner; } #endif /* DEBUG */ + +static PRStatus +CallOnce(void *func) +{ + JSInitCallback init = JS_DATA_TO_FUNC_PTR(JSInitCallback, func); + return init() ? PR_FAILURE : PR_SUCCESS; +} + +JS_PUBLIC_API(JSBool) +JS_CallOnce(JSCallOnceType *once, JSInitCallback func) +{ + return PR_CallOnceWithArg(once, CallOnce, JS_FUNC_TO_DATA_PTR(void *, func)) == PR_SUCCESS; +} +#else /* JS_THREADSAFE */ +JS_PUBLIC_API(JSBool) +JS_CallOnce(JSCallOnceType *once, JSInitCallback func) +{ + if (!*once) { + *once = true; + return func(); + } else { + return JS_TRUE; + } +} #endif /* JS_THREADSAFE */ diff --git a/js/src/jslock.h b/js/src/jslock.h index add2651fe6f..a7326f64c18 100644 --- a/js/src/jslock.h +++ b/js/src/jslock.h @@ -48,6 +48,7 @@ # include "prlock.h" # include "prcvar.h" # include "prthread.h" +# include "prinit.h" #endif #ifdef JS_THREADSAFE diff --git a/js/src/jspubtd.h b/js/src/jspubtd.h index 7dd7c476a89..f87d0e6cf49 100644 --- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -241,6 +241,13 @@ typedef struct JSFlatString JSFlatString; typedef struct JSString JSString; #endif +#ifdef JS_THREADSAFE +typedef struct PRCallOnceType JSCallOnceType; +#else +typedef JSBool JSCallOnceType; +#endif +typedef JSBool (*JSInitCallback)(void); + JS_END_EXTERN_C #endif /* jspubtd_h___ */ From 94dac49fb2bb599354bb951f82066b6384ba5823 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Thu, 6 Oct 2011 15:15:28 -0700 Subject: [PATCH 03/57] Bug 692606 - Shared libraries that change depending on configure options should depend on autoconf.mk (r=glandium) --HG-- extra : rebase_source : 07e3cdabe5392796683bd91c67ccefb83f44c392 --- xpcom/stub/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xpcom/stub/Makefile.in b/xpcom/stub/Makefile.in index 3e3ebe8da37..276cec7ed71 100644 --- a/xpcom/stub/Makefile.in +++ b/xpcom/stub/Makefile.in @@ -123,6 +123,6 @@ include $(topsrcdir)/config/rules.mk libs:: $(FINAL_TARGET)/dependentlibs.list -$(FINAL_TARGET)/dependentlibs.list: Makefile.in +$(FINAL_TARGET)/dependentlibs.list: Makefile.in $(DEPTH)/config/autoconf.mk $(EXIT_ON_ERROR) \ ( $(foreach dlib,$(DEPENDENT_LIBS_LIST),echo $(dlib);) ) > $@ From 269414c636ed578ecc04d2cfe06b4aab517cb1a2 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Mon, 28 Mar 2011 14:13:48 -0700 Subject: [PATCH 04/57] Bug 645887 - Build changes for JIT code registration API (r=dmandelin) --HG-- extra : rebase_source : b9db642cf1315e0c120b11273f8b5c59c25dfeaa --- configure.in | 17 +++++++++++++++++ js/src/configure.in | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/configure.in b/configure.in index 7dcdd840915..46e1de98de0 100644 --- a/configure.in +++ b/configure.in @@ -7389,6 +7389,23 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace)) fi +dnl ======================================================== +dnl JIT observers +dnl ======================================================== + +MOZ_ARG_WITH_STRING(jitreport-granularity, +[ --jitreport-granularity=N + Default granularity at which to report JIT code + to external tools + 0 - no info + 1 - code ranges for whole functions only + 2 - per-line information + 3 - per-op information], + JITREPORT_GRANULARITY=$withval, + JITREPORT_GRANULARITY=3) + +AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY) + dnl ======================================================== dnl = dnl = Misc. Options diff --git a/js/src/configure.in b/js/src/configure.in index 63e842edfd1..ca734335bc0 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -4632,6 +4632,23 @@ if test -z "$SKIP_LIBRARY_CHECKS"; then AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace)) fi +dnl ======================================================== +dnl JIT observers +dnl ======================================================== + +MOZ_ARG_WITH_STRING(jitreport-granularity, +[ --jitreport-granularity=N + Default granularity at which to report JIT code + to external tools + 0 - no info + 1 - code ranges for whole functions only + 2 - per-line information + 3 - per-op information], + JITREPORT_GRANULARITY=$withval, + JITREPORT_GRANULARITY=3) + +AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY) + dnl ======================================================== dnl = dnl = Misc. Options From 64b1696fa3fb8861684f1af6ed6aa25054d61b1c Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 29 Mar 2011 10:25:20 -0700 Subject: [PATCH 05/57] Bug 645887 - General support for mjit code registration (r=bhackett) --HG-- extra : rebase_source : ec06b8d9923fe12103ab47fb556c32048bcd8472 --- js/src/assembler/jit/ExecutableAllocator.h | 10 +- js/src/jscntxt.cpp | 1 + js/src/jscntxt.h | 2 + js/src/jsprobes.cpp | 140 ++++++++++++++++++++ js/src/jsprobes.h | 147 ++++++++++++++++----- js/src/methodjit/BaseCompiler.h | 8 +- js/src/methodjit/Compiler.cpp | 123 +++++++++++++---- js/src/methodjit/Compiler.h | 8 ++ js/src/methodjit/MethodJIT.cpp | 1 + js/src/methodjit/MonoIC.cpp | 12 +- js/src/methodjit/PolyIC.cpp | 72 +++++----- js/src/methodjit/PolyIC.h | 17 +-- 12 files changed, 427 insertions(+), 114 deletions(-) diff --git a/js/src/assembler/jit/ExecutableAllocator.h b/js/src/assembler/jit/ExecutableAllocator.h index 9094f01dfac..efcf8444211 100644 --- a/js/src/assembler/jit/ExecutableAllocator.h +++ b/js/src/assembler/jit/ExecutableAllocator.h @@ -166,10 +166,12 @@ private: }; class ExecutableAllocator { + typedef void (*DestroyCallback)(void* addr, size_t size); enum ProtectionSetting { Writable, Executable }; + DestroyCallback destroyCallback; public: - ExecutableAllocator() + ExecutableAllocator() : destroyCallback(NULL) { if (!pageSize) { pageSize = determinePageSize(); @@ -222,12 +224,18 @@ public: void releasePoolPages(ExecutablePool *pool) { JS_ASSERT(pool->m_allocation.pages); + if (destroyCallback) + destroyCallback(pool->m_allocation.pages, pool->m_allocation.size); systemRelease(pool->m_allocation); m_pools.remove(m_pools.lookup(pool)); // this asserts if |pool| is not in m_pools } void getCodeStats(size_t& method, size_t& regexp, size_t& unused) const; + void setDestroyCallback(DestroyCallback destroyCallback) { + this->destroyCallback = destroyCallback; + } + private: static size_t pageSize; static size_t largeAllocSize; diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index ffcec33aad0..95d2a0c06f2 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -1370,6 +1370,7 @@ JSContext::JSContext(JSRuntime *rt) resolveFlags(0), rngSeed(0), iterValue(MagicValue(JS_NO_ITER_VALUE)), + reportGranularity(JS_DEFAULT_JITREPORT_GRANULARITY), #ifdef JS_TRACER traceJitEnabled(false), #endif diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 27855d49235..b8ff993ba9d 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -933,6 +933,8 @@ struct JSContext uintN runOptions; /* see jsapi.h for JSOPTION_* */ public: + int32 reportGranularity; /* see jsprobes.h */ + /* Locale specific callbacks for string conversion. */ JSLocaleCallbacks *localeCallbacks; diff --git a/js/src/jsprobes.cpp b/js/src/jsprobes.cpp index 2bd500ba232..f85b8c33f01 100644 --- a/js/src/jsprobes.cpp +++ b/js/src/jsprobes.cpp @@ -65,6 +65,146 @@ const char Probes::anonymousName[] = "(anonymous)"; bool Probes::ProfilingActive = true; +static Vector jitWatchers; + +bool +Probes::addJITWatcher(JITWatcher *watcher) +{ + return jitWatchers.append(watcher); +} + +bool +Probes::removeJITWatcher(JSRuntime *rt, JITWatcher *watcher) +{ + JITWatcher **place = Find(jitWatchers, watcher); + if (!place) + return false; + if (rt) + rt->delete_(*place); + else + Foreground::delete_(*place); + jitWatchers.erase(place); + return true; +} + +void +Probes::removeAllJITWatchers(JSRuntime *rt) +{ + if (rt) { + for (JITWatcher **p = jitWatchers.begin(); p != jitWatchers.end(); ++p) + rt->delete_(*p); + } else { + for (JITWatcher **p = jitWatchers.begin(); p != jitWatchers.end(); ++p) + Foreground::delete_(*p); + } + jitWatchers.clear(); +} + +Probes::JITReportGranularity +Probes::JITGranularityRequested() +{ + JITReportGranularity want = JITREPORT_GRANULARITY_NONE; + for (JITWatcher **p = jitWatchers.begin(); p != jitWatchers.end(); ++p) { + JITReportGranularity request = (*p)->granularityRequested(); + if (request > want) + want = request; + } + + return want; +} + +void +Probes::registerMJITCode(JSContext *cx, js::mjit::JITScript *jscr, + JSScript *script, JSFunction *fun, + js::mjit::Compiler_ActiveFrame **inlineFrames, + void *mainCodeAddress, size_t mainCodeSize, + void *stubCodeAddress, size_t stubCodeSize) +{ + for (JITWatcher **p = jitWatchers.begin(); p != jitWatchers.end(); ++p) + (*p)->registerMJITCode(cx, jscr, script, fun, + inlineFrames, + mainCodeAddress, mainCodeSize, + stubCodeAddress, stubCodeSize); +} + +void +Probes::discardMJITCode(JSContext *cx, mjit::JITScript *jscr, JSScript *script, void* address) +{ + for (JITWatcher **p = jitWatchers.begin(); p != jitWatchers.end(); ++p) + (*p)->discardMJITCode(cx, jscr, script, address); +} + +void +Probes::registerICCode(JSContext *cx, + mjit::JITScript *jscr, JSScript *script, jsbytecode* pc, + void *start, size_t size) +{ + for (JITWatcher **p = jitWatchers.begin(); p != jitWatchers.end(); ++p) + (*p)->registerICCode(cx, jscr, script, pc, start, size); +} + +/* ICs are unregistered in a batch */ +void +Probes::discardExecutableRegion(void *start, size_t size) +{ + for (JITWatcher **p = jitWatchers.begin(); p != jitWatchers.end(); ++p) + (*p)->discardExecutableRegion(start, size); +} + +static JSRuntime *initRuntime; + +JSBool +Probes::startEngine() +{ + bool ok = true; + + return ok; +} + +bool +Probes::createRuntime(JSRuntime *rt) +{ + bool ok = true; + + static JSCallOnceType once = { 0 }; + initRuntime = rt; + if (!JS_CallOnce(&once, Probes::startEngine)) + ok = false; + +#ifdef MOZ_ETW + if (!ETWCreateRuntime(rt)) + ok = false; +#endif + + return ok; +} + +bool +Probes::destroyRuntime(JSRuntime *rt) +{ + bool ok = true; +#ifdef MOZ_ETW + if (!ETWDestroyRuntime(rt)) + ok = false; +#endif + + return ok; +} + +bool +Probes::shutdown() +{ + bool ok = true; +#ifdef MOZ_ETW + if (!ETWShutdown()) + ok = false; +#endif + + Probes::removeAllJITWatchers(NULL); + + return ok; +} + #ifdef INCLUDE_MOZILLA_DTRACE static const char * ScriptFilename(const JSScript *script) diff --git a/js/src/jsprobes.h b/js/src/jsprobes.h index ac3f55164b8..47ae8658b67 100644 --- a/js/src/jsprobes.h +++ b/js/src/jsprobes.h @@ -48,6 +48,11 @@ namespace js { +namespace mjit { +struct NativeAddressInfo; +struct Compiler_ActiveFrame; +} + namespace Probes { /* @@ -85,6 +90,9 @@ extern bool ProfilingActive; extern const char nullName[]; extern const char anonymousName[]; +/* Called when first runtime is created for this process */ +JSBool startEngine(); + /* JSRuntime created, with currently valid fields */ bool createRuntime(JSRuntime *rt); @@ -101,6 +109,12 @@ bool shutdown(); */ bool callTrackingActive(JSContext *); +/* + * Test whether anything is looking for JIT native code registration events. + * This information will not be collected otherwise. + */ +bool wantNativeAddressInfo(JSContext *); + /* Entering a JS function */ bool enterJSFun(JSContext *, JSFunction *, JSScript *, int counter = 1); @@ -195,6 +209,97 @@ bool CustomMark(JSString *string); bool CustomMark(const char *string); bool CustomMark(int marker); +/* JIT code observation */ + +enum JITReportGranularity { + JITREPORT_GRANULARITY_NONE = 0, + JITREPORT_GRANULARITY_FUNCTION = 1, + JITREPORT_GRANULARITY_LINE = 2, + JITREPORT_GRANULARITY_OP = 3 +}; + +/* + * Observer class for JIT code allocation/deallocation. Currently, this only + * handles the method JIT, and does not get notifications when JIT code is + * changed (patched) with no new allocation. + */ +class JITWatcher { +public: + virtual JITReportGranularity granularityRequested() = 0; + + virtual void registerMJITCode(JSContext *cx, js::mjit::JITScript *jscr, + JSScript *script, JSFunction *fun, + mjit::Compiler_ActiveFrame** inlineFrames, + void *mainCodeAddress, size_t mainCodeSize, + void *stubCodeAddress, size_t stubCodeSize) = 0; + + virtual void discardMJITCode(JSContext *cx, mjit::JITScript *jscr, JSScript *script, + void* address) = 0; + + virtual void registerICCode(JSContext *cx, + js::mjit::JITScript *jscr, JSScript *script, jsbytecode* pc, + void *start, size_t size) = 0; + + virtual void discardExecutableRegion(void *start, size_t size) = 0; +}; + +/* + * Register a JITWatcher subclass to be informed of JIT code + * allocation/deallocation. + */ +bool +addJITWatcher(JITWatcher *watcher); + +/* + * Remove (and destroy) a registered JITWatcher. rt may be NULL. Returns false + * if the watcher is not found. + */ +bool +removeJITWatcher(JSRuntime *rt, JITWatcher *watcher); + +/* + * Remove (and destroy) all registered JITWatchers. rt may be NULL. + */ +void +removeAllJITWatchers(JSRuntime *rt); + +/* + * Finest granularity of JIT information desired by all watchers. + */ +JITReportGranularity +JITGranularityRequested(); + +/* + * New method JIT code has been created + */ +void +registerMJITCode(JSContext *cx, js::mjit::JITScript *jscr, + JSScript *script, JSFunction *fun, + mjit::Compiler_ActiveFrame** inlineFrames, + void *mainCodeAddress, size_t mainCodeSize, + void *stubCodeAddress, size_t stubCodeSize); + +/* + * Method JIT code is about to be discarded + */ +void +discardMJITCode(JSContext *cx, mjit::JITScript *jscr, JSScript *script, void* address); + +/* + * IC code has been allocated within the given JITScript + */ +void +registerICCode(JSContext *cx, + mjit::JITScript *jscr, JSScript *script, jsbytecode* pc, + void *start, size_t size); + +/* + * A whole region of code has been deallocated, containing any number of ICs. + * (ICs are unregistered in a batch, so individual ICs are not registered.) + */ +void +discardExecutableRegion(void *start, size_t size); + /* * Internal: DTrace-specific functions to be called during Probes::enterJSFun * and Probes::exitJSFun. These will not be inlined, but the argument @@ -243,43 +348,10 @@ bool ETWResizeHeap(JSCompartment *compartment, size_t oldSize, size_t newSize); } /* namespace Probes */ /* - * Probe handlers are implemented inline for minimal performance impact, + * Many probe handlers are implemented inline for minimal performance impact, * especially important when no backends are enabled. */ -inline bool -Probes::createRuntime(JSRuntime *rt) -{ - bool ok = true; -#ifdef MOZ_ETW - if (!ETWCreateRuntime(rt)) - ok = false; -#endif - return ok; -} - -inline bool -Probes::destroyRuntime(JSRuntime *rt) -{ - bool ok = true; -#ifdef MOZ_ETW - if (!ETWDestroyRuntime(rt)) - ok = false; -#endif - return ok; -} - -inline bool -Probes::shutdown() -{ - bool ok = true; -#ifdef MOZ_ETW - if (!ETWShutdown()) - ok = false; -#endif - return ok; -} - inline bool Probes::callTrackingActive(JSContext *cx) { @@ -298,6 +370,13 @@ Probes::callTrackingActive(JSContext *cx) return false; } +inline bool +Probes::wantNativeAddressInfo(JSContext *cx) +{ + return (cx->reportGranularity >= JITREPORT_GRANULARITY_FUNCTION && + JITGranularityRequested() >= JITREPORT_GRANULARITY_FUNCTION); +} + inline bool Probes::enterJSFun(JSContext *cx, JSFunction *fun, JSScript *script, int counter) { diff --git a/js/src/methodjit/BaseCompiler.h b/js/src/methodjit/BaseCompiler.h index c1a3117c6cf..b652cf6a957 100644 --- a/js/src/methodjit/BaseCompiler.h +++ b/js/src/methodjit/BaseCompiler.h @@ -148,6 +148,7 @@ class LinkerHelper : public JSC::LinkBuffer // on any failure. JSScript *script = cx->fp()->script(); JSC::ExecutableAllocator *allocator = script->compartment()->jaegerCompartment()->execAlloc(); + allocator->setDestroyCallback(Probes::discardExecutableRegion); JSC::ExecutablePool *pool; m_code = executableAllocAndCopy(masm, allocator, &pool); if (!m_code) { @@ -158,9 +159,12 @@ class LinkerHelper : public JSC::LinkBuffer return pool; } - JSC::CodeLocationLabel finalize() { + JSC::CodeLocationLabel finalize(VMFrame &f) { masm.finalize(*this); - return finalizeCodeAddendum(); + JSC::CodeLocationLabel label = finalizeCodeAddendum(); + Probes::registerICCode(f.cx, f.jit(), f.script(), f.pc(), + label.executableAddress(), masm.size()); + return label; } void maybeLink(MaybeJump jump, JSC::CodeLocationLabel label) { diff --git a/js/src/methodjit/Compiler.cpp b/js/src/methodjit/Compiler.cpp index b54a0b09217..905afedc857 100644 --- a/js/src/methodjit/Compiler.cpp +++ b/js/src/methodjit/Compiler.cpp @@ -420,6 +420,8 @@ mjit::Compiler::pushActiveFrame(JSScript *script, uint32 argc) if (a) newa->parentPC = PC; newa->script = script; + newa->mainCodeStart = masm.size(); + newa->stubCodeStart = stubcc.size(); if (outer) { newa->inlineIndex = uint32(inlineFrames.length()); @@ -430,6 +432,8 @@ mjit::Compiler::pushActiveFrame(JSScript *script, uint32 argc) } JS_ASSERT(ssa.getFrame(newa->inlineIndex).script == script); + newa->inlinePCOffset = ssa.frameLength(newa->inlineIndex); + ScriptAnalysis *newAnalysis = script->analysis(); #ifdef JS_METHODJIT_SPEW @@ -860,7 +864,7 @@ mjit::Compiler::generatePrologue() recompileCheckHelper(); - if (outerScript->pcCounters) { + if (outerScript->pcCounters || Probes::wantNativeAddressInfo(cx)) { size_t length = ssa.frameLength(ssa.numFrames() - 1); pcLengths = (PCLengthEntry *) cx->calloc_(sizeof(pcLengths[0]) * length); if (!pcLengths) @@ -1426,35 +1430,89 @@ mjit::Compiler::finishThisUp(JITScript **jitp) JSC::ExecutableAllocator::makeExecutable(result, masm.size() + stubcc.size()); JSC::ExecutableAllocator::cacheFlush(result, masm.size() + stubcc.size()); + Probes::registerMJITCode(cx, jit, script, script->hasFunction ? script->function() : NULL, + (mjit::Compiler_ActiveFrame**) inlineFrames.begin(), + result, masm.size(), + result + masm.size(), stubcc.size()); + *jitp = jit; return Compile_Okay; } class SrcNoteLineScanner { + /* offset of the current JSOp in the bytecode */ ptrdiff_t offset; + + /* next src note to process */ jssrcnote *sn; + /* line number of the current JSOp */ + uint32 lineno; + + /* + * Is the current op the first one after a line change directive? Note that + * multiple ops may be "first" if a line directive is used to return to a + * previous line (eg, with a for loop increment expression.) + */ + bool lineHeader; + public: - SrcNoteLineScanner(jssrcnote *sn) : offset(SN_DELTA(sn)), sn(sn) {} - - bool firstOpInLine(ptrdiff_t relpc) { - while ((offset < relpc) && !SN_IS_TERMINATOR(sn)) { - sn = SN_NEXT(sn); - offset += SN_DELTA(sn); - } - - while ((offset == relpc) && !SN_IS_TERMINATOR(sn)) { - JSSrcNoteType type = (JSSrcNoteType) SN_TYPE(sn); - if (type == SRC_SETLINE || type == SRC_NEWLINE) - return true; - - sn = SN_NEXT(sn); - offset += SN_DELTA(sn); - } - - return false; + SrcNoteLineScanner(jssrcnote *sn, uint32 lineno) + : offset(0), sn(sn), lineno(lineno) + { } + + /* + * This is called repeatedly with always-advancing relpc values. The src + * notes are tuples of . Scan + * through, updating the lineno, until the next src note is for a later + * bytecode. + * + * When looking at the desired PC offset ('relpc'), the op is first in that + * line iff there is a SRC_SETLINE or SRC_NEWLINE src note for that exact + * bytecode. + * + * Note that a single bytecode may have multiple line-modifying notes (even + * though only one should ever be needed.) + */ + void advanceTo(ptrdiff_t relpc) { + // Must always advance! If the same or an earlier PC is erroneously + // passed in, we will already be past the relevant src notes + JS_ASSERT_IF(offset > 0, relpc > offset); + + // Next src note should be for after the current offset + JS_ASSERT_IF(offset > 0, SN_IS_TERMINATOR(sn) || SN_DELTA(sn) > 0); + + // The first PC requested is always considered to be a line header + lineHeader = (offset == 0); + + if (SN_IS_TERMINATOR(sn)) + return; + + ptrdiff_t nextOffset; + while ((nextOffset = offset + SN_DELTA(sn)) <= relpc && !SN_IS_TERMINATOR(sn)) { + offset = nextOffset; + JSSrcNoteType type = (JSSrcNoteType) SN_TYPE(sn); + if (type == SRC_SETLINE || type == SRC_NEWLINE) { + if (type == SRC_SETLINE) + lineno = js_GetSrcNoteOffset(sn, 0); + else + lineno++; + + if (offset == relpc) + lineHeader = true; + } + + sn = SN_NEXT(sn); + } + } + + bool isLineHeader() const { + return lineHeader; + } + + uint32 getLine() const { return lineno; } }; #ifdef DEBUG @@ -1492,7 +1550,7 @@ CompileStatus mjit::Compiler::generateMethod() { mjit::AutoScriptRetrapper trapper(cx, script); - SrcNoteLineScanner scanner(script->notes()); + SrcNoteLineScanner scanner(script->notes(), script->lineno); /* For join points, whether there was fallthrough from the previous opcode. */ bool fallthrough = true; @@ -1509,8 +1567,6 @@ mjit::Compiler::generateMethod() op = JSOp(*PC); trap |= stubs::JSTRAP_TRAP; } - if (script->stepModeEnabled() && scanner.firstOpInLine(PC - script->code)) - trap |= stubs::JSTRAP_SINGLESTEP; Bytecode *opinfo = analysis->maybeCode(PC); @@ -1524,6 +1580,13 @@ mjit::Compiler::generateMethod() continue; } + scanner.advanceTo(PC - script->code); + if (script->stepModeEnabled() && + (scanner.isLineHeader() || opinfo->jumpTarget)) + { + trap |= stubs::JSTRAP_SINGLESTEP; + } + frame.setPC(PC); frame.setInTryBlock(opinfo->inTryBlock); @@ -1568,7 +1631,7 @@ mjit::Compiler::generateMethod() Label start = masm.label(); if (!frame.syncForBranch(PC, Uses(0))) return Compile_Error; - if (script->pcCounters) { + if (pcLengths) { /* Track this sync code for the previous op. */ size_t length = masm.size() - masm.distanceOf(start); uint32 offset = ssa.frameLength(a->inlineIndex) + lastPC - script->code; @@ -2800,15 +2863,17 @@ mjit::Compiler::generateMethod() } } - if (script->pcCounters) { + if (script->pcCounters || pcLengths) { size_t length = masm.size() - masm.distanceOf(codeStart); if (countersUpdated || length != 0) { - if (!countersUpdated) + if (!countersUpdated && script->pcCounters) updatePCCounters(lastPC, &codeStart, &countersUpdated); - /* Fill in the amount of inline code generated for the op. */ - uint32 offset = ssa.frameLength(a->inlineIndex) + lastPC - script->code; - pcLengths[offset].codeLength += length; + if (pcLengths) { + /* Fill in the amount of inline code generated for the op. */ + uint32 offset = ssa.frameLength(a->inlineIndex) + lastPC - script->code; + pcLengths[offset].codeLength += length; + } } } @@ -6721,7 +6786,7 @@ mjit::Compiler::jumpAndTrace(Jump j, jsbytecode *target, Jump *slow, bool *tramp return false; if (trampoline) *trampoline = true; - if (script->pcCounters) { + if (pcLengths) { /* * This is OOL code but will usually be executed, so track * it in the CODE_LENGTH for the opcode. diff --git a/js/src/methodjit/Compiler.h b/js/src/methodjit/Compiler.h index b49e9618c27..373337087af 100644 --- a/js/src/methodjit/Compiler.h +++ b/js/src/methodjit/Compiler.h @@ -390,6 +390,7 @@ class Compiler : public BaseCompiler * the outermost script. */ +public: struct ActiveFrame { ActiveFrame *parent; jsbytecode *parentPC; @@ -405,6 +406,11 @@ class Compiler : public BaseCompiler /* Current types for non-escaping vars in the script. */ VarType *varTypes; + /* JIT code generation tracking state */ + size_t mainCodeStart; + size_t stubCodeStart; + size_t inlinePCOffset; + /* State for managing return from inlined frames. */ bool needReturnValue; /* Return value will be used. */ bool syncReturnValue; /* Return value should be fully synced. */ @@ -423,6 +429,8 @@ class Compiler : public BaseCompiler ActiveFrame(JSContext *cx); ~ActiveFrame(); }; + +private: ActiveFrame *a; ActiveFrame *outer; diff --git a/js/src/methodjit/MethodJIT.cpp b/js/src/methodjit/MethodJIT.cpp index 2257ccef432..73531592e62 100644 --- a/js/src/methodjit/MethodJIT.cpp +++ b/js/src/methodjit/MethodJIT.cpp @@ -1265,6 +1265,7 @@ mjit::ReleaseScriptCode(JSContext *cx, JSScript *script, bool construct) void **parity = construct ? &script->jitArityCheckCtor : &script->jitArityCheckNormal; if (*pjit) { + Probes::discardMJITCode(cx, *pjit, script, (*pjit)->code.m_code.executableAddress()); (*pjit)->~JITScript(); cx->free_(*pjit); *pjit = NULL; diff --git a/js/src/methodjit/MonoIC.cpp b/js/src/methodjit/MonoIC.cpp index e05e89785ee..f82df6066e1 100644 --- a/js/src/methodjit/MonoIC.cpp +++ b/js/src/methodjit/MonoIC.cpp @@ -243,7 +243,7 @@ AttachSetGlobalNameStub(VMFrame &f, ic::SetGlobalNameIC *ic, JSObject *obj, cons linker.link(guard, ic->slowPathStart); linker.link(isFun, ic->slowPathStart); - JSC::CodeLocationLabel cs = linker.finalize(); + JSC::CodeLocationLabel cs = linker.finalize(f); JaegerSpew(JSpew_PICs, "generated setgname stub at %p\n", cs.executableAddress()); Repatcher repatcher(f.jit()); @@ -501,7 +501,7 @@ class EqualityCompiler : public BaseCompiler buffer.link(trueJump, ic.target); buffer.link(falseJump, ic.fallThrough); - CodeLocationLabel cs = buffer.finalize(); + CodeLocationLabel cs = buffer.finalize(f); /* Jump to the newly generated code instead of to the IC. */ repatcher.relink(ic.jumpToStub, cs); @@ -803,7 +803,7 @@ class CallCompiler : public BaseCompiler } linker.link(notCompiled, ic.slowPathStart.labelAtOffset(ic.slowJoinOffset)); - JSC::CodeLocationLabel cs = linker.finalize(); + JSC::CodeLocationLabel cs = linker.finalize(f); JaegerSpew(JSpew_PICs, "generated CALL stub %p (%lu bytes)\n", cs.executableAddress(), (unsigned long) masm.size()); @@ -889,7 +889,7 @@ class CallCompiler : public BaseCompiler linker.link(claspGuard, ic.slowPathStart); linker.link(funGuard, ic.slowPathStart); linker.link(done, ic.funGuard.labelAtOffset(ic.hotPathOffset)); - JSC::CodeLocationLabel cs = linker.finalize(); + JSC::CodeLocationLabel cs = linker.finalize(f); JaegerSpew(JSpew_PICs, "generated CALL closure stub %p (%lu bytes)\n", cs.executableAddress(), (unsigned long) masm.size()); @@ -1063,7 +1063,7 @@ class CallCompiler : public BaseCompiler ic.fastGuardedNative = obj; linker.link(funGuard, ic.slowPathStart); - JSC::CodeLocationLabel start = linker.finalize(); + JSC::CodeLocationLabel start = linker.finalize(f); JaegerSpew(JSpew_PICs, "generated native CALL stub %p (%lu bytes)\n", start.executableAddress(), (unsigned long) masm.size()); @@ -1358,7 +1358,7 @@ ic::GenerateArgumentCheckStub(VMFrame &f) linker.link(mismatches[i], jit->argsCheckStub); linker.link(done, jit->argsCheckFallthrough); - JSC::CodeLocationLabel cs = linker.finalize(); + JSC::CodeLocationLabel cs = linker.finalize(f); JaegerSpew(JSpew_PICs, "generated ARGS CHECK stub %p (%lu bytes)\n", cs.executableAddress(), (unsigned long)masm.size()); diff --git a/js/src/methodjit/PolyIC.cpp b/js/src/methodjit/PolyIC.cpp index 54f3c8c9552..019a8596d0f 100644 --- a/js/src/methodjit/PolyIC.cpp +++ b/js/src/methodjit/PolyIC.cpp @@ -486,7 +486,7 @@ class SetPropCompiler : public PICStubCompiler buffer.link(done, pic.fastPathRejoin); if (skipOver.isSet()) buffer.link(skipOver.get(), pic.fastPathRejoin); - CodeLocationLabel cs = buffer.finalize(); + CodeLocationLabel cs = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generate setprop stub %p %d %d at %p\n", (void*)&pic, initialShape, @@ -912,7 +912,7 @@ class GetPropCompiler : public PICStubCompiler buffer.link(overridden, pic.slowPathStart); buffer.link(done, pic.fastPathRejoin); - CodeLocationLabel start = buffer.finalize(); + CodeLocationLabel start = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generate args length stub at %p\n", start.executableAddress()); @@ -952,7 +952,7 @@ class GetPropCompiler : public PICStubCompiler buffer.link(oob, pic.slowPathStart); buffer.link(done, pic.fastPathRejoin); - CodeLocationLabel start = buffer.finalize(); + CodeLocationLabel start = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generate array length stub at %p\n", start.executableAddress()); @@ -989,7 +989,7 @@ class GetPropCompiler : public PICStubCompiler buffer.link(notStringObj, pic.slowPathStart); buffer.link(done, pic.fastPathRejoin); - CodeLocationLabel start = buffer.finalize(); + CodeLocationLabel start = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generate string object length stub at %p\n", start.executableAddress()); @@ -1066,7 +1066,7 @@ class GetPropCompiler : public PICStubCompiler buffer.link(shapeMismatch, pic.slowPathStart); buffer.link(done, pic.fastPathRejoin); - CodeLocationLabel cs = buffer.finalize(); + CodeLocationLabel cs = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generate string call stub at %p\n", cs.executableAddress()); @@ -1109,7 +1109,7 @@ class GetPropCompiler : public PICStubCompiler buffer.link(notString, pic.getSlowTypeCheck()); buffer.link(done, pic.fastPathRejoin); - CodeLocationLabel start = buffer.finalize(); + CodeLocationLabel start = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generate string length stub at %p\n", start.executableAddress()); @@ -1335,7 +1335,7 @@ class GetPropCompiler : public PICStubCompiler for (Jump *pj = shapeMismatches.begin(); pj != shapeMismatches.end(); ++pj) buffer.link(*pj, pic.slowPathStart); - CodeLocationLabel cs = buffer.finalize(); + CodeLocationLabel cs = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generated %s stub at %p\n", type, cs.executableAddress()); patchPreviousToHere(cs); @@ -1556,7 +1556,7 @@ class ScopeNameCompiler : public PICStubCompiler buffer.link(failJump, pic.slowPathStart); buffer.link(done, pic.fastPathRejoin); - CodeLocationLabel cs = buffer.finalize(); + CodeLocationLabel cs = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generated %s global stub at %p\n", type, cs.executableAddress()); spew("NAME stub", "global"); @@ -1679,7 +1679,7 @@ class ScopeNameCompiler : public PICStubCompiler buffer.link(failJump, pic.slowPathStart); buffer.link(done, pic.fastPathRejoin); - CodeLocationLabel cs = buffer.finalize(); + CodeLocationLabel cs = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generated %s call stub at %p\n", type, cs.executableAddress()); patchPreviousToHere(cs); @@ -1867,7 +1867,7 @@ class BindNameCompiler : public PICStubCompiler buffer.link(failJump, pic.slowPathStart); buffer.link(done, pic.fastPathRejoin); - CodeLocationLabel cs = buffer.finalize(); + CodeLocationLabel cs = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generated %s stub at %p\n", type, cs.executableAddress()); patchPreviousToHere(cs); @@ -2425,9 +2425,10 @@ GetElementIC::purge(Repatcher &repatcher) } LookupStatus -GetElementIC::attachGetProp(VMFrame &f, JSContext *cx, JSObject *obj, const Value &v, jsid id, Value *vp) +GetElementIC::attachGetProp(VMFrame &f, JSObject *obj, const Value &v, jsid id, Value *vp) { JS_ASSERT(v.isString()); + JSContext *cx = f.cx; GetPropertyHelper getprop(cx, obj, JSID_TO_ATOM(id), *this, f); LookupStatus status = getprop.lookupAndTest(); @@ -2522,7 +2523,7 @@ GetElementIC::attachGetProp(VMFrame &f, JSContext *cx, JSObject *obj, const Valu buffer.maybeLink(protoGuard, slowPathStart); buffer.link(done, fastPathRejoin); - CodeLocationLabel cs = buffer.finalize(); + CodeLocationLabel cs = buffer.finalize(f); #if DEBUG char *chars = DeflateString(cx, v.toString()->getChars(cx), v.toString()->length()); JaegerSpew(JSpew_PICs, "generated %s stub at %p for atom %p (\"%s\") shape 0x%x (%s: %d)\n", @@ -2604,8 +2605,10 @@ GetElementIC::attachGetProp(VMFrame &f, JSContext *cx, JSObject *obj, const Valu } LookupStatus -GetElementIC::attachArguments(JSContext *cx, JSObject *obj, const Value &v, jsid id, Value *vp) +GetElementIC::attachArguments(VMFrame &f, JSObject *obj, const Value &v, jsid id, Value *vp) { + JSContext *cx = f.cx; + if (!v.isInt32()) return disable(cx, "arguments object with non-integer key"); @@ -2755,8 +2758,10 @@ GetElementIC::attachArguments(JSContext *cx, JSObject *obj, const Value &v, jsid #if defined JS_METHODJIT_TYPED_ARRAY LookupStatus -GetElementIC::attachTypedArray(JSContext *cx, JSObject *obj, const Value &v, jsid id, Value *vp) +GetElementIC::attachTypedArray(VMFrame &f, JSObject *obj, const Value &v, jsid id, Value *vp) { + JSContext *cx = f.cx; + if (!v.isInt32()) return disable(cx, "typed array with string key"); @@ -2838,7 +2843,7 @@ GetElementIC::attachTypedArray(JSContext *cx, JSObject *obj, const Value &v, jsi #endif /* JS_METHODJIT_TYPED_ARRAY */ LookupStatus -GetElementIC::update(VMFrame &f, JSContext *cx, JSObject *obj, const Value &v, jsid id, Value *vp) +GetElementIC::update(VMFrame &f, JSObject *obj, const Value &v, jsid id, Value *vp) { /* * Only treat this as a GETPROP for non-numeric string identifiers. The @@ -2847,7 +2852,7 @@ GetElementIC::update(VMFrame &f, JSContext *cx, JSObject *obj, const Value &v, j * use when looking up non-integer identifiers. */ if (v.isString() && js_CheckForStringIndex(id) == id) - return attachGetProp(f, cx, obj, v, id, vp); + return attachGetProp(f, obj, v, id, vp); #if defined JS_METHODJIT_TYPED_ARRAY /* @@ -2860,11 +2865,11 @@ GetElementIC::update(VMFrame &f, JSContext *cx, JSObject *obj, const Value &v, j * Since we can use type information to generate inline paths for typed * arrays, just don't generate these ICs with inference enabled. */ - if (!cx->typeInferenceEnabled() && js_IsTypedArray(obj)) - return attachTypedArray(cx, obj, v, id, vp); + if (!f.cx->typeInferenceEnabled() && js_IsTypedArray(obj)) + return attachTypedArray(f, obj, v, id, vp); #endif - return disable(cx, "unhandled object and key type"); + return disable(f.cx, "unhandled object and key type"); } void JS_FASTCALL @@ -2897,7 +2902,7 @@ ic::CallElement(VMFrame &f, ic::GetElementIC *ic) #ifdef DEBUG f.regs.sp[-2] = MagicValue(JS_GENERIC_MAGIC); #endif - LookupStatus status = ic->update(f, cx, thisObj, idval, id, &f.regs.sp[-2]); + LookupStatus status = ic->update(f, thisObj, idval, id, &f.regs.sp[-2]); if (status != Lookup_Uncacheable) { if (status == Lookup_Error) THROW(); @@ -2958,7 +2963,7 @@ ic::GetElement(VMFrame &f, ic::GetElementIC *ic) #ifdef DEBUG f.regs.sp[-2] = MagicValue(JS_GENERIC_MAGIC); #endif - LookupStatus status = ic->update(f, cx, obj, idval, id, &f.regs.sp[-2]); + LookupStatus status = ic->update(f, obj, idval, id, &f.regs.sp[-2]); if (status != Lookup_Uncacheable) { if (status == Lookup_Error) THROW(); @@ -3010,8 +3015,10 @@ SetElementIC::purge(Repatcher &repatcher) } LookupStatus -SetElementIC::attachHoleStub(JSContext *cx, JSObject *obj, int32 keyval) +SetElementIC::attachHoleStub(VMFrame &f, JSObject *obj, int32 keyval) { + JSContext *cx = f.cx; + if (keyval < 0) return disable(cx, "negative key index"); @@ -3094,7 +3101,7 @@ SetElementIC::attachHoleStub(JSContext *cx, JSObject *obj, int32 keyval) buffer.link(fails[i], slowPathStart); buffer.link(done, fastPathRejoin); - CodeLocationLabel cs = buffer.finalize(); + CodeLocationLabel cs = buffer.finalize(f); JaegerSpew(JSpew_PICs, "generated dense array hole stub at %p\n", cs.executableAddress()); Repatcher repatcher(cx->fp()->jit()); @@ -3108,12 +3115,13 @@ SetElementIC::attachHoleStub(JSContext *cx, JSObject *obj, int32 keyval) #if defined JS_METHODJIT_TYPED_ARRAY LookupStatus -SetElementIC::attachTypedArray(JSContext *cx, JSObject *obj, int32 key) +SetElementIC::attachTypedArray(VMFrame &f, JSObject *obj, int32 key) { // Right now, only one clasp guard extension is supported. JS_ASSERT(!inlineClaspGuardPatched); Assembler masm; + JSContext *cx = f.cx; // Guard on this typed array's clasp. Jump claspGuard = masm.testObjClass(Assembler::NotEqual, objReg, obj->getClass()); @@ -3197,26 +3205,26 @@ SetElementIC::attachTypedArray(JSContext *cx, JSObject *obj, int32 key) #endif /* JS_METHODJIT_TYPED_ARRAY */ LookupStatus -SetElementIC::update(JSContext *cx, const Value &objval, const Value &idval) +SetElementIC::update(VMFrame &f, const Value &objval, const Value &idval) { if (!objval.isObject()) - return disable(cx, "primitive lval"); + return disable(f.cx, "primitive lval"); if (!idval.isInt32()) - return disable(cx, "non-int32 key"); + return disable(f.cx, "non-int32 key"); JSObject *obj = &objval.toObject(); int32 key = idval.toInt32(); if (obj->isDenseArray()) - return attachHoleStub(cx, obj, key); + return attachHoleStub(f, obj, key); #if defined JS_METHODJIT_TYPED_ARRAY /* Not attaching typed array stubs with linear scan allocator, see GetElementIC. */ - if (!cx->typeInferenceEnabled() && js_IsTypedArray(obj)) - return attachTypedArray(cx, obj, key); + if (!f.cx->typeInferenceEnabled() && js_IsTypedArray(obj)) + return attachTypedArray(f, obj, key); #endif - return disable(cx, "unsupported object type"); + return disable(f.cx, "unsupported object type"); } template @@ -3226,7 +3234,7 @@ ic::SetElement(VMFrame &f, ic::SetElementIC *ic) JSContext *cx = f.cx; if (ic->shouldUpdate(cx)) { - LookupStatus status = ic->update(cx, f.regs.sp[-3], f.regs.sp[-2]); + LookupStatus status = ic->update(f, f.regs.sp[-3], f.regs.sp[-2]); if (status == Lookup_Error) THROW(); } diff --git a/js/src/methodjit/PolyIC.h b/js/src/methodjit/PolyIC.h index ddd64685340..35984c70892 100644 --- a/js/src/methodjit/PolyIC.h +++ b/js/src/methodjit/PolyIC.h @@ -300,13 +300,10 @@ struct GetElementIC : public BasePolyIC { hasLastStringStub = false; } void purge(Repatcher &repatcher); - LookupStatus update(VMFrame &f, JSContext *cx, JSObject *obj, const Value &v, jsid id, Value *vp); - LookupStatus attachGetProp(VMFrame &f, JSContext *cx, JSObject *obj, const Value &v, jsid id, - Value *vp); - LookupStatus attachArguments(JSContext *cx, JSObject *obj, const Value &v, jsid id, - Value *vp); - LookupStatus attachTypedArray(JSContext *cx, JSObject *obj, const Value &v, jsid id, - Value *vp); + LookupStatus update(VMFrame &f, JSObject *obj, const Value &v, jsid id, Value *vp); + LookupStatus attachGetProp(VMFrame &f, JSObject *obj, const Value &v, jsid id, Value *vp); + LookupStatus attachArguments(VMFrame &f, JSObject *obj, const Value &v, jsid id, Value *vp); + LookupStatus attachTypedArray(VMFrame &f, JSObject *obj, const Value &v, jsid id, Value *vp); LookupStatus disable(JSContext *cx, const char *reason); LookupStatus error(JSContext *cx); bool shouldUpdate(JSContext *cx); @@ -370,9 +367,9 @@ struct SetElementIC : public BaseIC { inlineHoleGuardPatched = false; } void purge(Repatcher &repatcher); - LookupStatus attachTypedArray(JSContext *cx, JSObject *obj, int32 key); - LookupStatus attachHoleStub(JSContext *cx, JSObject *obj, int32 key); - LookupStatus update(JSContext *cx, const Value &objval, const Value &idval); + LookupStatus attachTypedArray(VMFrame &f, JSObject *obj, int32 key); + LookupStatus attachHoleStub(VMFrame &f, JSObject *obj, int32 key); + LookupStatus update(VMFrame &f, const Value &objval, const Value &idval); LookupStatus disable(JSContext *cx, const char *reason); LookupStatus error(JSContext *cx); }; From 545dc6eec131cbb5674e6a088b365c2879e27d84 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 11 Oct 2011 14:50:09 +0100 Subject: [PATCH 06/57] Bug 687358 - Remove nsWWJSUtils and use nsJSUtils instead; r=jst --- .../components/windowwatcher/src/Makefile.in | 6 +- .../windowwatcher/src/nsWWJSUtils.cpp | 106 ------------------ .../windowwatcher/src/nsWWJSUtils.h | 64 ----------- .../windowwatcher/src/nsWindowWatcher.cpp | 10 +- 4 files changed, 8 insertions(+), 178 deletions(-) delete mode 100644 embedding/components/windowwatcher/src/nsWWJSUtils.cpp delete mode 100644 embedding/components/windowwatcher/src/nsWWJSUtils.h diff --git a/embedding/components/windowwatcher/src/Makefile.in b/embedding/components/windowwatcher/src/Makefile.in index ff355a648db..b959a227d2e 100644 --- a/embedding/components/windowwatcher/src/Makefile.in +++ b/embedding/components/windowwatcher/src/Makefile.in @@ -46,9 +46,7 @@ MODULE = embedcomponents LIBRARY_NAME = windowwatcher_s LIBXUL_LIBRARY = 1 - CPPSRCS = \ - nsWWJSUtils.cpp \ nsWindowWatcher.cpp \ nsAutoWindowStateHelper.cpp \ $(NULL) @@ -62,5 +60,7 @@ endif # static lib. FORCE_STATIC_LIB = 1 -include $(topsrcdir)/config/rules.mk +# For nsJSUtils +LOCAL_INCLUDES += -I$(topsrcdir)/dom/base +include $(topsrcdir)/config/rules.mk diff --git a/embedding/components/windowwatcher/src/nsWWJSUtils.cpp b/embedding/components/windowwatcher/src/nsWWJSUtils.cpp deleted file mode 100644 index 866423fad63..00000000000 --- a/embedding/components/windowwatcher/src/nsWWJSUtils.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* This file is a small subset of nsJSUtils utility functions, - from the dom directory. -*/ - -#include "nsCOMPtr.h" -#include "nsIScriptContext.h" -#include "nsIScriptGlobalObject.h" -#include "nsWWJSUtils.h" -#include "nsIXPConnect.h" -#include "nsDOMJSUtils.h" - -nsIScriptGlobalObject * -nsWWJSUtils::GetStaticScriptGlobal(JSContext* aContext, JSObject* aObj) -{ - nsISupports* supports; - JSClass* clazz; - JSObject* parent; - JSObject* glob = aObj; // starting point for search - - if (!glob) - return nsnull; - - while (nsnull != (parent = JS_GetParent(aContext, glob))) - glob = parent; - - clazz = JS_GET_CLASS(aContext, glob); - - if (!clazz || - !(clazz->flags & JSCLASS_HAS_PRIVATE) || - !(clazz->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS) || - !(supports = (nsISupports*) JS_GetPrivate(aContext, glob))) { - return nsnull; - } - - nsCOMPtr wrapper(do_QueryInterface(supports)); - NS_ENSURE_TRUE(wrapper, nsnull); - - nsCOMPtr sgo(do_QueryWrappedNative(wrapper)); - - // This will return a pointer to something we're about to release, - // but that's ok here. - return sgo; -} - -nsIScriptContext * -nsWWJSUtils::GetDynamicScriptContext(JSContext *aContext) -{ - return GetScriptContextFromJSContext(aContext); -} - -nsIScriptGlobalObject * -nsWWJSUtils::GetDynamicScriptGlobal(JSContext* aContext) -{ - nsIScriptContext *scriptCX = GetDynamicScriptContext(aContext); - if (!scriptCX) - return nsnull; - return scriptCX->GetGlobalObject(); -} - -nsIScriptContext * -nsWWJSUtils::GetStaticScriptContext(JSContext* aContext, - JSObject* aObj) -{ - nsIScriptGlobalObject *nativeGlobal = GetStaticScriptGlobal(aContext, aObj); - if (!nativeGlobal) - return nsnull; - return nativeGlobal->GetContext(); -} - diff --git a/embedding/components/windowwatcher/src/nsWWJSUtils.h b/embedding/components/windowwatcher/src/nsWWJSUtils.h deleted file mode 100644 index b7c69bd177e..00000000000 --- a/embedding/components/windowwatcher/src/nsWWJSUtils.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2001 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsWWJSUtils_h__ -#define nsWWJSUtils_h__ - -/** - * Utility functions copied from nsJSUtils in dom/src/base. - */ - -#include "nsISupports.h" -#include "jsapi.h" - -class nsIScriptContext; -class nsIScriptGlobalObject; - -class nsWWJSUtils { -public: - static nsIScriptGlobalObject *GetStaticScriptGlobal(JSContext* aContext, - JSObject* aObj); - - static nsIScriptContext *GetStaticScriptContext(JSContext* aContext, - JSObject* aObj); - - static nsIScriptGlobalObject *GetDynamicScriptGlobal(JSContext *aContext); - - static nsIScriptContext *GetDynamicScriptContext(JSContext *aContext); -}; - -#endif /* nsWWJSUtils_h__ */ diff --git a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index f6e6832c764..f6e8775b212 100644 --- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -44,7 +44,7 @@ #include "nsCRT.h" #include "nsNetUtil.h" -#include "nsWWJSUtils.h" +#include "nsJSUtils.h" #include "plstr.h" #include "nsIBaseWindow.h" @@ -316,7 +316,7 @@ nsresult JSContextAutoPopper::Push(JSContext *cx) // Save cx in mContext to indicate need to pop. if (cx && NS_SUCCEEDED(mService->Push(cx))) { mContext = cx; - mContextKungFuDeathGrip = nsWWJSUtils::GetDynamicScriptContext(cx); + mContextKungFuDeathGrip = nsJSUtils::GetDynamicScriptContext(cx); } } return mContext ? NS_OK : NS_ERROR_FAILURE; @@ -925,7 +925,7 @@ nsWindowWatcher::OpenWindowJSInternal(nsIDOMWindow *aParent, // get its document, if any if (stack && NS_SUCCEEDED(stack->Peek(&ccx)) && ccx) { - nsIScriptGlobalObject *sgo = nsWWJSUtils::GetDynamicScriptGlobal(ccx); + nsIScriptGlobalObject *sgo = nsJSUtils::GetDynamicScriptGlobal(ccx); nsCOMPtr w(do_QueryInterface(sgo)); if (w) { @@ -1374,7 +1374,7 @@ nsWindowWatcher::URIfromURL(const char *aURL, in nsGlobalWindow.cpp.) */ JSContext *cx = GetJSContextFromCallStack(); if (cx) { - nsIScriptContext *scriptcx = nsWWJSUtils::GetDynamicScriptContext(cx); + nsIScriptContext *scriptcx = nsJSUtils::GetDynamicScriptContext(cx); if (scriptcx) { baseWindow = do_QueryInterface(scriptcx->GetGlobalObject()); } @@ -1717,7 +1717,7 @@ nsWindowWatcher::GetCallerTreeItem(nsIDocShellTreeItem* aParentItem) if (cx) { nsCOMPtr callerWebNav = - do_GetInterface(nsWWJSUtils::GetDynamicScriptGlobal(cx)); + do_GetInterface(nsJSUtils::GetDynamicScriptGlobal(cx)); if (callerWebNav) { CallQueryInterface(callerWebNav, &callerItem); From 6beca1de93bcfce71e4bbecdf1673692afaccdaa Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Tue, 11 Oct 2011 10:31:05 -0400 Subject: [PATCH 07/57] Bug 691779 - Hide devicemanagerADB pull interfering with reftest output. r=jmaher --- build/mobile/devicemanagerADB.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/mobile/devicemanagerADB.py b/build/mobile/devicemanagerADB.py index 48bbb09401b..32743a325ad 100644 --- a/build/mobile/devicemanagerADB.py +++ b/build/mobile/devicemanagerADB.py @@ -285,8 +285,10 @@ class DeviceManagerADB(DeviceManager): # success: output of pullfile, string # failure: None def getFile(self, remoteFile, localFile = 'tmpfile_dm_adb'): + # TODO: add debug flags and allow for printing stdout + # self.runCmd(["pull", remoteFile, localFile]) try: - self.checkCmd(["pull", remoteFile, localFile]) + self.runCmd(["pull", remoteFile, localFile]).stdout.read() f = open(localFile) ret = f.read() f.close() From 441a85c55f6388a101fbc64907cf64852e61fb6e Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Tue, 11 Oct 2011 11:02:46 -0400 Subject: [PATCH 08/57] Bug 671104 - Random Orange: iframe load race condition. r=ehsan --- dom/plugins/test/mochitest/test_npruntime_identifiers.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dom/plugins/test/mochitest/test_npruntime_identifiers.html b/dom/plugins/test/mochitest/test_npruntime_identifiers.html index 945d7972eb4..158c9638ff7 100644 --- a/dom/plugins/test/mochitest/test_npruntime_identifiers.html +++ b/dom/plugins/test/mochitest/test_npruntime_identifiers.html @@ -9,8 +9,6 @@

- - + + + From 59fa114cfb818fe053d2340acd6ea1ab01fba1b2 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Tue, 11 Oct 2011 08:14:56 -0700 Subject: [PATCH 09/57] Bug 693124 - Remove invalid assert in Proxy::objectClassIs (r=waldo) --HG-- extra : rebase_source : 9bf62c06fb92b13d6b855f6e0ca6a32efb302de1 --- js/src/jsproxy.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index c785569e3f6..7feb9f7913d 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -877,7 +877,6 @@ Proxy::typeOf(JSContext *cx, JSObject *proxy) bool Proxy::objectClassIs(JSObject *proxy, ESClassValue classValue, JSContext *cx) { - JS_CHECK_RECURSION(cx, JS_NOT_REACHED("cannot reenter")); AutoPendingProxyOperation pending(cx, proxy); return GetProxyHandler(proxy)->objectClassIs(proxy, classValue, cx); } From f146fdc5641f0cb0d3f87ee7ec1bb8a1140cbfe5 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Tue, 4 Oct 2011 15:33:00 -0700 Subject: [PATCH 10/57] Bug 689362 - Create js/public (with the intention that its contents will eventually be the only INSTALLED_HEADERS), move Vector and HashTable to js/public and some dependencies (r=billm,sr=dmandelin) --HG-- rename : js/src/jshashtable.h => js/public/HashTable.h rename : js/src/jsvector.h => js/public/Vector.h rename : js/src/mfbt/InlineMap.h => js/src/ds/InlineMap.h extra : rebase_source : 818639b74653667b7a572bc1234398c0e4559a60 --- dom/workers/ListenerManager.cpp | 2 +- js/jetpack/JetpackActorCommon.cpp | 4 +- js/{src/jshashtable.h => public/HashTable.h} | 5 +- js/{src/jstl.h => public/TemplateLib.h} | 297 +---- js/public/Utility.h | 945 ++++++++++++++++ js/{src/jsvector.h => public/Vector.h} | 9 +- js/src/Makefile.in | 53 +- js/src/assembler/assembler/X86Assembler.h | 2 +- js/src/assembler/jit/ExecutableAllocator.h | 9 +- js/src/builtin/RegExp.cpp | 1 - js/src/ctypes/CTypes.h | 3 +- js/src/{mfbt => ds}/InlineMap.h | 2 +- js/src/ds/LifoAlloc.h | 3 +- js/src/frontend/ParseMaps.h | 5 +- js/src/jsanalyze.h | 2 +- js/src/jsapi-tests/tests.h | 5 +- js/src/jsapi.cpp | 2 - js/src/jsapi.h | 3 +- js/src/jsarena.cpp | 258 ----- js/src/jsarray.cpp | 2 - js/src/jsatom.cpp | 1 - js/src/jsatom.h | 3 +- js/src/jsbit.h | 305 ------ js/src/jsbool.cpp | 1 - js/src/jsbuiltins.cpp | 1 - js/src/jsclone.h | 5 +- js/src/jscntxt.h | 4 +- js/src/jsdbgapi.cpp | 2 +- js/src/jsdhash.cpp | 1 - js/src/jsdtoa.cpp | 1 - js/src/jsemit.cpp | 8 - js/src/jsexn.cpp | 5 +- js/src/jsfun.cpp | 1 - js/src/jsgc.cpp | 6 +- js/src/jsgc.h | 7 +- js/src/jsgcinlines.h | 4 +- js/src/jsgcmark.h | 5 +- js/src/jshash.cpp | 5 +- js/src/jsinfer.cpp | 2 - js/src/jsinfer.h | 3 +- js/src/jsinterp.cpp | 4 +- js/src/jsiter.cpp | 2 - js/src/jslock.cpp | 3 +- js/src/jslog2.cpp | 26 - js/src/jsnum.cpp | 1 - js/src/jsobj.cpp | 1 - js/src/jsobj.h | 1 - js/src/json.cpp | 4 +- js/src/json.h | 3 +- js/src/jsopcode.cpp | 3 +- js/src/jsotypes.h | 5 - js/src/jsparse.cpp | 1 - js/src/jsparse.h | 2 +- js/src/jspropertycache.cpp | 2 +- js/src/jspropertytree.h | 3 +- js/src/jsreflect.cpp | 2 - js/src/jsscan.cpp | 2 - js/src/jsscan.h | 3 +- js/src/jsscope.cpp | 3 +- js/src/jsscope.h | 3 +- js/src/jsstaticcheck.h | 82 -- js/src/jsstr.cpp | 2 - js/src/jsstr.h | 2 +- js/src/jstracer.cpp | 10 +- js/src/jstracer.h | 1 - js/src/jstypedarray.cpp | 2 - js/src/jsutil.cpp | 149 +-- js/src/jsutil.h | 1016 ++++++------------ js/src/jsval.h | 2 +- js/src/jswatchpoint.h | 4 +- js/src/jsweakmap.cpp | 1 - js/src/jsweakmap.h | 2 + js/src/jsxml.cpp | 2 - js/src/methodjit/BaseAssembler.h | 1 - js/src/methodjit/BaseCompiler.h | 1 - js/src/methodjit/Compiler.h | 1 - js/src/methodjit/MachineRegs.h | 1 - js/src/methodjit/PolyIC.h | 3 +- js/src/methodjit/StubCompiler.h | 1 - js/src/shell/js.cpp | 1 - js/src/shell/jsheaptools.cpp | 2 - js/src/shell/jsoptparse.h | 4 +- js/src/shell/jsworkers.cpp | 2 - js/src/tracejit/Writer.cpp | 1 - js/src/vm/Debugger.cpp | 1 - js/src/vm/Debugger.h | 3 +- js/src/vm/GlobalObject.h | 3 +- js/src/vm/RegExpObject.h | 3 +- js/src/vm/RegExpStatics.h | 3 +- js/src/xpconnect/src/xpcmaps.cpp | 1 - js/src/xpconnect/src/xpcwrappednative.cpp | 1 - js/src/yarr/wtfbridge.h | 1 - layout/style/nsNthIndexCache.h | 2 +- 93 files changed, 1396 insertions(+), 1971 deletions(-) rename js/{src/jshashtable.h => public/HashTable.h} (99%) rename js/{src/jstl.h => public/TemplateLib.h} (53%) create mode 100644 js/public/Utility.h rename js/{src/jsvector.h => public/Vector.h} (99%) rename js/src/{mfbt => ds}/InlineMap.h (99%) delete mode 100644 js/src/jsarena.cpp delete mode 100644 js/src/jsbit.h diff --git a/dom/workers/ListenerManager.cpp b/dom/workers/ListenerManager.cpp index a256cdb3326..9383cef27e9 100644 --- a/dom/workers/ListenerManager.cpp +++ b/dom/workers/ListenerManager.cpp @@ -40,7 +40,7 @@ #include "jsapi.h" #include "jscntxt.h" -#include "jsvector.h" +#include "js/Vector.h" #include "Events.h" diff --git a/js/jetpack/JetpackActorCommon.cpp b/js/jetpack/JetpackActorCommon.cpp index 8a9bb09d663..01018ccaff8 100644 --- a/js/jetpack/JetpackActorCommon.cpp +++ b/js/jetpack/JetpackActorCommon.cpp @@ -37,10 +37,10 @@ * ***** END LICENSE BLOCK ***** */ #include "base/basictypes.h" -#include "jscntxt.h" #include "jsapi.h" -#include "jshashtable.h" +#include "jscntxt.h" +#include "js/HashTable.h" #include "mozilla/jetpack/JetpackActorCommon.h" #include "mozilla/jetpack/PJetpack.h" diff --git a/js/src/jshashtable.h b/js/public/HashTable.h similarity index 99% rename from js/src/jshashtable.h rename to js/public/HashTable.h index 5891f78b4c6..36f48f8c623 100644 --- a/js/src/jshashtable.h +++ b/js/public/HashTable.h @@ -43,9 +43,8 @@ #ifndef jshashtable_h_ #define jshashtable_h_ -#include "jsalloc.h" -#include "jstl.h" -#include "jsutil.h" +#include "TemplateLib.h" +#include "Utility.h" namespace js { diff --git a/js/src/jstl.h b/js/public/TemplateLib.h similarity index 53% rename from js/src/jstl.h rename to js/public/TemplateLib.h index c2f6001c6a8..ba3171def00 100644 --- a/js/src/jstl.h +++ b/js/public/TemplateLib.h @@ -14,18 +14,19 @@ * for the specific language governing rights and limitations under the * License. * - * The Original Code is Mozilla SpiderMonkey JavaScript 1.9 code, released - * July 16, 2009. + * The Original Code is Mozilla SpiderMonkey JavaScript code. * * The Initial Developer of the Original Code is - * the Mozilla Corporation. + * the Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Luke Wagner + * Luke Wagner * * 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"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to @@ -37,20 +38,20 @@ * * ***** END LICENSE BLOCK ***** */ -#ifndef jstl_h_ -#define jstl_h_ +#ifndef js_template_lib_h__ +#define js_template_lib_h__ -#include "jsprvtd.h" -#include "jsbit.h" -#include "jsstaticcheck.h" +#include "mozilla/Types.h" #include "jsstdint.h" -#include -#include +/* + * Library of reusable template meta-functions (that is, functions on types and + * compile-time values). Meta-functions are placed inside the 'tl' namespace to + * avoid conflict with non-meta functions that logically have the same name + * (e.g., js::tl::Min vs. js::Min). + */ namespace js { - -/* JavaScript Template Library. */ namespace tl { /* Compute min/max/clamp. */ @@ -178,270 +179,6 @@ template struct If { static const T r template struct If { static const T result = v2; }; } /* namespace tl */ - -/* Useful for implementing containers that assert non-reentrancy */ -class ReentrancyGuard -{ - /* ReentrancyGuard is not copyable. */ - ReentrancyGuard(const ReentrancyGuard &); - void operator=(const ReentrancyGuard &); - -#ifdef DEBUG - bool &entered; -#endif - public: - template -#ifdef DEBUG - ReentrancyGuard(T &obj) - : entered(obj.entered) -#else - ReentrancyGuard(T &/*obj*/) -#endif - { -#ifdef DEBUG - JS_ASSERT(!entered); - entered = true; -#endif - } - ~ReentrancyGuard() - { -#ifdef DEBUG - entered = false; -#endif - } -}; - -/* - * Round x up to the nearest power of 2. This function assumes that the most - * significant bit of x is not set, which would lead to overflow. - */ -STATIC_POSTCONDITION_ASSUME(return >= x) -JS_ALWAYS_INLINE size_t -RoundUpPow2(size_t x) -{ - size_t log2 = JS_CEILING_LOG2W(x); - JS_ASSERT(log2 < tl::BitSize::result); - size_t result = size_t(1) << log2; - return result; -} - -template -class AlignedPtrAndFlag -{ - uintptr_t bits; - - public: - AlignedPtrAndFlag(T *t, bool flag) { - JS_ASSERT((uintptr_t(t) & 1) == 0); - bits = uintptr_t(t) | uintptr_t(flag); - } - - T *ptr() const { - return (T *)(bits & ~uintptr_t(1)); - } - - bool flag() const { - return (bits & 1) != 0; - } - - void setPtr(T *t) { - JS_ASSERT((uintptr_t(t) & 1) == 0); - bits = uintptr_t(t) | uintptr_t(flag()); - } - - void setFlag() { - bits |= 1; - } - - void unsetFlag() { - bits &= ~uintptr_t(1); - } - - void set(T *t, bool flag) { - JS_ASSERT((uintptr_t(t) & 1) == 0); - bits = uintptr_t(t) | flag; - } -}; - -template -static inline void -Reverse(T *beg, T *end) -{ - while (beg != end) { - if (--end == beg) - return; - T tmp = *beg; - *beg = *end; - *end = tmp; - ++beg; - } -} - -template -static inline T * -Find(T *beg, T *end, const T &v) -{ - for (T *p = beg; p != end; ++p) { - if (*p == v) - return p; - } - return end; -} - -template -static inline typename Container::ElementType * -Find(Container &c, const typename Container::ElementType &v) -{ - return Find(c.begin(), c.end(), v); -} - -template -void -ForEach(InputIterT begin, InputIterT end, CallableT f) -{ - for (; begin != end; ++begin) - f(*begin); -} - -template -static inline T -Min(T t1, T t2) -{ - return t1 < t2 ? t1 : t2; -} - -template -static inline T -Max(T t1, T t2) -{ - return t1 > t2 ? t1 : t2; -} - -/* Allows a const variable to be initialized after its declaration. */ -template -static T& -InitConst(const T &t) -{ - return const_cast(t); -} - -template -JS_ALWAYS_INLINE T & -ImplicitCast(U &u) -{ - T &t = u; - return t; -} - -template -class AutoScopedAssign -{ - private: - JS_DECL_USE_GUARD_OBJECT_NOTIFIER - T *addr; - T old; - - public: - AutoScopedAssign(T *addr, const T &value JS_GUARD_OBJECT_NOTIFIER_PARAM) - : addr(addr), old(*addr) - { - JS_GUARD_OBJECT_NOTIFIER_INIT; - *addr = value; - } - - ~AutoScopedAssign() { *addr = old; } -}; - -template -class AlreadyIncRefed -{ - typedef RefCountable *****ConvertibleToBool; - - RefCountable *obj; - - public: - explicit AlreadyIncRefed(RefCountable *obj) : obj(obj) {} - - bool null() const { return obj == NULL; } - operator ConvertibleToBool() const { return (ConvertibleToBool)obj; } - - RefCountable *operator->() const { JS_ASSERT(!null()); return obj; } - RefCountable &operator*() const { JS_ASSERT(!null()); return *obj; } - RefCountable *get() const { return obj; } -}; - -template -class NeedsIncRef -{ - typedef RefCountable *****ConvertibleToBool; - - RefCountable *obj; - - public: - explicit NeedsIncRef(RefCountable *obj) : obj(obj) {} - - bool null() const { return obj == NULL; } - operator ConvertibleToBool() const { return (ConvertibleToBool)obj; } - - RefCountable *operator->() const { JS_ASSERT(!null()); return obj; } - RefCountable &operator*() const { JS_ASSERT(!null()); return *obj; } - RefCountable *get() const { return obj; } -}; - -template -class AutoRefCount -{ - typedef RefCountable *****ConvertibleToBool; - - JSContext *const cx; - RefCountable *obj; - - AutoRefCount(const AutoRefCount &); - void operator=(const AutoRefCount &); - - public: - explicit AutoRefCount(JSContext *cx) - : cx(cx), obj(NULL) - {} - - AutoRefCount(JSContext *cx, NeedsIncRef aobj) - : cx(cx), obj(aobj.get()) - { - if (obj) - obj->incref(cx); - } - - AutoRefCount(JSContext *cx, AlreadyIncRefed aobj) - : cx(cx), obj(aobj.get()) - {} - - ~AutoRefCount() { - if (obj) - obj->decref(cx); - } - - void reset(NeedsIncRef aobj) { - if (obj) - obj->decref(cx); - obj = aobj.get(); - if (obj) - obj->incref(cx); - } - - void reset(AlreadyIncRefed aobj) { - if (obj) - obj->decref(cx); - obj = aobj.get(); - } - - bool null() const { return obj == NULL; } - operator ConvertibleToBool() const { return (ConvertibleToBool)obj; } - - RefCountable *operator->() const { JS_ASSERT(!null()); return obj; } - RefCountable &operator*() const { JS_ASSERT(!null()); return *obj; } - RefCountable *get() const { return obj; } -}; - } /* namespace js */ -#endif /* jstl_h_ */ +#endif /* js_template_lib_h__ */ diff --git a/js/public/Utility.h b/js/public/Utility.h new file mode 100644 index 00000000000..0e44ccae802 --- /dev/null +++ b/js/public/Utility.h @@ -0,0 +1,945 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=99 ft=cpp: + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla SpiderMonkey JavaScript code. + * + * The Initial Developer of the Original Code is + * the Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef js_utility_h__ +#define js_utility_h__ + +#include +#include + +#include "mozilla/Util.h" + +#ifdef __cplusplus + +/* The public JS engine namespace. */ +namespace JS {} + +/* The mozilla-shared reusable template/utility namespace. */ +namespace mozilla {} + +/* The private JS engine namespace. */ +namespace js { + +/* The private namespace is a superset of the public/shared namespaces. */ +using namespace JS; +using namespace mozilla; + +} /* namespace js */ +#endif /* __cplusplus */ + +JS_BEGIN_EXTERN_C + +/* + * Pattern used to overwrite freed memory. If you are accessing an object with + * this pattern, you probably have a dangling pointer. + */ +#define JS_FREE_PATTERN 0xDA + +/* JS_ASSERT */ +#ifdef DEBUG +# define JS_ASSERT(expr) \ + ((expr) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__)) +# define JS_ASSERT_IF(cond, expr) \ + ((!(cond) || (expr)) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__)) +# define JS_NOT_REACHED(reason) \ + JS_Assert(reason, __FILE__, __LINE__) +# define JS_ALWAYS_TRUE(expr) JS_ASSERT(expr) +# define JS_ALWAYS_FALSE(expr) JS_ASSERT(!(expr)) +# ifdef JS_THREADSAFE +# define JS_THREADSAFE_ASSERT(expr) JS_ASSERT(expr) +# else +# define JS_THREADSAFE_ASSERT(expr) ((void) 0) +# endif +#else +# define JS_ASSERT(expr) ((void) 0) +# define JS_ASSERT_IF(cond,expr) ((void) 0) +# define JS_NOT_REACHED(reason) +# define JS_ALWAYS_TRUE(expr) ((void) (expr)) +# define JS_ALWAYS_FALSE(expr) ((void) (expr)) +# define JS_THREADSAFE_ASSERT(expr) ((void) 0) +#endif + +/* + * JS_STATIC_ASSERT + * + * A compile-time assert. "cond" must be a constant expression. The macro can + * be used only in places where an "extern" declaration is allowed. + */ +#ifdef __SUNPRO_CC +/* + * Sun Studio C++ compiler has a bug + * "sizeof expression not accepted as size of array parameter" + * It happens when js_static_assert() function is declared inside functions. + * The bug number is 6688515. It is not public yet. + * Therefore, for Sun Studio, declare js_static_assert as an array instead. + */ +# define JS_STATIC_ASSERT(cond) extern char js_static_assert[(cond) ? 1 : -1] +#else +# ifdef __COUNTER__ +# define JS_STATIC_ASSERT_GLUE1(x,y) x##y +# define JS_STATIC_ASSERT_GLUE(x,y) JS_STATIC_ASSERT_GLUE1(x,y) +# define JS_STATIC_ASSERT(cond) \ + typedef int JS_STATIC_ASSERT_GLUE(js_static_assert, __COUNTER__)[(cond) ? 1 : -1] +# else +# define JS_STATIC_ASSERT(cond) extern void js_static_assert(int arg[(cond) ? 1 : -1]) +# endif +#endif + +#define JS_STATIC_ASSERT_IF(cond, expr) JS_STATIC_ASSERT(!(cond) || (expr)) + +/* + * Abort the process in a non-graceful manner. This will cause a core file, + * call to the debugger or other moral equivalent as well as causing the + * entire process to stop. + */ +extern JS_PUBLIC_API(void) JS_Abort(void); + +/* + * Custom allocator support for SpiderMonkey + */ +#if defined JS_USE_CUSTOM_ALLOCATOR +# include "jscustomallocator.h" +#else +# ifdef DEBUG +/* + * In order to test OOM conditions, when the shell command-line option + * |-A NUM| is passed, we fail continuously after the NUM'th allocation. + */ +extern JS_PUBLIC_DATA(JSUint32) OOM_maxAllocations; /* set from shell/js.cpp */ +extern JS_PUBLIC_DATA(JSUint32) OOM_counter; /* data race, who cares. */ +# define JS_OOM_POSSIBLY_FAIL() \ + do \ + { \ + if (OOM_counter++ >= OOM_maxAllocations) { \ + return NULL; \ + } \ + } while (0) + +# else +# define JS_OOM_POSSIBLY_FAIL() do {} while(0) +# endif + +/* + * SpiderMonkey code should not be calling these allocation functions directly. + * Instead, all calls should go through JSRuntime, JSContext or OffTheBooks. + * However, js_free() can be called directly. + */ +static JS_INLINE void* js_malloc(size_t bytes) +{ + JS_OOM_POSSIBLY_FAIL(); + return malloc(bytes); +} + +static JS_INLINE void* js_calloc(size_t bytes) +{ + JS_OOM_POSSIBLY_FAIL(); + return calloc(bytes, 1); +} + +static JS_INLINE void* js_realloc(void* p, size_t bytes) +{ + JS_OOM_POSSIBLY_FAIL(); + return realloc(p, bytes); +} + +static JS_INLINE void js_free(void* p) +{ + free(p); +} +#endif/* JS_USE_CUSTOM_ALLOCATOR */ + +/* + * Replace bit-scanning code sequences with CPU-specific instructions to + * speedup calculations of ceiling/floor log2. + * + * With GCC 3.4 or later we can use __builtin_clz for that, see bug 327129. + * + * SWS: Added MSVC intrinsic bitscan support. See bugs 349364 and 356856. + */ +#if defined(_WIN32) && (_MSC_VER >= 1300) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)) + +unsigned char _BitScanForward(unsigned long * Index, unsigned long Mask); +unsigned char _BitScanReverse(unsigned long * Index, unsigned long Mask); +# pragma intrinsic(_BitScanForward,_BitScanReverse) + +__forceinline static int +__BitScanForward32(unsigned int val) +{ + unsigned long idx; + + _BitScanForward(&idx, (unsigned long)val); + return (int)idx; +} +__forceinline static int +__BitScanReverse32(unsigned int val) +{ + unsigned long idx; + + _BitScanReverse(&idx, (unsigned long)val); + return (int)(31-idx); +} +# define js_bitscan_ctz32(val) __BitScanForward32(val) +# define js_bitscan_clz32(val) __BitScanReverse32(val) +# define JS_HAS_BUILTIN_BITSCAN32 + +#if defined(_M_AMD64) || defined(_M_X64) +unsigned char _BitScanForward64(unsigned long * Index, unsigned __int64 Mask); +unsigned char _BitScanReverse64(unsigned long * Index, unsigned __int64 Mask); +# pragma intrinsic(_BitScanForward64,_BitScanReverse64) + +__forceinline static int +__BitScanForward64(unsigned __int64 val) +{ + unsigned long idx; + + _BitScanForward64(&idx, val); + return (int)idx; +} +__forceinline static int +__BitScanReverse64(unsigned __int64 val) +{ + unsigned long idx; + + _BitScanReverse64(&idx, val); + return (int)(63-idx); +} +# define js_bitscan_ctz64(val) __BitScanForward64(val) +# define js_bitscan_clz64(val) __BitScanReverse64(val) +# define JS_HAS_BUILTIN_BITSCAN64 +#endif +#elif (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) + +# define js_bitscan_ctz32(val) __builtin_ctz(val) +# define js_bitscan_clz32(val) __builtin_clz(val) +# define JS_HAS_BUILTIN_BITSCAN32 +# if (JS_BYTES_PER_WORD == 8) +# define js_bitscan_ctz64(val) __builtin_ctzll(val) +# define js_bitscan_clz64(val) __builtin_clzll(val) +# define JS_HAS_BUILTIN_BITSCAN64 +# endif + +#endif + +/* +** Macro version of JS_CeilingLog2: Compute the log of the least power of +** 2 greater than or equal to _n. The result is returned in _log2. +*/ +#ifdef JS_HAS_BUILTIN_BITSCAN32 +/* + * Use intrinsic function or count-leading-zeros to calculate ceil(log2(_n)). + * The macro checks for "n <= 1" and not "n != 0" as js_bitscan_clz32(0) is + * undefined. + */ +# define JS_CEILING_LOG2(_log2,_n) \ + JS_BEGIN_MACRO \ + unsigned int j_ = (unsigned int)(_n); \ + (_log2) = (j_ <= 1 ? 0 : 32 - js_bitscan_clz32(j_ - 1)); \ + JS_END_MACRO +#else +# define JS_CEILING_LOG2(_log2,_n) \ + JS_BEGIN_MACRO \ + JSUint32 j_ = (JSUint32)(_n); \ + (_log2) = 0; \ + if ((j_) & ((j_)-1)) \ + (_log2) += 1; \ + if ((j_) >> 16) \ + (_log2) += 16, (j_) >>= 16; \ + if ((j_) >> 8) \ + (_log2) += 8, (j_) >>= 8; \ + if ((j_) >> 4) \ + (_log2) += 4, (j_) >>= 4; \ + if ((j_) >> 2) \ + (_log2) += 2, (j_) >>= 2; \ + if ((j_) >> 1) \ + (_log2) += 1; \ + JS_END_MACRO +#endif + +/* +** Macro version of JS_FloorLog2: Compute the log of the greatest power of +** 2 less than or equal to _n. The result is returned in _log2. +** +** This is equivalent to finding the highest set bit in the word. +*/ +#ifdef JS_HAS_BUILTIN_BITSCAN32 +/* + * Use js_bitscan_clz32 or count-leading-zeros to calculate floor(log2(_n)). + * Since js_bitscan_clz32(0) is undefined, the macro set the loweset bit to 1 + * to ensure 0 result when _n == 0. + */ +# define JS_FLOOR_LOG2(_log2,_n) \ + JS_BEGIN_MACRO \ + (_log2) = 31 - js_bitscan_clz32(((unsigned int)(_n)) | 1); \ + JS_END_MACRO +#else +# define JS_FLOOR_LOG2(_log2,_n) \ + JS_BEGIN_MACRO \ + JSUint32 j_ = (JSUint32)(_n); \ + (_log2) = 0; \ + if ((j_) >> 16) \ + (_log2) += 16, (j_) >>= 16; \ + if ((j_) >> 8) \ + (_log2) += 8, (j_) >>= 8; \ + if ((j_) >> 4) \ + (_log2) += 4, (j_) >>= 4; \ + if ((j_) >> 2) \ + (_log2) += 2, (j_) >>= 2; \ + if ((j_) >> 1) \ + (_log2) += 1; \ + JS_END_MACRO +#endif + +/* + * Internal function. + * Compute the log of the least power of 2 greater than or equal to n. This is + * a version of JS_CeilingLog2 that operates on unsigned integers with + * CPU-dependant size. + */ +#define JS_CEILING_LOG2W(n) ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1)) + +/* + * Internal function. + * Compute the log of the greatest power of 2 less than or equal to n. + * This is a version of JS_FloorLog2 that operates on unsigned integers with + * CPU-dependant size and requires that n != 0. + */ +#define JS_FLOOR_LOG2W(n) (JS_ASSERT((n) != 0), js_FloorLog2wImpl(n)) + +#if JS_BYTES_PER_WORD == 4 +# ifdef JS_HAS_BUILTIN_BITSCAN32 +# define js_FloorLog2wImpl(n) \ + ((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz32(n))) +# else +# define js_FloorLog2wImpl(n) ((size_t)JS_FloorLog2(n)) +# endif +#elif JS_BYTES_PER_WORD == 8 +# ifdef JS_HAS_BUILTIN_BITSCAN64 +# define js_FloorLog2wImpl(n) \ + ((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz64(n))) +# else +extern size_t js_FloorLog2wImpl(size_t n); +# endif +#else +# error "NOT SUPPORTED" +#endif + +JS_END_EXTERN_C + +#ifdef __cplusplus +#include + +/* + * User guide to memory management within SpiderMonkey: + * + * Quick tips: + * + * Allocation: + * - Prefer to allocate using JSContext: + * cx->{malloc_,realloc_,calloc_,new_,array_new} + * + * - If no JSContext is available, use a JSRuntime: + * rt->{malloc_,realloc_,calloc_,new_,array_new} + * + * - As a last resort, use unaccounted allocation ("OffTheBooks"): + * js::OffTheBooks::{malloc_,realloc_,calloc_,new_,array_new} + * + * Deallocation: + * - When the deallocation occurs on a slow path, use: + * Foreground::{free_,delete_,array_delete} + * + * - Otherwise deallocate on a background thread using a JSContext: + * cx->{free_,delete_,array_delete} + * + * - If no JSContext is available, use a JSRuntime: + * rt->{free_,delete_,array_delete} + * + * - As a last resort, use UnwantedForeground deallocation: + * js::UnwantedForeground::{free_,delete_,array_delete} + * + * General tips: + * + * - Mixing and matching these allocators is allowed (you may free memory + * allocated by any allocator, with any deallocator). + * + * - Never, ever use normal C/C++ memory management: + * malloc, free, new, new[], delete, operator new, etc. + * + * - Never, ever use low-level SpiderMonkey allocators: + * js_malloc(), js_free(), js_calloc(), js_realloc() + * Their use is reserved for the other memory managers. + * + * - Classes which have private constructors or destructors should have + * JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR added to their + * declaration. + * + * Details: + * + * Using vanilla new/new[] is unsafe in SpiderMonkey because they throw on + * failure instead of returning NULL, which is what SpiderMonkey expects. + * (Even overriding them is unsafe, as the system's C++ runtime library may + * throw, which we do not support. We also can't just use the 'nothrow' + * variant of new/new[], because we want to mediate *all* allocations + * within SpiderMonkey, to satisfy any embedders using + * JS_USE_CUSTOM_ALLOCATOR.) + * + * JSContexts and JSRuntimes keep track of memory allocated, and use this + * accounting to schedule GC. OffTheBooks does not. We'd like to remove + * OffTheBooks allocations as much as possible (bug 636558). + * + * On allocation failure, a JSContext correctly reports an error, which a + * JSRuntime and OffTheBooks does not. + * + * A JSContext deallocates in a background thread. A JSRuntime might + * deallocate in the background in the future, but does not now. Foreground + * deallocation is preferable on slow paths. UnwantedForeground deallocations + * occur where we have no JSContext or JSRuntime, and the deallocation is not + * on a slow path. We want to remove UnwantedForeground deallocations (bug + * 636561). + * + * JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR makes the allocation + * classes friends with your class, giving them access to private + * constructors and destructors. + * + * |make check| does a source level check on the number of uses OffTheBooks, + * UnwantedForeground, js_malloc, js_free etc, to prevent regressions. If you + * really must add one, update Makefile.in, and run |make check|. + * + * |make check| also statically prevents the use of vanilla new/new[]. + */ + +#define JS_NEW_BODY(allocator, t, parms) \ + void *memory = allocator(sizeof(t)); \ + return memory ? new(memory) t parms : NULL; + +/* + * Given a class which should provide new_() methods, add + * JS_DECLARE_NEW_METHODS (see JSContext for a usage example). This + * adds new_()s with up to 12 parameters. Add more versions of new_ below if + * you need more than 12 parameters. + * + * Note: Do not add a ; at the end of a use of JS_DECLARE_NEW_METHODS, + * or the build will break. + */ +#define JS_DECLARE_NEW_METHODS(ALLOCATOR, QUALIFIERS)\ + template \ + QUALIFIERS T *new_() {\ + JS_NEW_BODY(ALLOCATOR, T, ())\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11))\ + }\ +\ + template \ + QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11, P12 p12) {\ + JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12))\ + }\ + static const int JSMinAlignment = 8;\ + template \ + QUALIFIERS T *array_new(size_t n) {\ + /* The length is stored just before the vector memory. */\ + uint64 numBytes64 = uint64(JSMinAlignment) + uint64(sizeof(T)) * uint64(n);\ + size_t numBytes = size_t(numBytes64);\ + if (numBytes64 != numBytes) {\ + JS_ASSERT(0); /* we want to know if this happens in debug builds */\ + return NULL;\ + }\ + void *memory = ALLOCATOR(numBytes);\ + if (!memory)\ + return NULL;\ + *(size_t *)memory = n;\ + memory = (void*)(uintptr_t(memory) + JSMinAlignment);\ + return new(memory) T[n];\ + }\ + + +#define JS_DECLARE_DELETE_METHODS(DEALLOCATOR, QUALIFIERS)\ + template \ + QUALIFIERS void delete_(T *p) {\ + if (p) {\ + p->~T();\ + DEALLOCATOR(p);\ + }\ + }\ +\ + template \ + QUALIFIERS void array_delete(T *p) {\ + if (p) {\ + void* p0 = (void *)(uintptr_t(p) - js::OffTheBooks::JSMinAlignment);\ + size_t n = *(size_t *)p0;\ + for (size_t i = 0; i < n; i++)\ + (p + i)->~T();\ + DEALLOCATOR(p0);\ + }\ + } + + +/* + * In general, all allocations should go through a JSContext or JSRuntime, so + * that the garbage collector knows how much memory has been allocated. In + * cases where it is difficult to use a JSContext or JSRuntime, OffTheBooks can + * be used, though this is undesirable. + */ +namespace js { + +class OffTheBooks { +public: + JS_DECLARE_NEW_METHODS(::js_malloc, JS_ALWAYS_INLINE static) + + static JS_INLINE void* malloc_(size_t bytes) { + return ::js_malloc(bytes); + } + + static JS_INLINE void* calloc_(size_t bytes) { + return ::js_calloc(bytes); + } + + static JS_INLINE void* realloc_(void* p, size_t bytes) { + return ::js_realloc(p, bytes); + } +}; + +/* + * We generally prefer deallocating using JSContext because it can happen in + * the background. On slow paths, we may prefer foreground allocation. + */ +class Foreground { +public: + /* See parentheses comment above. */ + static JS_ALWAYS_INLINE void free_(void* p) { + ::js_free(p); + } + + JS_DECLARE_DELETE_METHODS(::js_free, JS_ALWAYS_INLINE static) +}; + +class UnwantedForeground : public Foreground { +}; + +} /* namespace js */ + +/* + * Note lack of ; in JSRuntime below. This is intentional so "calling" this + * looks "normal". + */ +#define JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR \ + friend class js::OffTheBooks;\ + friend class js::Foreground;\ + friend class js::UnwantedForeground;\ + friend struct ::JSContext;\ + friend struct ::JSRuntime + +/* + * The following classes are designed to cause assertions to detect + * inadvertent use of guard objects as temporaries. In other words, + * when we have a guard object whose only purpose is its constructor and + * destructor (and is never otherwise referenced), the intended use + * might be: + * JSAutoTempValueRooter tvr(cx, 1, &val); + * but is is easy to accidentally write: + * JSAutoTempValueRooter(cx, 1, &val); + * which compiles just fine, but runs the destructor well before the + * intended time. + * + * They work by adding (#ifdef DEBUG) an additional parameter to the + * guard object's constructor, with a default value, so that users of + * the guard object's API do not need to do anything. The default value + * of this parameter is a temporary object. C++ (ISO/IEC 14882:1998), + * section 12.2 [class.temporary], clauses 4 and 5 seem to assume a + * guarantee that temporaries are destroyed in the reverse of their + * construction order, but I actually can't find a statement that that + * is true in the general case (beyond the two specific cases mentioned + * there). However, it seems to be true. + * + * These classes are intended to be used only via the macros immediately + * below them: + * JS_DECL_USE_GUARD_OBJECT_NOTIFIER declares (ifdef DEBUG) a member + * variable, and should be put where a declaration of a private + * member variable would be placed. + * JS_GUARD_OBJECT_NOTIFIER_PARAM should be placed at the end of the + * parameters to each constructor of the guard object; it declares + * (ifdef DEBUG) an additional parameter. + * JS_GUARD_OBJECT_NOTIFIER_INIT is a statement that belongs in each + * constructor. It uses the parameter declared by + * JS_GUARD_OBJECT_NOTIFIER_PARAM. + */ +#ifdef DEBUG +class JS_FRIEND_API(JSGuardObjectNotifier) +{ +private: + bool* mStatementDone; +public: + JSGuardObjectNotifier() : mStatementDone(NULL) {} + + ~JSGuardObjectNotifier() { + *mStatementDone = true; + } + + void setStatementDone(bool *aStatementDone) { + mStatementDone = aStatementDone; + } +}; + +class JS_FRIEND_API(JSGuardObjectNotificationReceiver) +{ +private: + bool mStatementDone; +public: + JSGuardObjectNotificationReceiver() : mStatementDone(false) {} + + ~JSGuardObjectNotificationReceiver() { + /* + * Assert that the guard object was not used as a temporary. + * (Note that this assert might also fire if Init is not called + * because the guard object's implementation is not using the + * above macros correctly.) + */ + JS_ASSERT(mStatementDone); + } + + void Init(const JSGuardObjectNotifier &aNotifier) { + /* + * aNotifier is passed as a const reference so that we can pass a + * temporary, but we really intend it as non-const + */ + const_cast(aNotifier). + setStatementDone(&mStatementDone); + } +}; + +#define JS_DECL_USE_GUARD_OBJECT_NOTIFIER \ + JSGuardObjectNotificationReceiver _mCheckNotUsedAsTemporary; +#define JS_GUARD_OBJECT_NOTIFIER_PARAM \ + , const JSGuardObjectNotifier& _notifier = JSGuardObjectNotifier() +#define JS_GUARD_OBJECT_NOTIFIER_PARAM_NO_INIT \ + , const JSGuardObjectNotifier& _notifier +#define JS_GUARD_OBJECT_NOTIFIER_PARAM0 \ + const JSGuardObjectNotifier& _notifier = JSGuardObjectNotifier() +#define JS_GUARD_OBJECT_NOTIFIER_INIT \ + JS_BEGIN_MACRO _mCheckNotUsedAsTemporary.Init(_notifier); JS_END_MACRO + +#else /* defined(DEBUG) */ + +#define JS_DECL_USE_GUARD_OBJECT_NOTIFIER +#define JS_GUARD_OBJECT_NOTIFIER_PARAM +#define JS_GUARD_OBJECT_NOTIFIER_PARAM_NO_INIT +#define JS_GUARD_OBJECT_NOTIFIER_PARAM0 +#define JS_GUARD_OBJECT_NOTIFIER_INIT JS_BEGIN_MACRO JS_END_MACRO + +#endif /* !defined(DEBUG) */ + +namespace js { + +/* + * "Move" References + * + * Some types can be copied much more efficiently if we know the original's + * value need not be preserved --- that is, if we are doing a "move", not a + * "copy". For example, if we have: + * + * Vector u; + * Vector v(u); + * + * the constructor for v must apply a copy constructor to each element of u --- + * taking time linear in the length of u. However, if we know we will not need u + * any more once v has been initialized, then we could initialize v very + * efficiently simply by stealing u's dynamically allocated buffer and giving it + * to v --- a constant-time operation, regardless of the size of u. + * + * Moves often appear in container implementations. For example, when we append + * to a vector, we may need to resize its buffer. This entails moving each of + * its extant elements from the old, smaller buffer to the new, larger buffer. + * But once the elements have been migrated, we're just going to throw away the + * old buffer; we don't care if they still have their values. So if the vector's + * element type can implement "move" more efficiently than "copy", the vector + * resizing should by all means use a "move" operation. Hash tables also need to + * be resized. + * + * The details of the optimization, and whether it's worth applying, vary from + * one type to the next. And while some constructor calls are moves, many really + * are copies, and can't be optimized this way. So we need: + * + * 1) a way for a particular invocation of a copy constructor to say that it's + * really a move, and that the value of the original isn't important + * afterwards (althought it must still be safe to destroy); and + * + * 2) a way for a type (like Vector) to announce that it can be moved more + * efficiently than it can be copied, and provide an implementation of that + * move operation. + * + * The Move(T &) function takes a reference to a T, and returns an MoveRef + * referring to the same value; that's 1). An MoveRef is simply a reference + * to a T, annotated to say that a copy constructor applied to it may move that + * T, instead of copying it. Finally, a constructor that accepts an MoveRef + * should perform a more efficient move, instead of a copy, providing 2). + * + * So, where we might define a copy constructor for a class C like this: + * + * C(const C &rhs) { ... copy rhs to this ... } + * + * we would declare a move constructor like this: + * + * C(MoveRef rhs) { ... move rhs to this ... } + * + * And where we might perform a copy like this: + * + * C c2(c1); + * + * we would perform a move like this: + * + * C c2(Move(c1)) + * + * Note that MoveRef implicitly converts to T &, so you can pass an + * MoveRef to an ordinary copy constructor for a type that doesn't support a + * special move constructor, and you'll just get a copy. This means that + * templates can use Move whenever they know they won't use the original value + * any more, even if they're not sure whether the type at hand has a specialized + * move constructor. If it doesn't, the MoveRef will just convert to a T &, + * and the ordinary copy constructor will apply. + * + * A class with a move constructor can also provide a move assignment operator, + * which runs this's destructor, and then applies the move constructor to + * *this's memory. A typical definition: + * + * C &operator=(MoveRef rhs) { + * this->~C(); + * new(this) C(rhs); + * return *this; + * } + * + * With that in place, one can write move assignments like this: + * + * c2 = Move(c1); + * + * This destroys c1, moves c1's value to c2, and leaves c1 in an undefined but + * destructible state. + * + * This header file defines MoveRef and Move in the js namespace. It's up to + * individual containers to annotate moves as such, by calling Move; and it's up + * to individual types to define move constructors. + * + * One hint: if you're writing a move constructor where the type has members + * that should be moved themselves, it's much nicer to write this: + * + * C(MoveRef c) : x(c->x), y(c->y) { } + * + * than the equivalent: + * + * C(MoveRef c) { new(&x) X(c->x); new(&y) Y(c->y); } + * + * especially since GNU C++ fails to notice that this does indeed initialize x + * and y, which may matter if they're const. + */ +template +class MoveRef { + public: + typedef T Referent; + explicit MoveRef(T &t) : pointer(&t) { } + T &operator*() const { return *pointer; } + T *operator->() const { return pointer; } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /* + * If MoveRef is used in a rvalue position (which is expected), we can + * end up in a situation where, without this ifdef, we would try to pass + * a T& to a move constructor, which fails. It is not clear if the compiler + * should instead use the copy constructor, but for now this lets us build + * with clang. See bug 689066 and llvm.org/pr11003 for the details. + * Note: We can probably remove MoveRef completely once we are comfortable + * using c++11. + */ + operator T&& () const { return static_cast(*pointer); } +#else + operator T& () const { return *pointer; } +#endif + private: + T *pointer; +}; + +template +MoveRef Move(T &t) { return MoveRef(t); } + +template +MoveRef Move(const T &t) { return MoveRef(const_cast(t)); } + +/* Useful for implementing containers that assert non-reentrancy */ +class ReentrancyGuard +{ + /* ReentrancyGuard is not copyable. */ + ReentrancyGuard(const ReentrancyGuard &); + void operator=(const ReentrancyGuard &); + +#ifdef DEBUG + bool &entered; +#endif + public: + template +#ifdef DEBUG + ReentrancyGuard(T &obj) + : entered(obj.entered) +#else + ReentrancyGuard(T &/*obj*/) +#endif + { +#ifdef DEBUG + JS_ASSERT(!entered); + entered = true; +#endif + } + ~ReentrancyGuard() + { +#ifdef DEBUG + entered = false; +#endif + } +}; + +/* + * Round x up to the nearest power of 2. This function assumes that the most + * significant bit of x is not set, which would lead to overflow. + */ +JS_ALWAYS_INLINE size_t +RoundUpPow2(size_t x) +{ + return size_t(1) << JS_CEILING_LOG2W(x); +} + +} /* namespace js */ + +#endif /* defined(__cplusplus) */ + +/* + * This signature is for malloc_usable_size-like functions used to measure + * memory usage. A return value of zero indicates that the size is unknown, + * and so a fall-back computation should be done for the size. + */ +typedef size_t(*JSUsableSizeFun)(void *p); + +/* sixgill annotation defines */ +#ifndef HAVE_STATIC_ANNOTATIONS +# define HAVE_STATIC_ANNOTATIONS +# ifdef XGILL_PLUGIN +# define STATIC_PRECONDITION(COND) __attribute__((precondition(#COND))) +# define STATIC_PRECONDITION_ASSUME(COND) __attribute__((precondition_assume(#COND))) +# define STATIC_POSTCONDITION(COND) __attribute__((postcondition(#COND))) +# define STATIC_POSTCONDITION_ASSUME(COND) __attribute__((postcondition_assume(#COND))) +# define STATIC_INVARIANT(COND) __attribute__((invariant(#COND))) +# define STATIC_INVARIANT_ASSUME(COND) __attribute__((invariant_assume(#COND))) +# define STATIC_PASTE2(X,Y) X ## Y +# define STATIC_PASTE1(X,Y) STATIC_PASTE2(X,Y) +# define STATIC_ASSERT(COND) \ + JS_BEGIN_MACRO \ + __attribute__((assert_static(#COND), unused)) \ + int STATIC_PASTE1(assert_static_, __COUNTER__); \ + JS_END_MACRO +# define STATIC_ASSUME(COND) \ + JS_BEGIN_MACRO \ + __attribute__((assume_static(#COND), unused)) \ + int STATIC_PASTE1(assume_static_, __COUNTER__); \ + JS_END_MACRO +# define STATIC_ASSERT_RUNTIME(COND) \ + JS_BEGIN_MACRO \ + __attribute__((assert_static_runtime(#COND), unused)) \ + int STATIC_PASTE1(assert_static_runtime_, __COUNTER__); \ + JS_END_MACRO +# else /* XGILL_PLUGIN */ +# define STATIC_PRECONDITION(COND) /* nothing */ +# define STATIC_PRECONDITION_ASSUME(COND) /* nothing */ +# define STATIC_POSTCONDITION(COND) /* nothing */ +# define STATIC_POSTCONDITION_ASSUME(COND) /* nothing */ +# define STATIC_INVARIANT(COND) /* nothing */ +# define STATIC_INVARIANT_ASSUME(COND) /* nothing */ +# define STATIC_ASSERT(COND) JS_BEGIN_MACRO /* nothing */ JS_END_MACRO +# define STATIC_ASSUME(COND) JS_BEGIN_MACRO /* nothing */ JS_END_MACRO +# define STATIC_ASSERT_RUNTIME(COND) JS_BEGIN_MACRO /* nothing */ JS_END_MACRO +# endif /* XGILL_PLUGIN */ +# define STATIC_SKIP_INFERENCE STATIC_INVARIANT(skip_inference()) +#endif /* HAVE_STATIC_ANNOTATIONS */ + +#endif /* js_utility_h__ */ diff --git a/js/src/jsvector.h b/js/public/Vector.h similarity index 99% rename from js/src/jsvector.h rename to js/public/Vector.h index b35ed401058..d5022d5471a 100644 --- a/js/src/jsvector.h +++ b/js/public/Vector.h @@ -41,10 +41,8 @@ #ifndef jsvector_h_ #define jsvector_h_ -#include "jsalloc.h" -#include "jstl.h" -#include "jsprvtd.h" -#include "jsutil.h" +#include "TemplateLib.h" +#include "Utility.h" /* Silence dire "bugs in previous versions of MSVC have been fixed" warnings */ #ifdef _MSC_VER @@ -54,6 +52,9 @@ namespace js { +template +class Vector; + /* * This template class provides a default implementation for vector operations * when the element type is not known to be a POD, as judged by IsPodType. diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 1f31796ef02..b110ac0c1c1 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -95,7 +95,13 @@ endif FORCE_STATIC_LIB = 1 DIST_INSTALL = 1 -VPATH = $(srcdir) +VPATH = \ + $(srcdir) \ + $(srcdir)/builtin \ + $(srcdir)/ds \ + $(srcdir)/frontend \ + $(srcdir)/vm \ + $(NULL) CPPSRCS = \ jsalloc.cpp \ @@ -177,7 +183,6 @@ INSTALLED_HEADERS = \ jsalloc.h \ jsapi.h \ jsatom.h \ - jsbit.h \ jsclass.h \ jsclist.h \ jsclone.h \ @@ -217,9 +222,6 @@ INSTALLED_HEADERS = \ jstypedarray.h \ jstypes.h \ jsutil.h \ - jsvector.h \ - jstl.h \ - jshashtable.h \ jsversion.h \ jswrapper.h \ jsxdrapi.h \ @@ -228,16 +230,10 @@ INSTALLED_HEADERS = \ $(NULL) ###################################################### -# BEGIN include sources for the engine subdirectories +# BEGIN exported headers that are only exported +# because of inclusion by an INSTALLED_HEADER # -VPATH += \ - $(srcdir)/builtin \ - $(srcdir)/ds \ - $(srcdir)/frontend \ - $(srcdir)/vm \ - $(NULL) - -EXPORTS_NAMESPACES = vm ds +EXPORTS_NAMESPACES += vm ds EXPORTS_vm = \ String.h \ @@ -246,7 +242,28 @@ EXPORTS_vm = \ $(NULL) EXPORTS_ds = \ - LifoAlloc.h + LifoAlloc.h \ + $(NULL) + +###################################################### +# BEGIN include exported headers from the JS engine +# +# Ultimately, after cleansing INSTALLED_HEADERS, +# these will be the ONLY headers exported by +# the js engine +# +VPATH += \ + $(srcdir)/../public \ + $(NULL) + +EXPORTS_NAMESPACES += js + +EXPORTS_js = \ + HashTable.h \ + TemplateLib.h \ + Utility.h \ + Vector.h \ + $(NULL) ############################################### # BEGIN include sources for low-level code shared with Gecko @@ -259,9 +276,9 @@ EXPORTS_NAMESPACES += mozilla EXPORTS_mozilla = \ RangedPtr.h \ - RefPtr.h \ - Types.h \ - Util.h \ + RefPtr.h \ + Types.h \ + Util.h \ $(NULL) ifdef ENABLE_TRACEJIT diff --git a/js/src/assembler/assembler/X86Assembler.h b/js/src/assembler/assembler/X86Assembler.h index 2e88694cc97..0f17ddf265e 100644 --- a/js/src/assembler/assembler/X86Assembler.h +++ b/js/src/assembler/assembler/X86Assembler.h @@ -37,7 +37,7 @@ #include "AssemblerBuffer.h" #include "jsstdint.h" #include "assembler/wtf/Assertions.h" -#include "jsvector.h" +#include "js/Vector.h" #include "methodjit/Logging.h" #define IPFX " %s" diff --git a/js/src/assembler/jit/ExecutableAllocator.h b/js/src/assembler/jit/ExecutableAllocator.h index eeefd797dbe..9094f01dfac 100644 --- a/js/src/assembler/jit/ExecutableAllocator.h +++ b/js/src/assembler/jit/ExecutableAllocator.h @@ -28,13 +28,14 @@ #include // for ptrdiff_t #include -#include "assembler/wtf/Assertions.h" +#include "jsalloc.h" #include "jsapi.h" -#include "jshashtable.h" #include "jsprvtd.h" -#include "jsvector.h" -#include "jslock.h" + +#include "assembler/wtf/Assertions.h" +#include "js/HashTable.h" +#include "js/Vector.h" #if WTF_CPU_SPARC #ifdef linux // bugzilla 502369 diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp index d69537ba2fd..c85943550b6 100644 --- a/js/src/builtin/RegExp.cpp +++ b/js/src/builtin/RegExp.cpp @@ -39,7 +39,6 @@ * ***** END LICENSE BLOCK ***** */ #include "jsinfer.h" -#include "jstl.h" #include "builtin/RegExp.h" diff --git a/js/src/ctypes/CTypes.h b/js/src/ctypes/CTypes.h index 3de1b758ab5..346413e33c7 100644 --- a/js/src/ctypes/CTypes.h +++ b/js/src/ctypes/CTypes.h @@ -41,10 +41,11 @@ #include "jscntxt.h" #include "jsapi.h" -#include "jshashtable.h" #include "prlink.h" #include "ffi.h" +#include "js/HashTable.h" + namespace js { namespace ctypes { diff --git a/js/src/mfbt/InlineMap.h b/js/src/ds/InlineMap.h similarity index 99% rename from js/src/mfbt/InlineMap.h rename to js/src/ds/InlineMap.h index c2bebcb1fe5..54b4810d613 100644 --- a/js/src/mfbt/InlineMap.h +++ b/js/src/ds/InlineMap.h @@ -41,7 +41,7 @@ #ifndef InlineMap_h__ #define InlineMap_h__ -#include "jshashtable.h" +#include "js/HashTable.h" namespace js { diff --git a/js/src/ds/LifoAlloc.h b/js/src/ds/LifoAlloc.h index a19e6cc36bf..bff07bad37e 100644 --- a/js/src/ds/LifoAlloc.h +++ b/js/src/ds/LifoAlloc.h @@ -49,7 +49,8 @@ */ #include "jsutil.h" -#include "jstl.h" + +#include "js/TemplateLib.h" namespace js { diff --git a/js/src/frontend/ParseMaps.h b/js/src/frontend/ParseMaps.h index fabded4454c..25584b87366 100644 --- a/js/src/frontend/ParseMaps.h +++ b/js/src/frontend/ParseMaps.h @@ -41,9 +41,8 @@ #ifndef ParseMaps_h__ #define ParseMaps_h__ -#include "jsvector.h" - -#include "mfbt/InlineMap.h" +#include "ds/InlineMap.h" +#include "js/HashTable.h" namespace js { diff --git a/js/src/jsanalyze.h b/js/src/jsanalyze.h index ca94a2f7bd8..f8ec909ca83 100644 --- a/js/src/jsanalyze.h +++ b/js/src/jsanalyze.h @@ -45,9 +45,9 @@ #include "jscntxt.h" #include "jsinfer.h" #include "jsscript.h" -#include "jstl.h" #include "ds/LifoAlloc.h" +#include "js/TemplateLib.h" struct JSScript; diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 62675861460..326f2f02c29 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -40,7 +40,10 @@ #include "jsapi.h" #include "jsprvtd.h" -#include "jsvector.h" +#include "jsalloc.h" + +#include "js/Vector.h" + #include #include #include diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 2a5a4896a4b..72482311483 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -83,7 +83,6 @@ #include "jstracer.h" #include "prmjtime.h" #include "jsstaticcheck.h" -#include "jsvector.h" #include "jsweakmap.h" #include "jswrapper.h" #include "jstypedarray.h" @@ -96,7 +95,6 @@ #include "jsobjinlines.h" #include "jsscopeinlines.h" #include "jsscriptinlines.h" -#include "assembler/wtf/Platform.h" #include "vm/RegExpObject-inl.h" #include "vm/Stack-inl.h" diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 6d6c9a38cdb..45332b9b3e4 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -47,9 +47,10 @@ #include #include "js-config.h" #include "jspubtd.h" -#include "jsutil.h" #include "jsval.h" +#include "js/Utility.h" + /************************************************************************/ /* JS::Value can store a full int32. */ diff --git a/js/src/jsarena.cpp b/js/src/jsarena.cpp deleted file mode 100644 index 9d41f79258e..00000000000 --- a/js/src/jsarena.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * 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"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* - * Lifetime-based fast allocation, inspired by much prior art, including - * "Fast Allocation and Deallocation of Memory Based on Object Lifetimes" - * David R. Hanson, Software -- Practice and Experience, Vol. 20(1). - */ -#include -#include -#include "jsalloc.h" -#include "jstypes.h" -#include "jsstdint.h" -#include "jsbit.h" -#include "jsarena.h" -#include "jsprvtd.h" - -using namespace js; - -/* If JSArena's length is a multiple of 8, that ensures its payload is 8-aligned. */ -JS_STATIC_ASSERT(sizeof(JSArena) % 8 == 0); - -JS_PUBLIC_API(void) -JS_InitArenaPool(JSArenaPool *pool, const char *name, size_t size, size_t align) -{ - /* Restricting ourselves to some simple alignments keeps things simple. */ - if (align == 1 || align == 2 || align == 4 || align == 8) { - pool->mask = align - 1; - } else { - /* This shouldn't happen, but set pool->mask reasonably if it does. */ - JS_NOT_REACHED("JS_InitArenaPool: bad align"); - pool->mask = 7; - } - pool->first.next = NULL; - /* pool->first is a zero-sized dummy arena that's never allocated from. */ - pool->first.base = pool->first.avail = pool->first.limit = - JS_ARENA_ALIGN(pool, &pool->first + 1); - pool->current = &pool->first; - pool->arenasize = size; -} - -JS_PUBLIC_API(void *) -JS_ArenaAllocate(JSArenaPool *pool, size_t nb) -{ - /* - * Search pool from current forward till we find or make enough space. - * - * NB: subtract nb from a->limit in the loop condition, instead of adding - * nb to a->avail, to avoid overflow (possible when running a 32-bit - * program on a 64-bit system where the kernel maps the heap up against the - * top of the 32-bit address space, see bug 279273). Note that this - * necessitates a comparison between nb and a->limit that looks like a - * (conceptual) type error but isn't. - */ - JS_ASSERT((nb & pool->mask) == 0); - JSArena *a; - /* - * Comparing nb to a->limit looks like a (conceptual) type error, but it's - * necessary to avoid wrap-around. Yuk. - */ - for (a = pool->current; nb > a->limit || a->avail > a->limit - nb; pool->current = a) { - JSArena **ap = &a->next; - if (!*ap) { - /* Not enough space in pool, so we must malloc. */ - size_t gross = sizeof(JSArena) + JS_MAX(nb, pool->arenasize); - a = (JSArena *) OffTheBooks::malloc_(gross); - if (!a) - return NULL; - - a->next = NULL; - a->base = a->avail = jsuword(a) + sizeof(JSArena); - /* - * Because malloc returns 8-aligned pointers and sizeof(JSArena) is - * a multiple of 8, a->base will always be 8-aligned, which should - * suffice for any valid pool. - */ - JS_ASSERT(a->base == JS_ARENA_ALIGN(pool, a->base)); - a->limit = (jsuword)a + gross; - - *ap = a; - continue; - } - a = *ap; /* move to next arena */ - } - - void* p = (void *)a->avail; - a->avail += nb; - JS_ASSERT(a->base <= a->avail && a->avail <= a->limit); - return p; -} - -JS_PUBLIC_API(void *) -JS_ArenaRealloc(JSArenaPool *pool, void *p, size_t size, size_t incr) -{ - /* If we've called JS_ArenaRealloc, the new size must be bigger than pool->arenasize. */ - JS_ASSERT(size + incr > pool->arenasize); - - /* Find the arena containing |p|. */ - JSArena *a; - JSArena **ap = &pool->first.next; - while (true) { - a = *ap; - if (JS_IS_IN_ARENA(a, p)) - break; - JS_ASSERT(a != pool->current); - ap = &a->next; - } - /* If we've called JS_ArenaRealloc, p must be at the start of an arena. */ - JS_ASSERT(a->base == jsuword(p)); - - size_t gross = sizeof(JSArena) + JS_ARENA_ALIGN(pool, size + incr); - a = (JSArena *) OffTheBooks::realloc_(a, gross); - if (!a) - return NULL; - - a->base = jsuword(a) + sizeof(JSArena); - a->avail = a->limit = jsuword(a) + gross; - /* - * Because realloc returns 8-aligned pointers and sizeof(JSArena) is a - * multiple of 8, a->base will always be 8-aligned, which should suffice - * for any valid pool. - */ - JS_ASSERT(a->base == JS_ARENA_ALIGN(pool, a->base)); - - if (a != *ap) { - /* realloc moved the allocation: update other pointers to a. */ - if (pool->current == *ap) - pool->current = a; - *ap = a; - } - - return (void *)a->base; -} - -JS_PUBLIC_API(void *) -JS_ArenaGrow(JSArenaPool *pool, void *p, size_t size, size_t incr) -{ - void *newp; - - /* - * If p points to an oversized allocation, it owns an entire arena, so we - * can simply realloc the arena. - */ - if (size > pool->arenasize) - return JS_ArenaRealloc(pool, p, size, incr); - - JS_ARENA_ALLOCATE(newp, pool, size + incr); - if (newp) - memcpy(newp, p, size); - return newp; -} - -/* - * Free tail arenas linked after head, which may not be the true list head. - * Reset pool->current to point to head in case it pointed at a tail arena. - */ -static void -FreeArenaList(JSArenaPool *pool, JSArena *head) -{ - JSArena **ap, *a; - - ap = &head->next; - a = *ap; - if (!a) - return; - -#ifdef DEBUG - do { - JS_ASSERT(a->base <= a->avail && a->avail <= a->limit); - a->avail = a->base; - JS_CLEAR_UNUSED(a); - } while ((a = a->next) != NULL); - a = *ap; -#endif - - do { - *ap = a->next; - JS_CLEAR_ARENA(a); - UnwantedForeground::free_(a); - } while ((a = *ap) != NULL); - - pool->current = head; -} - -JS_PUBLIC_API(void) -JS_ArenaRelease(JSArenaPool *pool, char *mark) -{ - JSArena *a; - - for (a = &pool->first; a; a = a->next) { - JS_ASSERT(a->base <= a->avail && a->avail <= a->limit); - - if (JS_IS_IN_ARENA(a, mark)) { - a->avail = JS_ARENA_ALIGN(pool, mark); - JS_ASSERT(a->avail <= a->limit); - FreeArenaList(pool, a); - return; - } - } -} - -JS_PUBLIC_API(void) -JS_FreeArenaPool(JSArenaPool *pool) -{ - FreeArenaList(pool, &pool->first); -} - -JS_PUBLIC_API(void) -JS_FinishArenaPool(JSArenaPool *pool) -{ - FreeArenaList(pool, &pool->first); -} - -JS_PUBLIC_API(void) -JS_ArenaFinish() -{ -} - -JS_PUBLIC_API(void) -JS_ArenaShutDown(void) -{ -} diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 3b6f3e0e3b0..7ee964b6b7f 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -109,7 +109,6 @@ #include "jsapi.h" #include "jsarray.h" #include "jsatom.h" -#include "jsbit.h" #include "jsbool.h" #include "jsbuiltins.h" #include "jscntxt.h" @@ -126,7 +125,6 @@ #include "jsstr.h" #include "jsstaticcheck.h" #include "jstracer.h" -#include "jsvector.h" #include "jswrapper.h" #include "methodjit/MethodJIT.h" #include "methodjit/StubCalls.h" diff --git a/js/src/jsatom.cpp b/js/src/jsatom.cpp index 58cd5ca6cc0..1b4a8cfa317 100644 --- a/js/src/jsatom.cpp +++ b/js/src/jsatom.cpp @@ -52,7 +52,6 @@ #include "jsprf.h" #include "jsapi.h" #include "jsatom.h" -#include "jsbit.h" #include "jscntxt.h" #include "jsgc.h" #include "jsgcmark.h" diff --git a/js/src/jsatom.h b/js/src/jsatom.h index 4386bb7ecfe..dc7740ef92f 100644 --- a/js/src/jsatom.h +++ b/js/src/jsatom.h @@ -42,13 +42,14 @@ #include #include "jsversion.h" +#include "jsalloc.h" #include "jsapi.h" #include "jsprvtd.h" #include "jshash.h" -#include "jshashtable.h" #include "jspubtd.h" #include "jslock.h" +#include "js/HashTable.h" #include "vm/String.h" /* Engine-internal extensions of jsid */ diff --git a/js/src/jsbit.h b/js/src/jsbit.h deleted file mode 100644 index de1e2912e2d..00000000000 --- a/js/src/jsbit.h +++ /dev/null @@ -1,305 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * 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"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef jsbit_h___ -#define jsbit_h___ - -#include "jstypes.h" -#include "jscompat.h" -#include "jsutil.h" - -JS_BEGIN_EXTERN_C - -/* -** A jsbitmap_t is a long integer that can be used for bitmaps -*/ -typedef jsuword jsbitmap_t; /* NSPR name, a la Unix system types */ -typedef jsbitmap_t jsbitmap; /* JS-style scalar typedef name */ - -#define JS_BITMAP_SIZE(bits) (JS_HOWMANY(bits, JS_BITS_PER_WORD) * \ - sizeof(jsbitmap)) - -#define JS_TEST_BIT(_map,_bit) ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] & \ - ((jsbitmap)1<<((_bit)&(JS_BITS_PER_WORD-1)))) -#define JS_SET_BIT(_map,_bit) ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] |= \ - ((jsbitmap)1<<((_bit)&(JS_BITS_PER_WORD-1)))) -#define JS_CLEAR_BIT(_map,_bit) ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] &= \ - ~((jsbitmap)1<<((_bit)&(JS_BITS_PER_WORD-1)))) - -/* -** Compute the log of the least power of 2 greater than or equal to n -*/ -extern JS_PUBLIC_API(JSIntn) JS_CeilingLog2(JSUint32 i); - -/* -** Compute the log of the greatest power of 2 less than or equal to n -*/ -extern JS_PUBLIC_API(JSIntn) JS_FloorLog2(JSUint32 i); - -/* - * Replace bit-scanning code sequences with CPU-specific instructions to - * speedup calculations of ceiling/floor log2. - * - * With GCC 3.4 or later we can use __builtin_clz for that, see bug 327129. - * - * SWS: Added MSVC intrinsic bitscan support. See bugs 349364 and 356856. - */ -#if defined(_WIN32) && (_MSC_VER >= 1300) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)) - -unsigned char _BitScanForward(unsigned long * Index, unsigned long Mask); -unsigned char _BitScanReverse(unsigned long * Index, unsigned long Mask); -# pragma intrinsic(_BitScanForward,_BitScanReverse) - -__forceinline static int -__BitScanForward32(unsigned int val) -{ - unsigned long idx; - - _BitScanForward(&idx, (unsigned long)val); - return (int)idx; -} -__forceinline static int -__BitScanReverse32(unsigned int val) -{ - unsigned long idx; - - _BitScanReverse(&idx, (unsigned long)val); - return (int)(31-idx); -} -# define js_bitscan_ctz32(val) __BitScanForward32(val) -# define js_bitscan_clz32(val) __BitScanReverse32(val) -# define JS_HAS_BUILTIN_BITSCAN32 - -#if defined(_M_AMD64) || defined(_M_X64) -unsigned char _BitScanForward64(unsigned long * Index, unsigned __int64 Mask); -unsigned char _BitScanReverse64(unsigned long * Index, unsigned __int64 Mask); -# pragma intrinsic(_BitScanForward64,_BitScanReverse64) - -__forceinline static int -__BitScanForward64(unsigned __int64 val) -{ - unsigned long idx; - - _BitScanForward64(&idx, val); - return (int)idx; -} -__forceinline static int -__BitScanReverse64(unsigned __int64 val) -{ - unsigned long idx; - - _BitScanReverse64(&idx, val); - return (int)(63-idx); -} -# define js_bitscan_ctz64(val) __BitScanForward64(val) -# define js_bitscan_clz64(val) __BitScanReverse64(val) -# define JS_HAS_BUILTIN_BITSCAN64 -#endif -#elif (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) - -# define js_bitscan_ctz32(val) __builtin_ctz(val) -# define js_bitscan_clz32(val) __builtin_clz(val) -# define JS_HAS_BUILTIN_BITSCAN32 -# if (JS_BYTES_PER_WORD == 8) -# define js_bitscan_ctz64(val) __builtin_ctzll(val) -# define js_bitscan_clz64(val) __builtin_clzll(val) -# define JS_HAS_BUILTIN_BITSCAN64 -# endif - -#endif - -/* -** Macro version of JS_CeilingLog2: Compute the log of the least power of -** 2 greater than or equal to _n. The result is returned in _log2. -*/ -#ifdef JS_HAS_BUILTIN_BITSCAN32 -/* - * Use intrinsic function or count-leading-zeros to calculate ceil(log2(_n)). - * The macro checks for "n <= 1" and not "n != 0" as js_bitscan_clz32(0) is - * undefined. - */ -# define JS_CEILING_LOG2(_log2,_n) \ - JS_BEGIN_MACRO \ - unsigned int j_ = (unsigned int)(_n); \ - (_log2) = (j_ <= 1 ? 0 : 32 - js_bitscan_clz32(j_ - 1)); \ - JS_END_MACRO -#else -# define JS_CEILING_LOG2(_log2,_n) \ - JS_BEGIN_MACRO \ - JSUint32 j_ = (JSUint32)(_n); \ - (_log2) = 0; \ - if ((j_) & ((j_)-1)) \ - (_log2) += 1; \ - if ((j_) >> 16) \ - (_log2) += 16, (j_) >>= 16; \ - if ((j_) >> 8) \ - (_log2) += 8, (j_) >>= 8; \ - if ((j_) >> 4) \ - (_log2) += 4, (j_) >>= 4; \ - if ((j_) >> 2) \ - (_log2) += 2, (j_) >>= 2; \ - if ((j_) >> 1) \ - (_log2) += 1; \ - JS_END_MACRO -#endif - -/* -** Macro version of JS_FloorLog2: Compute the log of the greatest power of -** 2 less than or equal to _n. The result is returned in _log2. -** -** This is equivalent to finding the highest set bit in the word. -*/ -#ifdef JS_HAS_BUILTIN_BITSCAN32 -/* - * Use js_bitscan_clz32 or count-leading-zeros to calculate floor(log2(_n)). - * Since js_bitscan_clz32(0) is undefined, the macro set the loweset bit to 1 - * to ensure 0 result when _n == 0. - */ -# define JS_FLOOR_LOG2(_log2,_n) \ - JS_BEGIN_MACRO \ - (_log2) = 31 - js_bitscan_clz32(((unsigned int)(_n)) | 1); \ - JS_END_MACRO -#else -# define JS_FLOOR_LOG2(_log2,_n) \ - JS_BEGIN_MACRO \ - JSUint32 j_ = (JSUint32)(_n); \ - (_log2) = 0; \ - if ((j_) >> 16) \ - (_log2) += 16, (j_) >>= 16; \ - if ((j_) >> 8) \ - (_log2) += 8, (j_) >>= 8; \ - if ((j_) >> 4) \ - (_log2) += 4, (j_) >>= 4; \ - if ((j_) >> 2) \ - (_log2) += 2, (j_) >>= 2; \ - if ((j_) >> 1) \ - (_log2) += 1; \ - JS_END_MACRO -#endif - -/* - * Internal function. - * Compute the log of the least power of 2 greater than or equal to n. This is - * a version of JS_CeilingLog2 that operates on unsigned integers with - * CPU-dependant size. - */ -#define JS_CEILING_LOG2W(n) ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1)) - -/* - * Internal function. - * Compute the log of the greatest power of 2 less than or equal to n. - * This is a version of JS_FloorLog2 that operates on unsigned integers with - * CPU-dependant size and requires that n != 0. - */ -#define JS_FLOOR_LOG2W(n) (JS_ASSERT((n) != 0), js_FloorLog2wImpl(n)) - -#if JS_BYTES_PER_WORD == 4 - -# ifdef JS_HAS_BUILTIN_BITSCAN32 -# define js_FloorLog2wImpl(n) \ - ((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz32(n))) -# else -# define js_FloorLog2wImpl(n) ((size_t)JS_FloorLog2(n)) -#endif - -#elif JS_BYTES_PER_WORD == 8 - -# ifdef JS_HAS_BUILTIN_BITSCAN64 -# define js_FloorLog2wImpl(n) \ - ((size_t)(JS_BITS_PER_WORD - 1 - js_bitscan_clz64(n))) -# else -extern size_t js_FloorLog2wImpl(size_t n); -# endif - -#else - -# error "NOT SUPPORTED" - -#endif - -namespace js { - -inline size_t -CountTrailingZeros(size_t n) -{ - JS_ASSERT(n != 0); -#if JS_BYTES_PER_WORD != 4 && JS_BYTES_PER_WORD != 8 -# error "NOT SUPPORTED" -#endif - -#if JS_BYTES_PER_WORD == 4 && defined JS_HAS_BUILTIN_BITSCAN32 - return js_bitscan_ctz32(n); -#elif JS_BYTES_PER_WORD == 8 && defined JS_HAS_BUILTIN_BITSCAN64 - return js_bitscan_ctz64(n); -#else - size_t count = 0; -# if JS_BYTES_PER_WORD == 8 - if (!(n & size_t(0xFFFFFFFFU))) { count += 32; n >>= 32; } -# endif - if (!(n & 0xFFFF)) { count += 16; n >>= 16; } - if (!(n & 0xFF)) { count += 8; n >>= 8; } - if (!(n & 0xF)) { count += 4; n >>= 4; } - if (!(n & 0x3)) { count += 2; n >>= 2; } - if (!(n & 0x1)) { count += 1; n >>= 1; } - return count + 1 - (n & 0x1); -#endif -} - -} - -/* - * Macros for rotate left. There is no rotate operation in the C Language so - * the construct (a << 4) | (a >> 28) is used instead. Most compilers convert - * this to a rotate instruction but some versions of MSVC don't without a - * little help. To get MSVC to generate a rotate instruction, we have to use - * the _rotl intrinsic and use a pragma to make _rotl inline. - * - * MSVC in VS2005 will do an inline rotate instruction on the above construct. - */ - -#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \ - defined(_M_X64)) -#include -#pragma intrinsic(_rotl) -#define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits) -#else -#define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))) -#endif - -JS_END_EXTERN_C -#endif /* jsbit_h___ */ diff --git a/js/src/jsbool.cpp b/js/src/jsbool.cpp index d98b7f05c06..af67f64299f 100644 --- a/js/src/jsbool.cpp +++ b/js/src/jsbool.cpp @@ -53,7 +53,6 @@ #include "jsnum.h" #include "jsobj.h" #include "jsstr.h" -#include "jsvector.h" #include "vm/GlobalObject.h" diff --git a/js/src/jsbuiltins.cpp b/js/src/jsbuiltins.cpp index 52ec1f05543..5a74deec30f 100644 --- a/js/src/jsbuiltins.cpp +++ b/js/src/jsbuiltins.cpp @@ -58,7 +58,6 @@ #include "jsstr.h" #include "jsbuiltins.h" #include "jstracer.h" -#include "jsvector.h" #include "jsatominlines.h" #include "jscntxtinlines.h" diff --git a/js/src/jsclone.h b/js/src/jsclone.h index a2d34f358a4..fb89f61e416 100644 --- a/js/src/jsclone.h +++ b/js/src/jsclone.h @@ -41,9 +41,10 @@ #include "jsapi.h" #include "jscntxt.h" -#include "jshashtable.h" #include "jsstdint.h" -#include "jsvector.h" + +#include "js/HashTable.h" +#include "js/Vector.h" JS_FRIEND_API(uint64_t) js_GetSCOffset(JSStructuredCloneWriter* writer); diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index c5d58bfa7ff..aaabc759224 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -51,15 +51,15 @@ #include "jsdhash.h" #include "jsgc.h" #include "jsgcchunk.h" -#include "jshashtable.h" #include "jspropertycache.h" #include "jspropertytree.h" #include "jsstaticcheck.h" #include "jsutil.h" -#include "jsvector.h" #include "prmjtime.h" #include "ds/LifoAlloc.h" +#include "js/HashTable.h" +#include "js/Vector.h" #include "vm/StackSpace.h" #ifdef _MSC_VER diff --git a/js/src/jsdbgapi.cpp b/js/src/jsdbgapi.cpp index a518fffc984..7918b8e3d20 100644 --- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -49,7 +49,6 @@ #include "jsstdint.h" #include "jsutil.h" #include "jsclist.h" -#include "jshashtable.h" #include "jsapi.h" #include "jscntxt.h" #include "jsversion.h" @@ -69,6 +68,7 @@ #include "jsstr.h" #include "jswatchpoint.h" #include "jswrapper.h" + #include "vm/Debugger.h" #include "jsatominlines.h" diff --git a/js/src/jsdhash.cpp b/js/src/jsdhash.cpp index d3e3bb33cb0..c30634bb46f 100644 --- a/js/src/jsdhash.cpp +++ b/js/src/jsdhash.cpp @@ -45,7 +45,6 @@ #include #include #include "jsstdint.h" -#include "jsbit.h" #include "jsdhash.h" #include "jsutil.h" diff --git a/js/src/jsdtoa.cpp b/js/src/jsdtoa.cpp index 3031af56cf8..3157a97b397 100644 --- a/js/src/jsdtoa.cpp +++ b/js/src/jsdtoa.cpp @@ -47,7 +47,6 @@ #include "jsapi.h" #include "jsprvtd.h" #include "jsnum.h" -#include "jsbit.h" #include "jslibmath.h" #include "jscntxt.h" diff --git a/js/src/jsemit.cpp b/js/src/jsemit.cpp index 96fde81850a..c803f4939ef 100644 --- a/js/src/jsemit.cpp +++ b/js/src/jsemit.cpp @@ -49,7 +49,6 @@ #include "jstypes.h" #include "jsstdint.h" #include "jsutil.h" -#include "jsbit.h" #include "jsprf.h" #include "jsapi.h" #include "jsatom.h" @@ -7775,13 +7774,6 @@ js_FinishTakingSrcNotes(JSContext *cx, JSCodeGenerator *cg, jssrcnote *notes) memcpy(notes + prologCount, cg->main.notes, SRCNOTE_SIZE(mainCount)); SN_MAKE_TERMINATOR(¬es[totalCount]); -#ifdef DEBUG_notme - { int bin = JS_CeilingLog2(totalCount); - if (bin >= NBINS) - bin = NBINS - 1; - ++hist[bin]; - } -#endif return JS_TRUE; } diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index 9aa0418aa5b..f6c920a7fb7 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -45,7 +45,6 @@ #include #include "jstypes.h" #include "jsstdint.h" -#include "jsbit.h" #include "jsutil.h" #include "jsprf.h" #include "jsapi.h" @@ -618,8 +617,8 @@ StackTraceToString(JSContext *cx, JSExnPrivate *priv) length_ >= STACK_LENGTH_LIMIT - stacklen) { \ goto done; \ } \ - stackmax = JS_BIT(JS_CeilingLog2(stacklen + length_)); \ - ptr_ = cx->realloc_(stackbuf, (stackmax+1) * sizeof(jschar)); \ + stackmax = RoundUpPow2(stacklen + length_); \ + ptr_ = cx->realloc_(stackbuf, (stackmax+1) * sizeof(jschar)); \ if (!ptr_) \ goto bad; \ stackbuf = (jschar *) ptr_; \ diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 9c49c79cc86..d860f8b7691 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -44,7 +44,6 @@ #include #include "jstypes.h" #include "jsstdint.h" -#include "jsbit.h" #include "jsutil.h" #include "jsapi.h" #include "jsarray.h" diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index e8a38d4479c..5ed18eef8ae 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -54,7 +54,6 @@ #include "jsstdint.h" #include "jsutil.h" #include "jshash.h" -#include "jsbit.h" #include "jsclist.h" #include "jsprf.h" #include "jsapi.h" @@ -70,7 +69,6 @@ #include "jsgc.h" #include "jsgcchunk.h" #include "jsgcmark.h" -#include "jshashtable.h" #include "jsinterp.h" #include "jsiter.h" #include "jslock.h" @@ -89,13 +87,13 @@ #endif #include "methodjit/MethodJIT.h" -#include "vm/String.h" #include "vm/Debugger.h" +#include "vm/String.h" #include "jsobjinlines.h" -#include "vm/String-inl.h" #include "vm/CallObject-inl.h" +#include "vm/String-inl.h" #ifdef MOZ_VALGRIND # define JS_VALGRIND diff --git a/js/src/jsgc.h b/js/src/jsgc.h index 00ed74ecb43..a2a4c6f586c 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -45,20 +45,21 @@ */ #include +#include "jsalloc.h" #include "jstypes.h" #include "jsprvtd.h" #include "jspubtd.h" #include "jsdhash.h" -#include "jsbit.h" #include "jsgcchunk.h" -#include "jshashtable.h" #include "jslock.h" #include "jsutil.h" -#include "jsvector.h" #include "jsversion.h" #include "jsgcstats.h" #include "jscell.h" +#include "js/HashTable.h" +#include "js/Vector.h" + struct JSCompartment; extern "C" void diff --git a/js/src/jsgcinlines.h b/js/src/jsgcinlines.h index 9d93eca57c5..a2efdba9514 100644 --- a/js/src/jsgcinlines.h +++ b/js/src/jsgcinlines.h @@ -43,11 +43,11 @@ #include "jsgc.h" #include "jscntxt.h" #include "jscompartment.h" +#include "jslock.h" #include "jsscope.h" #include "jsxml.h" -#include "jslock.h" -#include "jstl.h" +#include "js/TemplateLib.h" namespace js { diff --git a/js/src/jsgcmark.h b/js/src/jsgcmark.h index 125a2409963..eeafa467032 100644 --- a/js/src/jsgcmark.h +++ b/js/src/jsgcmark.h @@ -43,9 +43,10 @@ #include "jsgc.h" #include "jscntxt.h" #include "jscompartment.h" - #include "jslock.h" -#include "jstl.h" + + +#include "js/TemplateLib.h" namespace js { namespace gc { diff --git a/js/src/jshash.cpp b/js/src/jshash.cpp index ae2a3fcc17b..d2e5d84642b 100644 --- a/js/src/jshash.cpp +++ b/js/src/jshash.cpp @@ -44,7 +44,6 @@ #include #include "jstypes.h" #include "jsstdint.h" -#include "jsbit.h" #include "jsutil.h" #include "jshash.h" @@ -107,7 +106,7 @@ JS_NewHashTable(uint32 n, JSHashFunction keyHash, if (n <= MINBUCKETS) { n = MINBUCKETSLOG2; } else { - n = JS_CeilingLog2(n); + n = JS_CEILING_LOG2W(n); if ((int32)n < 0) return NULL; } @@ -387,7 +386,7 @@ out: JS_ASSERT(ht->nentries < nlimit); nbuckets = NBUCKETS(ht); if (MINBUCKETS < nbuckets && ht->nentries < UNDERLOADED(nbuckets)) { - newlog2 = JS_CeilingLog2(ht->nentries); + newlog2 = JS_CEILING_LOG2W(ht->nentries); if (newlog2 < MINBUCKETSLOG2) newlog2 = MINBUCKETSLOG2; diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index ca122d13b28..309ac907e6b 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -39,7 +39,6 @@ #include "jsapi.h" #include "jsautooplen.h" -#include "jsbit.h" #include "jsbool.h" #include "jsdate.h" #include "jsexn.h" @@ -55,7 +54,6 @@ #include "jsscan.h" #include "jsscope.h" #include "jsstr.h" -#include "jstl.h" #include "jsiter.h" #include "methodjit/MethodJIT.h" diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h index 8336434bb3b..399e21abd91 100644 --- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -45,11 +45,10 @@ #include "jsalloc.h" #include "jscell.h" #include "jsfriendapi.h" -#include "jstl.h" #include "jsprvtd.h" -#include "jshashtable.h" #include "ds/LifoAlloc.h" +#include "js/HashTable.h" namespace js { namespace types { diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index 3284f302068..e0c949ada9a 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -73,7 +73,7 @@ #include "jsstaticcheck.h" #include "jstracer.h" #include "jslibmath.h" -#include "jsvector.h" + #ifdef JS_METHODJIT #include "methodjit/MethodJIT.h" #include "methodjit/MethodJIT-inl.h" @@ -2730,7 +2730,7 @@ BEGIN_CASE(JSOP_BINDNAME) END_CASE(JSOP_BINDNAME) BEGIN_CASE(JSOP_IMACOP) - JS_ASSERT(JS_UPTRDIFF(regs.fp()->imacropc(), script->code) < script->length); + JS_ASSERT(UnsignedPtrDiff(regs.fp()->imacropc(), script->code) < script->length); op = JSOp(*regs.fp()->imacropc()); DO_OP(); diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index 744ae062209..5ed5f102778 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -56,7 +56,6 @@ #include "jsfun.h" #include "jsgc.h" #include "jsgcmark.h" -#include "jshashtable.h" #include "jsinterp.h" #include "jsiter.h" #include "jslock.h" @@ -68,7 +67,6 @@ #include "jsscope.h" #include "jsscript.h" #include "jsstaticcheck.h" -#include "jsvector.h" #if JS_HAS_XML_SUPPORT #include "jsxml.h" diff --git a/js/src/jslock.cpp b/js/src/jslock.cpp index 831423656f7..72dc767391f 100644 --- a/js/src/jslock.cpp +++ b/js/src/jslock.cpp @@ -55,7 +55,6 @@ #include "jsutil.h" #include "jstypes.h" #include "jsstdint.h" -#include "jsbit.h" #include "jscntxt.h" #include "jsgc.h" #include "jslock.h" @@ -504,7 +503,7 @@ js_SetupLocks(int listc, int globc) if (globc > 100 || globc < 0) /* globc == number of global locks */ printf("Bad number %d in js_SetupLocks()!\n", listc); #endif - global_locks_log2 = JS_CeilingLog2(globc); + global_locks_log2 = JS_CEILING_LOG2W(globc); global_locks_mask = JS_BITMASK(global_locks_log2); global_lock_count = JS_BIT(global_locks_log2); global_locks = (PRLock **) OffTheBooks::malloc_(global_lock_count * sizeof(PRLock*)); diff --git a/js/src/jslog2.cpp b/js/src/jslog2.cpp index 5241a97a57b..39f30385686 100644 --- a/js/src/jslog2.cpp +++ b/js/src/jslog2.cpp @@ -37,7 +37,6 @@ * ***** END LICENSE BLOCK ***** */ #include "jsstdint.h" -#include "jsbit.h" #include "jsutil.h" /* @@ -55,31 +54,6 @@ JS_STATIC_ASSERT_IF(JS_BYTES_PER_WORD == 8, sizeof(unsigned long long) == sizeof(JSUword)); #endif -/* - * Compute the log of the least power of 2 greater than or equal to n - */ -JS_PUBLIC_API(JSIntn) -JS_CeilingLog2(JSUint32 n) -{ - JSIntn log2; - - JS_CEILING_LOG2(log2, n); - return log2; -} - -/* - * Compute the log of the greatest power of 2 less than or equal to n. - * This really just finds the highest set bit in the word. - */ -JS_PUBLIC_API(JSIntn) -JS_FloorLog2(JSUint32 n) -{ - JSIntn log2; - - JS_FLOOR_LOG2(log2, n); - return log2; -} - /* * js_FloorLog2wImpl has to be defined only for 64-bit non-GCC case. */ diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index 6bc17576d9a..df967962c16 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -72,7 +72,6 @@ #include "jsscope.h" #include "jsstr.h" #include "jstracer.h" -#include "jsvector.h" #include "jslibmath.h" #include "vm/GlobalObject.h" diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 86de9ac0f02..4f347290668 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -45,7 +45,6 @@ #include #include "jstypes.h" #include "jsstdint.h" -#include "jsbit.h" #include "jsutil.h" #include "jshash.h" #include "jsdhash.h" diff --git a/js/src/jsobj.h b/js/src/jsobj.h index 94fcc2e069f..d84727bc37d 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -57,7 +57,6 @@ #include "jspubtd.h" #include "jsprvtd.h" #include "jslock.h" -#include "jsvector.h" #include "jscell.h" #include "vm/String.h" diff --git a/js/src/json.cpp b/js/src/json.cpp index 575c50cfd60..594b25e2f37 100644 --- a/js/src/json.cpp +++ b/js/src/json.cpp @@ -50,6 +50,7 @@ #include "jsiter.h" #include "jsnum.h" #include "jsobj.h" +#include "json.h" #include "jsonparser.h" #include "jsprf.h" #include "jsscan.h" @@ -58,9 +59,6 @@ #include "jsstdint.h" #include "jsutil.h" #include "jsxml.h" -#include "jsvector.h" - -#include "json.h" #include "jsatominlines.h" #include "jsinferinlines.h" diff --git a/js/src/json.h b/js/src/json.h index e209fd677a0..64c36dbca0a 100644 --- a/js/src/json.h +++ b/js/src/json.h @@ -40,7 +40,8 @@ #include "jsprvtd.h" #include "jspubtd.h" -#include "jsvector.h" + +#include "js/Vector.h" #define JSON_MAX_DEPTH 2048 #define JSON_PARSER_BUFSIZE 1024 diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index 60c8d2cf1ae..2a06916c165 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -68,7 +68,6 @@ #include "jsscript.h" #include "jsstr.h" #include "jsstaticcheck.h" -#include "jsvector.h" #include "vm/Debugger.h" @@ -4100,7 +4099,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop) outer = jp->script; outerfun = jp->fun; outerLocalNames = jp->localNames; - LOCAL_ASSERT(JS_UPTRDIFF(pc, outer->code) <= outer->length); + LOCAL_ASSERT(UnsignedPtrDiff(pc, outer->code) <= outer->length); jp->script = inner; jp->fun = fun; jp->localNames = innerLocalNames; diff --git a/js/src/jsotypes.h b/js/src/jsotypes.h index bdfd0ef32ae..212c67fc8bb 100644 --- a/js/src/jsotypes.h +++ b/js/src/jsotypes.h @@ -95,9 +95,4 @@ typedef JSInt8 int8; typedef JSFloat64 float64; -/* Re: jsbit.h */ -#define TEST_BIT JS_TEST_BIT -#define SET_BIT JS_SET_BIT -#define CLEAR_BIT JS_CLEAR_BIT - #endif /* !defined(PROTYPES_H) */ diff --git a/js/src/jsparse.cpp b/js/src/jsparse.cpp index afbfdfaaab9..9845ec9d275 100644 --- a/js/src/jsparse.cpp +++ b/js/src/jsparse.cpp @@ -80,7 +80,6 @@ #include "jsstr.h" #include "jsstaticcheck.h" #include "jslibmath.h" -#include "jsvector.h" #if JS_HAS_XML_SUPPORT #include "jsxml.h" diff --git a/js/src/jsparse.h b/js/src/jsparse.h index f00f402b888..1df447d6614 100644 --- a/js/src/jsparse.h +++ b/js/src/jsparse.h @@ -1077,7 +1077,7 @@ struct JSFunctionBoxQueue { : vector(NULL), head(0), tail(0), lengthMask(0) { } bool init(uint32 count) { - lengthMask = JS_BITMASK(JS_CeilingLog2(count)); + lengthMask = JS_BITMASK(JS_CEILING_LOG2W(count)); vector = (JSFunctionBox **) js::OffTheBooks::malloc_(sizeof(JSFunctionBox) * length()); return !!vector; } diff --git a/js/src/jspropertycache.cpp b/js/src/jspropertycache.cpp index 1c2ce0cd712..0cefbcc7c1e 100644 --- a/js/src/jspropertycache.cpp +++ b/js/src/jspropertycache.cpp @@ -498,7 +498,7 @@ PropertyCache::purgeForScript(JSContext *cx, JSScript *script) JS_ASSERT(!cx->runtime->gcRunning); for (PropertyCacheEntry *entry = table; entry < table + SIZE; entry++) { - if (JS_UPTRDIFF(entry->kpc, script->code) < script->length) { + if (UnsignedPtrDiff(entry->kpc, script->code) < script->length) { entry->kpc = NULL; #ifdef DEBUG entry->kshape = entry->vcap = 0; diff --git a/js/src/jspropertytree.h b/js/src/jspropertytree.h index 586adef4104..33c36e27ae0 100644 --- a/js/src/jspropertytree.h +++ b/js/src/jspropertytree.h @@ -40,9 +40,10 @@ #ifndef jspropertytree_h___ #define jspropertytree_h___ -#include "jshashtable.h" #include "jsprvtd.h" +#include "js/HashTable.h" + namespace js { struct ShapeHasher { diff --git a/js/src/jsreflect.cpp b/js/src/jsreflect.cpp index 5e8a8ce4667..52a8b08961b 100644 --- a/js/src/jsreflect.cpp +++ b/js/src/jsreflect.cpp @@ -47,11 +47,9 @@ #include "jsobj.h" #include "jsreflect.h" #include "jscntxt.h" /* for jsparse.h */ -#include "jsbit.h" /* for jsparse.h */ #include "jsscript.h" /* for jsparse.h */ #include "jsinterp.h" /* for jsparse.h */ #include "jsparse.h" -#include "jsvector.h" #include "jsemit.h" #include "jsscan.h" #include "jsprf.h" diff --git a/js/src/jsscan.cpp b/js/src/jsscan.cpp index 19c2783cb17..2ce4ac84005 100644 --- a/js/src/jsscan.cpp +++ b/js/src/jsscan.cpp @@ -54,7 +54,6 @@ #include #include "jstypes.h" #include "jsstdint.h" -#include "jsbit.h" #include "jsutil.h" #include "jsprf.h" #include "jsapi.h" @@ -69,7 +68,6 @@ #include "jsscan.h" #include "jsscript.h" #include "jsstaticcheck.h" -#include "jsvector.h" #include "vm/RegExpObject.h" diff --git a/js/src/jsscan.h b/js/src/jsscan.h index ddf32e8cca4..c9d87a0829c 100644 --- a/js/src/jsscan.h +++ b/js/src/jsscan.h @@ -51,7 +51,8 @@ #include "jsopcode.h" #include "jsprvtd.h" #include "jspubtd.h" -#include "jsvector.h" + +#include "js/Vector.h" #define JS_KEYWORD(keyword, type, op, version) \ extern const char js_##keyword##_str[]; diff --git a/js/src/jsscope.cpp b/js/src/jsscope.cpp index d8fdfcec992..9658841e337 100644 --- a/js/src/jsscope.cpp +++ b/js/src/jsscope.cpp @@ -46,7 +46,6 @@ #include #include "jstypes.h" #include "jsstdint.h" -#include "jsbit.h" #include "jsclist.h" #include "jsdhash.h" #include "jsutil.h" @@ -141,7 +140,7 @@ PropertyTable::init(JSRuntime *rt, Shape *lastProp) * event, let's try to grow, overallocating to hold at least twice the * current population. */ - uint32 sizeLog2 = JS_CeilingLog2(2 * entryCount); + uint32 sizeLog2 = JS_CEILING_LOG2W(2 * entryCount); if (sizeLog2 < MIN_SIZE_LOG2) sizeLog2 = MIN_SIZE_LOG2; diff --git a/js/src/jsscope.h b/js/src/jsscope.h index 8de61b97eb9..2873be3863e 100644 --- a/js/src/jsscope.h +++ b/js/src/jsscope.h @@ -52,12 +52,13 @@ #include "jscntxt.h" #include "jscompartment.h" -#include "jshashtable.h" #include "jsobj.h" #include "jsprvtd.h" #include "jspubtd.h" #include "jspropertytree.h" +#include "js/HashTable.h" + #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4800) diff --git a/js/src/jsstaticcheck.h b/js/src/jsstaticcheck.h index c605d2f0848..1e1d24fe91a 100644 --- a/js/src/jsstaticcheck.h +++ b/js/src/jsstaticcheck.h @@ -40,86 +40,4 @@ #ifndef jsstaticcheck_h___ #define jsstaticcheck_h___ -#ifdef NS_STATIC_CHECKING -/* - * Trigger a control flow check to make sure that code flows through label - */ -inline __attribute__ ((unused)) void MUST_FLOW_THROUGH(const char *label) { -} - -/* avoid unused goto-label warnings */ -#define MUST_FLOW_LABEL(label) goto label; label: - -inline JS_FORCES_STACK void VOUCH_DOES_NOT_REQUIRE_STACK() {} - -inline JS_FORCES_STACK void -JS_ASSERT_NOT_ON_TRACE(JSContext *cx) -{ - JS_ASSERT(!JS_ON_TRACE(cx)); -} - -#else -#define MUST_FLOW_THROUGH(label) ((void) 0) -#define MUST_FLOW_LABEL(label) -#define VOUCH_DOES_NOT_REQUIRE_STACK() ((void) 0) -#define JS_ASSERT_NOT_ON_TRACE(cx) JS_ASSERT(!JS_ON_TRACE(cx)) -#endif -#define VOUCH_HAVE_STACK VOUCH_DOES_NOT_REQUIRE_STACK - -/* sixgill annotation defines */ - -/* Avoid name collision if included with other headers defining annotations. */ -#ifndef HAVE_STATIC_ANNOTATIONS -#define HAVE_STATIC_ANNOTATIONS - -#ifdef XGILL_PLUGIN - -#define STATIC_PRECONDITION(COND) __attribute__((precondition(#COND))) -#define STATIC_PRECONDITION_ASSUME(COND) __attribute__((precondition_assume(#COND))) -#define STATIC_POSTCONDITION(COND) __attribute__((postcondition(#COND))) -#define STATIC_POSTCONDITION_ASSUME(COND) __attribute__((postcondition_assume(#COND))) -#define STATIC_INVARIANT(COND) __attribute__((invariant(#COND))) -#define STATIC_INVARIANT_ASSUME(COND) __attribute__((invariant_assume(#COND))) - -/* Used to make identifiers for assert/assume annotations in a function. */ -#define STATIC_PASTE2(X,Y) X ## Y -#define STATIC_PASTE1(X,Y) STATIC_PASTE2(X,Y) - -#define STATIC_ASSERT(COND) \ - JS_BEGIN_MACRO \ - __attribute__((assert_static(#COND), unused)) \ - int STATIC_PASTE1(assert_static_, __COUNTER__); \ - JS_END_MACRO - -#define STATIC_ASSUME(COND) \ - JS_BEGIN_MACRO \ - __attribute__((assume_static(#COND), unused)) \ - int STATIC_PASTE1(assume_static_, __COUNTER__); \ - JS_END_MACRO - -#define STATIC_ASSERT_RUNTIME(COND) \ - JS_BEGIN_MACRO \ - __attribute__((assert_static_runtime(#COND), unused)) \ - int STATIC_PASTE1(assert_static_runtime_, __COUNTER__); \ - JS_END_MACRO - -#else /* XGILL_PLUGIN */ - -#define STATIC_PRECONDITION(COND) /* nothing */ -#define STATIC_PRECONDITION_ASSUME(COND) /* nothing */ -#define STATIC_POSTCONDITION(COND) /* nothing */ -#define STATIC_POSTCONDITION_ASSUME(COND) /* nothing */ -#define STATIC_INVARIANT(COND) /* nothing */ -#define STATIC_INVARIANT_ASSUME(COND) /* nothing */ - -#define STATIC_ASSERT(COND) JS_BEGIN_MACRO /* nothing */ JS_END_MACRO -#define STATIC_ASSUME(COND) JS_BEGIN_MACRO /* nothing */ JS_END_MACRO -#define STATIC_ASSERT_RUNTIME(COND) JS_BEGIN_MACRO /* nothing */ JS_END_MACRO - -#endif /* XGILL_PLUGIN */ - -#define STATIC_SKIP_INFERENCE STATIC_INVARIANT(skip_inference()) - -#endif /* HAVE_STATIC_ANNOTATIONS */ - #endif /* jsstaticcheck_h___ */ diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 7c6f58d9806..ef1f354ffa9 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -71,8 +71,6 @@ #include "jsscope.h" #include "jsstaticcheck.h" #include "jsstr.h" -#include "jsbit.h" -#include "jsvector.h" #include "jsversion.h" #include "vm/GlobalObject.h" diff --git a/js/src/jsstr.h b/js/src/jsstr.h index 03eb57b6334..be76219c0bb 100644 --- a/js/src/jsstr.h +++ b/js/src/jsstr.h @@ -44,10 +44,10 @@ #include "jsapi.h" #include "jsatom.h" #include "jsprvtd.h" -#include "jshashtable.h" #include "jslock.h" #include "jscell.h" +#include "js/HashTable.h" #include "vm/Unicode.h" namespace js { diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp index 4497898de85..b48d4531d29 100644 --- a/js/src/jstracer.cpp +++ b/js/src/jstracer.cpp @@ -40,7 +40,6 @@ * ***** END LICENSE BLOCK ***** */ #include "jsstdint.h" -#include "jsbit.h" // low-level (NSPR-based) headers next #include "jsprf.h" #include // standard headers next @@ -75,7 +74,6 @@ #include "jsscope.h" #include "jsscript.h" #include "jsstaticcheck.h" -#include "jstl.h" #include "jstracer.h" #include "jsxml.h" #include "jstypedarray.h" @@ -7939,10 +7937,10 @@ PurgeScriptFragments(TraceMonitor* tm, JSScript* script) /* A recorder script is being evaluated and can not be destroyed or GC-ed. */ JS_ASSERT_IF(tm->recorder, - JS_UPTRDIFF(tm->recorder->getTree()->ip, script->code) >= script->length); + UnsignedPtrDiff(tm->recorder->getTree()->ip, script->code) >= script->length); for (LoopProfileMap::Enum e(*tm->loopProfiles); !e.empty(); e.popFront()) { - if (JS_UPTRDIFF(e.front().key, script->code) < script->length) + if (UnsignedPtrDiff(e.front().key, script->code) < script->length) e.removeFront(); } @@ -7954,7 +7952,7 @@ PurgeScriptFragments(TraceMonitor* tm, JSScript* script) for (size_t i = 0; i < FRAGMENT_TABLE_SIZE; ++i) { TreeFragment** fragp = &tm->vmfragments[i]; while (TreeFragment* frag = *fragp) { - if (JS_UPTRDIFF(frag->ip, script->code) < script->length) { + if (UnsignedPtrDiff(frag->ip, script->code) < script->length) { /* This fragment is associated with the script. */ debug_only_printf(LC_TMTracer, "Disconnecting TreeFragment %p " @@ -7976,7 +7974,7 @@ PurgeScriptFragments(TraceMonitor* tm, JSScript* script) RecordAttemptMap &table = *tm->recordAttempts; for (RecordAttemptMap::Enum e(table); !e.empty(); e.popFront()) { - if (JS_UPTRDIFF(e.front().key, script->code) < script->length) + if (UnsignedPtrDiff(e.front().key, script->code) < script->length) e.removeFront(); } } diff --git a/js/src/jstracer.h b/js/src/jstracer.h index 9c254f092a9..46b102843f7 100644 --- a/js/src/jstracer.h +++ b/js/src/jstracer.h @@ -51,7 +51,6 @@ #include "jsinterp.h" #include "jslock.h" #include "jsnum.h" -#include "jsvector.h" #include "jscompartment.h" #include "Writer.h" diff --git a/js/src/jstypedarray.cpp b/js/src/jstypedarray.cpp index dc3d438e590..0d7b1da7cd9 100644 --- a/js/src/jstypedarray.cpp +++ b/js/src/jstypedarray.cpp @@ -58,8 +58,6 @@ #include "jsnum.h" #include "jsobj.h" #include "jsstaticcheck.h" -#include "jsbit.h" -#include "jsvector.h" #include "jstypedarray.h" #include "jsutil.h" diff --git a/js/src/jsutil.cpp b/js/src/jsutil.cpp index 35a4c8463f6..414c8b62c10 100644 --- a/js/src/jsutil.cpp +++ b/js/src/jsutil.cpp @@ -108,7 +108,6 @@ JS_PUBLIC_API(void) JS_Assert(const char *s, const char *file, JSIntn ln) #include #include #include "jscompat.h" -#include "jsbit.h" /* * Histogram bins count occurrences of values <= the bin label, as follows: @@ -142,7 +141,7 @@ ValToBin(uintN logscale, uint32 val) bin = (logscale == 10) ? (uintN) ceil(log10((double) val)) : (logscale == 2) - ? (uintN) JS_CeilingLog2(val) + ? (uintN) JS_CEILING_LOG2W(val) : val; return JS_MIN(bin, 10); } @@ -243,7 +242,7 @@ JS_DumpHistogram(JSBasicStats *bs, FILE *fp) if (max > 1e6 && mean > 1e3) cnt = (uint32) ceil(log10((double) cnt)); else if (max > 16 && mean > 8) - cnt = JS_CeilingLog2(cnt); + cnt = JS_CEILING_LOG2W(cnt); for (uintN i = 0; i < cnt; i++) putc('*', fp); } @@ -252,147 +251,3 @@ JS_DumpHistogram(JSBasicStats *bs, FILE *fp) } #endif /* JS_BASIC_STATS */ - -#if defined(DEBUG_notme) && defined(XP_UNIX) - -#define __USE_GNU 1 -#include -#include -#include "jshash.h" -#include "jsprf.h" - -JSCallsite js_calltree_root = {0, NULL, NULL, 0, NULL, NULL, NULL, NULL}; - -static JSCallsite * -CallTree(void **bp) -{ - void **bpup, **bpdown, *pc; - JSCallsite *parent, *site, **csp; - Dl_info info; - int ok, offset; - const char *symbol; - char *method; - - /* Reverse the stack frame list to avoid recursion. */ - bpup = NULL; - for (;;) { - bpdown = (void**) bp[0]; - bp[0] = (void*) bpup; - if ((void**) bpdown[0] < bpdown) - break; - bpup = bp; - bp = bpdown; - } - - /* Reverse the stack again, finding and building a path in the tree. */ - parent = &js_calltree_root; - do { - bpup = (void**) bp[0]; - bp[0] = (void*) bpdown; - pc = bp[1]; - - csp = &parent->kids; - while ((site = *csp) != NULL) { - if (site->pc == (uint32)pc) { - /* Put the most recently used site at the front of siblings. */ - *csp = site->siblings; - site->siblings = parent->kids; - parent->kids = site; - - /* Site already built -- go up the stack. */ - goto upward; - } - csp = &site->siblings; - } - - /* Check for recursion: see if pc is on our ancestor line. */ - for (site = parent; site; site = site->parent) { - if (site->pc == (uint32)pc) - goto upward; - } - - /* - * Not in tree at all: let's find our symbolic callsite info. - * XXX static syms are masked by nearest lower global - */ - info.dli_fname = info.dli_sname = NULL; - ok = dladdr(pc, &info); - if (ok < 0) { - fprintf(stderr, "dladdr failed!\n"); - return NULL; - } - -/* XXXbe sub 0x08040000? or something, see dbaron bug with tenthumbs comment */ - symbol = info.dli_sname; - offset = (char*)pc - (char*)info.dli_fbase; - method = symbol - ? strdup(symbol) - : JS_smprintf("%s+%X", - info.dli_fname ? info.dli_fname : "main", - offset); - if (!method) - return NULL; - - /* Create a new callsite record. */ - site = (JSCallsite *) OffTheBooks::malloc(sizeof(JSCallsite)); - if (!site) - return NULL; - - /* Insert the new site into the tree. */ - site->pc = (uint32)pc; - site->name = method; - site->library = info.dli_fname; - site->offset = offset; - site->parent = parent; - site->siblings = parent->kids; - parent->kids = site; - site->kids = NULL; - - upward: - parent = site; - bpdown = bp; - bp = bpup; - } while (bp); - - return site; -} - -JS_FRIEND_API(JSCallsite *) -JS_Backtrace(int skip) -{ - void **bp, **bpdown; - - /* Stack walking code adapted from Kipp's "leaky". */ -#if defined(__i386) - __asm__( "movl %%ebp, %0" : "=g"(bp)); -#elif defined(__x86_64__) - __asm__( "movq %%rbp, %0" : "=g"(bp)); -#else - /* - * It would be nice if this worked uniformly, but at least on i386 and - * x86_64, it stopped working with gcc 4.1, because it points to the - * end of the saved registers instead of the start. - */ - bp = (void**) __builtin_frame_address(0); -#endif - while (--skip >= 0) { - bpdown = (void**) *bp++; - if (bpdown < bp) - break; - bp = bpdown; - } - - return CallTree(bp); -} - -JS_FRIEND_API(void) -JS_DumpBacktrace(JSCallsite *trace) -{ - while (trace) { - fprintf(stdout, "%s [%s +0x%X]\n", trace->name, trace->library, - trace->offset); - trace = trace->parent; - } -} - -#endif /* defined(DEBUG_notme) && defined(XP_UNIX) */ diff --git a/js/src/jsutil.h b/js/src/jsutil.h index 49c6637b59b..e5297f2c18d 100644 --- a/js/src/jsutil.h +++ b/js/src/jsutil.h @@ -44,616 +44,232 @@ #ifndef jsutil_h___ #define jsutil_h___ -#include "jstypes.h" -#include "mozilla/Util.h" -#include -#include +#include "jsstaticcheck.h" + +#include "js/Utility.h" + +/* Forward declarations. */ +struct JSContext; #ifdef __cplusplus - -/* The public JS engine namespace. */ -namespace JS {} - -/* The mozilla-shared reusable template/utility namespace. */ -namespace mozilla {} - -/* The private JS engine namespace. */ namespace js { -/* The private namespace is a superset of the public/shared namespaces. */ -using namespace JS; -using namespace mozilla; - -} /* namespace js */ - -#endif /* defined __cplusplus */ - -JS_BEGIN_EXTERN_C - -#define JS_UPTRDIFF(a_, b_) (uintptr_t(a_) - uintptr_t(b_)) - -#define JS_CRASH_UNLESS(__cond) \ - JS_BEGIN_MACRO \ - if (!(__cond)) { \ - *(int *)(uintptr_t)0xccadbeef = 0; \ - ((void(*)())0)(); /* More reliable, but doesn't say CCADBEEF */ \ - } \ - JS_END_MACRO - -#define JS_FREE_PATTERN 0xDA - -#ifdef DEBUG -#define JS_CRASH_DIAGNOSTICS 1 -#endif - -#ifdef JS_CRASH_DIAGNOSTICS - -#define JS_POISON(p, val, size) memset((p), (val), (size)) - -#define JS_OPT_ASSERT(expr) \ - ((expr) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__)) - -#define JS_OPT_ASSERT_IF(cond, expr) \ - ((!(cond) || (expr)) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__)) - -#else - -#define JS_POISON(p, val, size) ((void) 0) -#define JS_OPT_ASSERT(expr) ((void) 0) -#define JS_OPT_ASSERT_IF(cond, expr) ((void) 0) - -#endif /* JS_CRASH_DIAGNOSTICS */ - -#ifdef DEBUG - -#define JS_ASSERT(expr) \ - ((expr) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__)) - -#define JS_ASSERT_IF(cond, expr) \ - ((!(cond) || (expr)) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__)) - -#define JS_NOT_REACHED(reason) \ - JS_Assert(reason, __FILE__, __LINE__) - -#define JS_ALWAYS_TRUE(expr) JS_ASSERT(expr) - -#define JS_ALWAYS_FALSE(expr) JS_ASSERT(!(expr)) - -# ifdef JS_THREADSAFE -# define JS_THREADSAFE_ASSERT(expr) JS_ASSERT(expr) -# else -# define JS_THREADSAFE_ASSERT(expr) ((void) 0) -# endif - -#else - -#define JS_ASSERT(expr) ((void) 0) -#define JS_ASSERT_IF(cond,expr) ((void) 0) -#define JS_NOT_REACHED(reason) -#define JS_ALWAYS_TRUE(expr) ((void) (expr)) -#define JS_ALWAYS_FALSE(expr) ((void) (expr)) -#define JS_THREADSAFE_ASSERT(expr) ((void) 0) - -#endif /* defined(DEBUG) */ - -/* - * Compile-time assert. "cond" must be a constant expression. - * The macro can be used only in places where an "extern" declaration is - * allowed. - */ - -#ifdef __SUNPRO_CC -/* - * Sun Studio C++ compiler has a bug - * "sizeof expression not accepted as size of array parameter" - * It happens when js_static_assert() function is declared inside functions. - * The bug number is 6688515. It is not public yet. - * Therefore, for Sun Studio, declare js_static_assert as an array instead. - */ -#define JS_STATIC_ASSERT(cond) extern char js_static_assert[(cond) ? 1 : -1] -#else -#ifdef __COUNTER__ - #define JS_STATIC_ASSERT_GLUE1(x,y) x##y - #define JS_STATIC_ASSERT_GLUE(x,y) JS_STATIC_ASSERT_GLUE1(x,y) - #define JS_STATIC_ASSERT(cond) \ - typedef int JS_STATIC_ASSERT_GLUE(js_static_assert, __COUNTER__)[(cond) ? 1 : -1] -#else - #define JS_STATIC_ASSERT(cond) extern void js_static_assert(int arg[(cond) ? 1 : -1]) -#endif -#endif - -#define JS_STATIC_ASSERT_IF(cond, expr) JS_STATIC_ASSERT(!(cond) || (expr)) - -/* - * Abort the process in a non-graceful manner. This will cause a core file, - * call to the debugger or other moral equivalent as well as causing the - * entire process to stop. - */ -extern JS_PUBLIC_API(void) JS_Abort(void); - -#ifdef DEBUG -# define JS_BASIC_STATS 1 -#endif - -#ifdef JS_BASIC_STATS - -#include - -typedef struct JSBasicStats { - uint32 num; - uint32 max; - double sum; - double sqsum; - uint32 logscale; /* logarithmic scale: 0 (linear), 2, 10 */ - uint32 hist[11]; -} JSBasicStats; - -#define JS_INIT_STATIC_BASIC_STATS {0,0,0,0,0,{0,0,0,0,0,0,0,0,0,0,0}} -#define JS_BASIC_STATS_INIT(bs) memset((bs), 0, sizeof(JSBasicStats)) - -#define JS_BASIC_STATS_ACCUM(bs,val) \ - JS_BasicStatsAccum(bs, val) - -#define JS_MeanAndStdDevBS(bs,sigma) \ - JS_MeanAndStdDev((bs)->num, (bs)->sum, (bs)->sqsum, sigma) - -extern void -JS_BasicStatsAccum(JSBasicStats *bs, uint32 val); - -extern double -JS_MeanAndStdDev(uint32 num, double sum, double sqsum, double *sigma); - -extern void -JS_DumpBasicStats(JSBasicStats *bs, const char *title, FILE *fp); - -extern void -JS_DumpHistogram(JSBasicStats *bs, FILE *fp); - -#else - -#define JS_BASIC_STATS_ACCUM(bs,val) /* nothing */ - -#endif /* JS_BASIC_STATS */ - - -#if defined(DEBUG_notme) && defined(XP_UNIX) - -typedef struct JSCallsite JSCallsite; - -struct JSCallsite { - uint32 pc; - char *name; - const char *library; - int offset; - JSCallsite *parent; - JSCallsite *siblings; - JSCallsite *kids; - void *handy; -}; - -extern JS_FRIEND_API(JSCallsite *) -JS_Backtrace(int skip); - -extern JS_FRIEND_API(void) -JS_DumpBacktrace(JSCallsite *trace); -#endif - -#if defined JS_USE_CUSTOM_ALLOCATOR - -#include "jscustomallocator.h" - -#else - -#ifdef DEBUG -/* - * In order to test OOM conditions, when the shell command-line option - * |-A NUM| is passed, we fail continuously after the NUM'th allocation. - */ -extern JS_PUBLIC_DATA(JSUint32) OOM_maxAllocations; /* set from shell/js.cpp */ -extern JS_PUBLIC_DATA(JSUint32) OOM_counter; /* data race, who cares. */ -#define JS_OOM_POSSIBLY_FAIL() \ - do \ - { \ - if (OOM_counter++ >= OOM_maxAllocations) { \ - return NULL; \ - } \ - } while (0) - -#else -#define JS_OOM_POSSIBLY_FAIL() do {} while(0) -#endif - -/* - * SpiderMonkey code should not be calling these allocation functions directly. - * Instead, all calls should go through JSRuntime, JSContext or OffTheBooks. - * However, js_free() can be called directly. - */ -static JS_INLINE void* js_malloc(size_t bytes) { - JS_OOM_POSSIBLY_FAIL(); - return malloc(bytes); -} - -static JS_INLINE void* js_calloc(size_t bytes) { - JS_OOM_POSSIBLY_FAIL(); - return calloc(bytes, 1); -} - -static JS_INLINE void* js_realloc(void* p, size_t bytes) { - JS_OOM_POSSIBLY_FAIL(); - return realloc(p, bytes); -} - -static JS_INLINE void js_free(void* p) { - free(p); -} -#endif/* JS_USE_CUSTOM_ALLOCATOR */ - -/* - * This signature is for malloc_usable_size-like functions used to measure - * memory usage. A return value of zero indicates that the size is unknown, - * and so a fall-back computation should be done for the size. - */ -typedef size_t(*JSUsableSizeFun)(void *p); - -JS_END_EXTERN_C - - - -#ifdef __cplusplus - -/* - * User guide to memory management within SpiderMonkey: - * - * Quick tips: - * - * Allocation: - * - Prefer to allocate using JSContext: - * cx->{malloc_,realloc_,calloc_,new_,array_new} - * - * - If no JSContext is available, use a JSRuntime: - * rt->{malloc_,realloc_,calloc_,new_,array_new} - * - * - As a last resort, use unaccounted allocation ("OffTheBooks"): - * js::OffTheBooks::{malloc_,realloc_,calloc_,new_,array_new} - * - * Deallocation: - * - When the deallocation occurs on a slow path, use: - * Foreground::{free_,delete_,array_delete} - * - * - Otherwise deallocate on a background thread using a JSContext: - * cx->{free_,delete_,array_delete} - * - * - If no JSContext is available, use a JSRuntime: - * rt->{free_,delete_,array_delete} - * - * - As a last resort, use UnwantedForeground deallocation: - * js::UnwantedForeground::{free_,delete_,array_delete} - * - * General tips: - * - * - Mixing and matching these allocators is allowed (you may free memory - * allocated by any allocator, with any deallocator). - * - * - Never, ever use normal C/C++ memory management: - * malloc, free, new, new[], delete, operator new, etc. - * - * - Never, ever use low-level SpiderMonkey allocators: - * js_malloc(), js_free(), js_calloc(), js_realloc() - * Their use is reserved for the other memory managers. - * - * - Classes which have private constructors or destructors should have - * JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR added to their - * declaration. - * - * Details: - * - * Using vanilla new/new[] is unsafe in SpiderMonkey because they throw on - * failure instead of returning NULL, which is what SpiderMonkey expects. - * (Even overriding them is unsafe, as the system's C++ runtime library may - * throw, which we do not support. We also can't just use the 'nothrow' - * variant of new/new[], because we want to mediate *all* allocations - * within SpiderMonkey, to satisfy any embedders using - * JS_USE_CUSTOM_ALLOCATOR.) - * - * JSContexts and JSRuntimes keep track of memory allocated, and use this - * accounting to schedule GC. OffTheBooks does not. We'd like to remove - * OffTheBooks allocations as much as possible (bug 636558). - * - * On allocation failure, a JSContext correctly reports an error, which a - * JSRuntime and OffTheBooks does not. - * - * A JSContext deallocates in a background thread. A JSRuntime might - * deallocate in the background in the future, but does not now. Foreground - * deallocation is preferable on slow paths. UnwantedForeground deallocations - * occur where we have no JSContext or JSRuntime, and the deallocation is not - * on a slow path. We want to remove UnwantedForeground deallocations (bug - * 636561). - * - * JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR makes the allocation - * classes friends with your class, giving them access to private - * constructors and destructors. - * - * |make check| does a source level check on the number of uses OffTheBooks, - * UnwantedForeground, js_malloc, js_free etc, to prevent regressions. If you - * really must add one, update Makefile.in, and run |make check|. - * - * |make check| also statically prevents the use of vanilla new/new[]. - */ - -#define JS_NEW_BODY(allocator, t, parms) \ - void *memory = allocator(sizeof(t)); \ - return memory ? new(memory) t parms : NULL; - -/* - * Given a class which should provide new_() methods, add - * JS_DECLARE_NEW_METHODS (see JSContext for a usage example). This - * adds new_()s with up to 12 parameters. Add more versions of new_ below if - * you need more than 12 parameters. - * - * Note: Do not add a ; at the end of a use of JS_DECLARE_NEW_METHODS, - * or the build will break. - */ -#define JS_DECLARE_NEW_METHODS(ALLOCATOR, QUALIFIERS)\ - template \ - QUALIFIERS T *new_() {\ - JS_NEW_BODY(ALLOCATOR, T, ())\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11))\ - }\ -\ - template \ - QUALIFIERS T *new_(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11, P12 p12) {\ - JS_NEW_BODY(ALLOCATOR, T, (p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12))\ - }\ - static const int JSMinAlignment = 8;\ - template \ - QUALIFIERS T *array_new(size_t n) {\ - /* The length is stored just before the vector memory. */\ - uint64 numBytes64 = uint64(JSMinAlignment) + uint64(sizeof(T)) * uint64(n);\ - size_t numBytes = size_t(numBytes64);\ - if (numBytes64 != numBytes) {\ - JS_ASSERT(0); /* we want to know if this happens in debug builds */\ - return NULL;\ - }\ - void *memory = ALLOCATOR(numBytes);\ - if (!memory)\ - return NULL;\ - *(size_t *)memory = n;\ - memory = (void*)(uintptr_t(memory) + JSMinAlignment);\ - return new(memory) T[n];\ - }\ - - -#define JS_DECLARE_DELETE_METHODS(DEALLOCATOR, QUALIFIERS)\ - template \ - QUALIFIERS void delete_(T *p) {\ - if (p) {\ - p->~T();\ - DEALLOCATOR(p);\ - }\ - }\ -\ - template \ - QUALIFIERS void array_delete(T *p) {\ - if (p) {\ - void* p0 = (void *)(uintptr_t(p) - js::OffTheBooks::JSMinAlignment);\ - size_t n = *(size_t *)p0;\ - for (size_t i = 0; i < n; i++)\ - (p + i)->~T();\ - DEALLOCATOR(p0);\ - }\ - } - - -/* - * In general, all allocations should go through a JSContext or JSRuntime, so - * that the garbage collector knows how much memory has been allocated. In - * cases where it is difficult to use a JSContext or JSRuntime, OffTheBooks can - * be used, though this is undesirable. - */ -namespace js { - -class OffTheBooks { -public: - JS_DECLARE_NEW_METHODS(::js_malloc, JS_ALWAYS_INLINE static) - - static JS_INLINE void* malloc_(size_t bytes) { - return ::js_malloc(bytes); - } - - static JS_INLINE void* calloc_(size_t bytes) { - return ::js_calloc(bytes); - } - - static JS_INLINE void* realloc_(void* p, size_t bytes) { - return ::js_realloc(p, bytes); - } -}; - -/* - * We generally prefer deallocating using JSContext because it can happen in - * the background. On slow paths, we may prefer foreground allocation. - */ -class Foreground { -public: - /* See parentheses comment above. */ - static JS_ALWAYS_INLINE void free_(void* p) { - ::js_free(p); - } - - JS_DECLARE_DELETE_METHODS(::js_free, JS_ALWAYS_INLINE static) -}; - -class UnwantedForeground : public Foreground { -}; - -} /* namespace js */ - -/* - * Note lack of ; in JSRuntime below. This is intentional so "calling" this - * looks "normal". - */ -#define JS_DECLARE_ALLOCATION_FRIENDS_FOR_PRIVATE_CONSTRUCTOR \ - friend class js::OffTheBooks;\ - friend class js::Foreground;\ - friend class js::UnwantedForeground;\ - friend struct ::JSContext;\ - friend struct ::JSRuntime - - -/** - * The following classes are designed to cause assertions to detect - * inadvertent use of guard objects as temporaries. In other words, - * when we have a guard object whose only purpose is its constructor and - * destructor (and is never otherwise referenced), the intended use - * might be: - * JSAutoTempValueRooter tvr(cx, 1, &val); - * but is is easy to accidentally write: - * JSAutoTempValueRooter(cx, 1, &val); - * which compiles just fine, but runs the destructor well before the - * intended time. - * - * They work by adding (#ifdef DEBUG) an additional parameter to the - * guard object's constructor, with a default value, so that users of - * the guard object's API do not need to do anything. The default value - * of this parameter is a temporary object. C++ (ISO/IEC 14882:1998), - * section 12.2 [class.temporary], clauses 4 and 5 seem to assume a - * guarantee that temporaries are destroyed in the reverse of their - * construction order, but I actually can't find a statement that that - * is true in the general case (beyond the two specific cases mentioned - * there). However, it seems to be true. - * - * These classes are intended to be used only via the macros immediately - * below them: - * JS_DECL_USE_GUARD_OBJECT_NOTIFIER declares (ifdef DEBUG) a member - * variable, and should be put where a declaration of a private - * member variable would be placed. - * JS_GUARD_OBJECT_NOTIFIER_PARAM should be placed at the end of the - * parameters to each constructor of the guard object; it declares - * (ifdef DEBUG) an additional parameter. - * JS_GUARD_OBJECT_NOTIFIER_INIT is a statement that belongs in each - * constructor. It uses the parameter declared by - * JS_GUARD_OBJECT_NOTIFIER_PARAM. - */ -#ifdef DEBUG -class JS_FRIEND_API(JSGuardObjectNotifier) +template +class AlignedPtrAndFlag { -private: - bool* mStatementDone; -public: - JSGuardObjectNotifier() : mStatementDone(NULL) {} + uintptr_t bits; - ~JSGuardObjectNotifier() { - *mStatementDone = true; + public: + AlignedPtrAndFlag(T *t, bool flag) { + JS_ASSERT((uintptr_t(t) & 1) == 0); + bits = uintptr_t(t) | uintptr_t(flag); } - void setStatementDone(bool *aStatementDone) { - mStatementDone = aStatementDone; + T *ptr() const { + return (T *)(bits & ~uintptr_t(1)); + } + + bool flag() const { + return (bits & 1) != 0; + } + + void setPtr(T *t) { + JS_ASSERT((uintptr_t(t) & 1) == 0); + bits = uintptr_t(t) | uintptr_t(flag()); + } + + void setFlag() { + bits |= 1; + } + + void unsetFlag() { + bits &= ~uintptr_t(1); + } + + void set(T *t, bool flag) { + JS_ASSERT((uintptr_t(t) & 1) == 0); + bits = uintptr_t(t) | flag; } }; -class JS_FRIEND_API(JSGuardObjectNotificationReceiver) +template +static inline void +Reverse(T *beg, T *end) { -private: - bool mStatementDone; -public: - JSGuardObjectNotificationReceiver() : mStatementDone(false) {} + while (beg != end) { + if (--end == beg) + return; + T tmp = *beg; + *beg = *end; + *end = tmp; + ++beg; + } +} - ~JSGuardObjectNotificationReceiver() { - /* - * Assert that the guard object was not used as a temporary. - * (Note that this assert might also fire if Init is not called - * because the guard object's implementation is not using the - * above macros correctly.) - */ - JS_ASSERT(mStatementDone); +template +static inline T * +Find(T *beg, T *end, const T &v) +{ + for (T *p = beg; p != end; ++p) { + if (*p == v) + return p; + } + return end; +} + +template +static inline typename Container::ElementType * +Find(Container &c, const typename Container::ElementType &v) +{ + return Find(c.begin(), c.end(), v); +} + +template +void +ForEach(InputIterT begin, InputIterT end, CallableT f) +{ + for (; begin != end; ++begin) + f(*begin); +} + +template +static inline T +Min(T t1, T t2) +{ + return t1 < t2 ? t1 : t2; +} + +template +static inline T +Max(T t1, T t2) +{ + return t1 > t2 ? t1 : t2; +} + +/* Allows a const variable to be initialized after its declaration. */ +template +static T& +InitConst(const T &t) +{ + return const_cast(t); +} + +template +JS_ALWAYS_INLINE T & +ImplicitCast(U &u) +{ + T &t = u; + return t; +} + +template +class AutoScopedAssign +{ + private: + JS_DECL_USE_GUARD_OBJECT_NOTIFIER + T *addr; + T old; + + public: + AutoScopedAssign(T *addr, const T &value JS_GUARD_OBJECT_NOTIFIER_PARAM) + : addr(addr), old(*addr) + { + JS_GUARD_OBJECT_NOTIFIER_INIT; + *addr = value; } - void Init(const JSGuardObjectNotifier &aNotifier) { - /* - * aNotifier is passed as a const reference so that we can pass a - * temporary, but we really intend it as non-const - */ - const_cast(aNotifier). - setStatementDone(&mStatementDone); - } + ~AutoScopedAssign() { *addr = old; } }; -#define JS_DECL_USE_GUARD_OBJECT_NOTIFIER \ - JSGuardObjectNotificationReceiver _mCheckNotUsedAsTemporary; -#define JS_GUARD_OBJECT_NOTIFIER_PARAM \ - , const JSGuardObjectNotifier& _notifier = JSGuardObjectNotifier() -#define JS_GUARD_OBJECT_NOTIFIER_PARAM_NO_INIT \ - , const JSGuardObjectNotifier& _notifier -#define JS_GUARD_OBJECT_NOTIFIER_PARAM0 \ - const JSGuardObjectNotifier& _notifier = JSGuardObjectNotifier() -#define JS_GUARD_OBJECT_NOTIFIER_INIT \ - JS_BEGIN_MACRO _mCheckNotUsedAsTemporary.Init(_notifier); JS_END_MACRO +template +class AlreadyIncRefed +{ + typedef RefCountable *****ConvertibleToBool; -#else /* defined(DEBUG) */ + RefCountable *obj; -#define JS_DECL_USE_GUARD_OBJECT_NOTIFIER -#define JS_GUARD_OBJECT_NOTIFIER_PARAM -#define JS_GUARD_OBJECT_NOTIFIER_PARAM_NO_INIT -#define JS_GUARD_OBJECT_NOTIFIER_PARAM0 -#define JS_GUARD_OBJECT_NOTIFIER_INIT JS_BEGIN_MACRO JS_END_MACRO + public: + explicit AlreadyIncRefed(RefCountable *obj) : obj(obj) {} -#endif /* !defined(DEBUG) */ + bool null() const { return obj == NULL; } + operator ConvertibleToBool() const { return (ConvertibleToBool)obj; } -namespace js { + RefCountable *operator->() const { JS_ASSERT(!null()); return obj; } + RefCountable &operator*() const { JS_ASSERT(!null()); return *obj; } + RefCountable *get() const { return obj; } +}; + +template +class NeedsIncRef +{ + typedef RefCountable *****ConvertibleToBool; + + RefCountable *obj; + + public: + explicit NeedsIncRef(RefCountable *obj) : obj(obj) {} + + bool null() const { return obj == NULL; } + operator ConvertibleToBool() const { return (ConvertibleToBool)obj; } + + RefCountable *operator->() const { JS_ASSERT(!null()); return obj; } + RefCountable &operator*() const { JS_ASSERT(!null()); return *obj; } + RefCountable *get() const { return obj; } +}; + +template +class AutoRefCount +{ + typedef RefCountable *****ConvertibleToBool; + + JSContext *const cx; + RefCountable *obj; + + AutoRefCount(const AutoRefCount &); + void operator=(const AutoRefCount &); + + public: + explicit AutoRefCount(JSContext *cx) + : cx(cx), obj(NULL) + {} + + AutoRefCount(JSContext *cx, NeedsIncRef aobj) + : cx(cx), obj(aobj.get()) + { + if (obj) + obj->incref(cx); + } + + AutoRefCount(JSContext *cx, AlreadyIncRefed aobj) + : cx(cx), obj(aobj.get()) + {} + + ~AutoRefCount() { + if (obj) + obj->decref(cx); + } + + void reset(NeedsIncRef aobj) { + if (obj) + obj->decref(cx); + obj = aobj.get(); + if (obj) + obj->incref(cx); + } + + void reset(AlreadyIncRefed aobj) { + if (obj) + obj->decref(cx); + obj = aobj.get(); + } + + bool null() const { return obj == NULL; } + operator ConvertibleToBool() const { return (ConvertibleToBool)obj; } + + RefCountable *operator->() const { JS_ASSERT(!null()); return obj; } + RefCountable &operator*() const { JS_ASSERT(!null()); return *obj; } + RefCountable *get() const { return obj; } +}; template JS_ALWAYS_INLINE static void @@ -718,6 +334,11 @@ PodEqual(T *one, T *two, size_t len) return !memcmp(one, two, len * sizeof(T)); } +JS_ALWAYS_INLINE static size_t +UnsignedPtrDiff(const void *bigger, const void *smaller) +{ + return size_t(bigger) - size_t(smaller); +} /* * Ordinarily, a function taking a JSContext* 'cx' paremter reports errors on @@ -728,139 +349,108 @@ PodEqual(T *one, T *two, size_t len) */ enum MaybeReportError { REPORT_ERROR = true, DONT_REPORT_ERROR = false }; +} /* namespace js */ +#endif /* __cplusplus */ + /* - * "Move" References + * JS_ROTATE_LEFT32 * - * Some types can be copied much more efficiently if we know the original's - * value need not be preserved --- that is, if we are doing a "move", not a - * "copy". For example, if we have: + * There is no rotate operation in the C Language so the construct (a << 4) | + * (a >> 28) is used instead. Most compilers convert this to a rotate + * instruction but some versions of MSVC don't without a little help. To get + * MSVC to generate a rotate instruction, we have to use the _rotl intrinsic + * and use a pragma to make _rotl inline. * - * Vector u; - * Vector v(u); - * - * the constructor for v must apply a copy constructor to each element of u --- - * taking time linear in the length of u. However, if we know we will not need u - * any more once v has been initialized, then we could initialize v very - * efficiently simply by stealing u's dynamically allocated buffer and giving it - * to v --- a constant-time operation, regardless of the size of u. - * - * Moves often appear in container implementations. For example, when we append - * to a vector, we may need to resize its buffer. This entails moving each of - * its extant elements from the old, smaller buffer to the new, larger buffer. - * But once the elements have been migrated, we're just going to throw away the - * old buffer; we don't care if they still have their values. So if the vector's - * element type can implement "move" more efficiently than "copy", the vector - * resizing should by all means use a "move" operation. Hash tables also need to - * be resized. - * - * The details of the optimization, and whether it's worth applying, vary from - * one type to the next. And while some constructor calls are moves, many really - * are copies, and can't be optimized this way. So we need: - * - * 1) a way for a particular invocation of a copy constructor to say that it's - * really a move, and that the value of the original isn't important - * afterwards (althought it must still be safe to destroy); and - * - * 2) a way for a type (like Vector) to announce that it can be moved more - * efficiently than it can be copied, and provide an implementation of that - * move operation. - * - * The Move(T &) function takes a reference to a T, and returns an MoveRef - * referring to the same value; that's 1). An MoveRef is simply a reference - * to a T, annotated to say that a copy constructor applied to it may move that - * T, instead of copying it. Finally, a constructor that accepts an MoveRef - * should perform a more efficient move, instead of a copy, providing 2). - * - * So, where we might define a copy constructor for a class C like this: - * - * C(const C &rhs) { ... copy rhs to this ... } - * - * we would declare a move constructor like this: - * - * C(MoveRef rhs) { ... move rhs to this ... } - * - * And where we might perform a copy like this: - * - * C c2(c1); - * - * we would perform a move like this: - * - * C c2(Move(c1)) - * - * Note that MoveRef implicitly converts to T &, so you can pass an - * MoveRef to an ordinary copy constructor for a type that doesn't support a - * special move constructor, and you'll just get a copy. This means that - * templates can use Move whenever they know they won't use the original value - * any more, even if they're not sure whether the type at hand has a specialized - * move constructor. If it doesn't, the MoveRef will just convert to a T &, - * and the ordinary copy constructor will apply. - * - * A class with a move constructor can also provide a move assignment operator, - * which runs this's destructor, and then applies the move constructor to - * *this's memory. A typical definition: - * - * C &operator=(MoveRef rhs) { - * this->~C(); - * new(this) C(rhs); - * return *this; - * } - * - * With that in place, one can write move assignments like this: - * - * c2 = Move(c1); - * - * This destroys c1, moves c1's value to c2, and leaves c1 in an undefined but - * destructible state. - * - * This header file defines MoveRef and Move in the js namespace. It's up to - * individual containers to annotate moves as such, by calling Move; and it's up - * to individual types to define move constructors. - * - * One hint: if you're writing a move constructor where the type has members - * that should be moved themselves, it's much nicer to write this: - * - * C(MoveRef c) : x(c->x), y(c->y) { } - * - * than the equivalent: - * - * C(MoveRef c) { new(&x) X(c->x); new(&y) Y(c->y); } - * - * especially since GNU C++ fails to notice that this does indeed initialize x - * and y, which may matter if they're const. + * MSVC in VS2005 will do an inline rotate instruction on the above construct. */ -template -class MoveRef { - public: - typedef T Referent; - explicit MoveRef(T &t) : pointer(&t) { } - T &operator*() const { return *pointer; } - T *operator->() const { return pointer; } -#ifdef __GXX_EXPERIMENTAL_CXX0X__ - /* - * If MoveRef is used in a rvalue position (which is expected), we can - * end up in a situation where, without this ifdef, we would try to pass - * a T& to a move constructor, which fails. It is not clear if the compiler - * should instead use the copy constructor, but for now this lets us build - * with clang. See bug 689066 and llvm.org/pr11003 for the details. - * Note: We can probably remove MoveRef completely once we are comfortable - * using c++11. - */ - operator T&& () const { return static_cast(*pointer); } +#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || \ + defined(_M_X64)) +#include +#pragma intrinsic(_rotl) +#define JS_ROTATE_LEFT32(a, bits) _rotl(a, bits) #else - operator T& () const { return *pointer; } +#define JS_ROTATE_LEFT32(a, bits) (((a) << (bits)) | ((a) >> (32 - (bits)))) #endif - private: - T *pointer; -}; -template -MoveRef Move(T &t) { return MoveRef(t); } +/* Static control-flow checks. */ +#ifdef NS_STATIC_CHECKING +/* Trigger a control flow check to make sure that code flows through label */ +inline __attribute__ ((unused)) void MUST_FLOW_THROUGH(const char *label) {} -template -MoveRef Move(const T &t) { return MoveRef(const_cast(t)); } +/* Avoid unused goto-label warnings. */ +# define MUST_FLOW_LABEL(label) goto label; label: -} /* namespace js */ +inline JS_FORCES_STACK void VOUCH_DOES_NOT_REQUIRE_STACK() {} -#endif /* defined(__cplusplus) */ +inline JS_FORCES_STACK void +JS_ASSERT_NOT_ON_TRACE(JSContext *cx) +{ + JS_ASSERT(!JS_ON_TRACE(cx)); +} +#else +# define MUST_FLOW_THROUGH(label) ((void) 0) +# define MUST_FLOW_LABEL(label) +# define VOUCH_DOES_NOT_REQUIRE_STACK() ((void) 0) +# define JS_ASSERT_NOT_ON_TRACE(cx) JS_ASSERT(!JS_ON_TRACE(cx)) +#endif + +/* Crash diagnostics */ +#ifdef DEBUG +# define JS_CRASH_DIAGNOSTICS 1 +#endif +#ifdef JS_CRASH_DIAGNOSTICS +# define JS_POISON(p, val, size) memset((p), (val), (size)) +# define JS_OPT_ASSERT(expr) \ + ((expr) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__)) +# define JS_OPT_ASSERT_IF(cond, expr) \ + ((!(cond) || (expr)) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__)) +#else +# define JS_POISON(p, val, size) ((void) 0) +# define JS_OPT_ASSERT(expr) ((void) 0) +# define JS_OPT_ASSERT_IF(cond, expr) ((void) 0) +#endif + +/* Basic stats */ +#ifdef DEBUG +# define JS_BASIC_STATS 1 +#endif +#ifdef JS_BASIC_STATS +# include +typedef struct JSBasicStats { + uint32 num; + uint32 max; + double sum; + double sqsum; + uint32 logscale; /* logarithmic scale: 0 (linear), 2, 10 */ + uint32 hist[11]; +} JSBasicStats; +# define JS_INIT_STATIC_BASIC_STATS {0,0,0,0,0,{0,0,0,0,0,0,0,0,0,0,0}} +# define JS_BASIC_STATS_INIT(bs) memset((bs), 0, sizeof(JSBasicStats)) +# define JS_BASIC_STATS_ACCUM(bs,val) \ + JS_BasicStatsAccum(bs, val) +# define JS_MeanAndStdDevBS(bs,sigma) \ + JS_MeanAndStdDev((bs)->num, (bs)->sum, (bs)->sqsum, sigma) +extern void +JS_BasicStatsAccum(JSBasicStats *bs, uint32 val); +extern double +JS_MeanAndStdDev(uint32 num, double sum, double sqsum, double *sigma); +extern void +JS_DumpBasicStats(JSBasicStats *bs, const char *title, FILE *fp); +extern void +JS_DumpHistogram(JSBasicStats *bs, FILE *fp); +#else +# define JS_BASIC_STATS_ACCUM(bs,val) +#endif + +/* A jsbitmap_t is a long integer that can be used for bitmaps. */ +typedef size_t jsbitmap; +#define JS_TEST_BIT(_map,_bit) ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] & \ + ((jsbitmap)1<<((_bit)&(JS_BITS_PER_WORD-1)))) +#define JS_SET_BIT(_map,_bit) ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] |= \ + ((jsbitmap)1<<((_bit)&(JS_BITS_PER_WORD-1)))) +#define JS_CLEAR_BIT(_map,_bit) ((_map)[(_bit)>>JS_BITS_PER_WORD_LOG2] &= \ + ~((jsbitmap)1<<((_bit)&(JS_BITS_PER_WORD-1)))) + +#define VOUCH_HAVE_STACK VOUCH_DOES_NOT_REQUIRE_STACK #endif /* jsutil_h___ */ diff --git a/js/src/jsval.h b/js/src/jsval.h index cca9d349685..2a2a3ba8a38 100644 --- a/js/src/jsval.h +++ b/js/src/jsval.h @@ -42,7 +42,7 @@ /* * Implementation details for js::Value in jsapi.h. */ -#include "jsutil.h" +#include "js/Utility.h" JS_BEGIN_EXTERN_C diff --git a/js/src/jswatchpoint.h b/js/src/jswatchpoint.h index 3f307795f68..dd5b7d027db 100644 --- a/js/src/jswatchpoint.h +++ b/js/src/jswatchpoint.h @@ -40,10 +40,12 @@ #ifndef jswatchpoint_h___ #define jswatchpoint_h___ -#include "jshashtable.h" +#include "jsalloc.h" #include "jsprvtd.h" #include "jsapi.h" +#include "js/HashTable.h" + namespace js { struct WatchKey { diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp index c82b45f268d..531ac2ae19a 100644 --- a/js/src/jsweakmap.cpp +++ b/js/src/jsweakmap.cpp @@ -43,7 +43,6 @@ #include "jsapi.h" #include "jscntxt.h" #include "jsgc.h" -#include "jshashtable.h" #include "jsobj.h" #include "jsgc.h" #include "jsgcmark.h" diff --git a/js/src/jsweakmap.h b/js/src/jsweakmap.h index 4135236fb83..d2660d3e016 100644 --- a/js/src/jsweakmap.h +++ b/js/src/jsweakmap.h @@ -47,6 +47,8 @@ #include "jsobj.h" #include "jsgcmark.h" +#include "js/HashTable.h" + namespace js { // A subclass template of js::HashMap whose keys and values may be garbage-collected. When diff --git a/js/src/jsxml.cpp b/js/src/jsxml.cpp index b3ee16489a8..ba91ac00b7f 100644 --- a/js/src/jsxml.cpp +++ b/js/src/jsxml.cpp @@ -46,7 +46,6 @@ #include #include "jstypes.h" #include "jsstdint.h" -#include "jsbit.h" #include "jsprf.h" #include "jsutil.h" #include "jsapi.h" @@ -68,7 +67,6 @@ #include "jsstr.h" #include "jsxml.h" #include "jsstaticcheck.h" -#include "jsvector.h" #include "vm/GlobalObject.h" diff --git a/js/src/methodjit/BaseAssembler.h b/js/src/methodjit/BaseAssembler.h index 0e639b1d7d2..248a6c1bb58 100644 --- a/js/src/methodjit/BaseAssembler.h +++ b/js/src/methodjit/BaseAssembler.h @@ -42,7 +42,6 @@ #define jsjaeger_baseassembler_h__ #include "jscntxt.h" -#include "jstl.h" #include "assembler/assembler/MacroAssemblerCodeRef.h" #include "assembler/assembler/MacroAssembler.h" #include "assembler/assembler/LinkBuffer.h" diff --git a/js/src/methodjit/BaseCompiler.h b/js/src/methodjit/BaseCompiler.h index c6b7ff34e64..c1a3117c6cf 100644 --- a/js/src/methodjit/BaseCompiler.h +++ b/js/src/methodjit/BaseCompiler.h @@ -41,7 +41,6 @@ #define jsjaeger_compilerbase_h__ #include "jscntxt.h" -#include "jstl.h" #include "assembler/assembler/MacroAssembler.h" #include "assembler/assembler/LinkBuffer.h" #include "assembler/assembler/RepatchBuffer.h" diff --git a/js/src/methodjit/Compiler.h b/js/src/methodjit/Compiler.h index dfbb1b43908..b49e9618c27 100644 --- a/js/src/methodjit/Compiler.h +++ b/js/src/methodjit/Compiler.h @@ -42,7 +42,6 @@ #include "jsanalyze.h" #include "jscntxt.h" -#include "jstl.h" #include "MethodJIT.h" #include "CodeGenIncludes.h" #include "BaseCompiler.h" diff --git a/js/src/methodjit/MachineRegs.h b/js/src/methodjit/MachineRegs.h index 99c3ddbde9f..37fcbbcb69e 100644 --- a/js/src/methodjit/MachineRegs.h +++ b/js/src/methodjit/MachineRegs.h @@ -40,7 +40,6 @@ #if !defined jsjaeger_regstate_h__ && defined JS_METHODJIT #define jsjaeger_regstate_h__ -#include "jsbit.h" #include "assembler/assembler/MacroAssembler.h" namespace js { diff --git a/js/src/methodjit/PolyIC.h b/js/src/methodjit/PolyIC.h index f408f91aed2..ddd64685340 100644 --- a/js/src/methodjit/PolyIC.h +++ b/js/src/methodjit/PolyIC.h @@ -41,10 +41,9 @@ #define jsjaeger_poly_ic_h__ #include "jscntxt.h" -#include "jstl.h" -#include "jsvector.h" #include "assembler/assembler/MacroAssembler.h" #include "assembler/assembler/CodeLocation.h" +#include "js/Vector.h" #include "methodjit/MethodJIT.h" #include "methodjit/ICRepatcher.h" #include "BaseAssembler.h" diff --git a/js/src/methodjit/StubCompiler.h b/js/src/methodjit/StubCompiler.h index cec08c58bf8..070e1bf6661 100644 --- a/js/src/methodjit/StubCompiler.h +++ b/js/src/methodjit/StubCompiler.h @@ -42,7 +42,6 @@ #define jsstub_compiler_h__ #include "jscntxt.h" -#include "jstl.h" #include "MethodJIT.h" #include "methodjit/FrameState.h" #include "CodeGenIncludes.h" diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index c7e3cb49260..579f72a61fe 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -77,7 +77,6 @@ #include "jstypedarrayinlines.h" #include "jsxml.h" #include "jsperf.h" -#include "jshashtable.h" #include "prmjtime.h" diff --git a/js/src/shell/jsheaptools.cpp b/js/src/shell/jsheaptools.cpp index eb245857096..e7fe1a35d01 100644 --- a/js/src/shell/jsheaptools.cpp +++ b/js/src/shell/jsheaptools.cpp @@ -46,11 +46,9 @@ #include "jscntxt.h" #include "jscompartment.h" #include "jsfun.h" -#include "jshashtable.h" #include "jsobj.h" #include "jsprf.h" #include "jsutil.h" -#include "jsvector.h" using namespace js; diff --git a/js/src/shell/jsoptparse.h b/js/src/shell/jsoptparse.h index 0a9b9b792b9..4a8593c6f9d 100644 --- a/js/src/shell/jsoptparse.h +++ b/js/src/shell/jsoptparse.h @@ -42,7 +42,9 @@ #define jsoptparse_h__ #include -#include + +#include "js/Vector.h" +#include "jsalloc.h" namespace js { namespace cli { diff --git a/js/src/shell/jsworkers.cpp b/js/src/shell/jsworkers.cpp index 6a524e9121d..21fd5c7d19d 100644 --- a/js/src/shell/jsworkers.cpp +++ b/js/src/shell/jsworkers.cpp @@ -47,10 +47,8 @@ #include "jsapi.h" #include "jscntxt.h" #include "jsdbgapi.h" -#include "jshashtable.h" #include "jsstdint.h" #include "jslock.h" -#include "jsvector.h" #include "jsworkers.h" extern size_t gMaxStackSize; diff --git a/js/src/tracejit/Writer.cpp b/js/src/tracejit/Writer.cpp index 46a97c5b4e2..8f6476e8429 100644 --- a/js/src/tracejit/Writer.cpp +++ b/js/src/tracejit/Writer.cpp @@ -38,7 +38,6 @@ * ***** END LICENSE BLOCK ***** */ #include "jsprf.h" -#include "jstl.h" #include "jscompartment.h" #include "jsiter.h" diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 68cb7320c65..652047c855c 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -45,7 +45,6 @@ #include "jsemit.h" #include "jsgcmark.h" #include "jsobj.h" -#include "jstl.h" #include "jswrapper.h" #include "jsarrayinlines.h" #include "jsinterpinlines.h" diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h index b10f698d1bb..2495503e175 100644 --- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -47,9 +47,10 @@ #include "jscntxt.h" #include "jscompartment.h" #include "jsgc.h" -#include "jshashtable.h" #include "jsweakmap.h" #include "jswrapper.h" + +#include "js/HashTable.h" #include "vm/GlobalObject.h" namespace js { diff --git a/js/src/vm/GlobalObject.h b/js/src/vm/GlobalObject.h index 87268b8220b..e89496073d8 100644 --- a/js/src/vm/GlobalObject.h +++ b/js/src/vm/GlobalObject.h @@ -43,7 +43,8 @@ #include "jsfun.h" #include "jsiter.h" -#include "jsvector.h" + +#include "js/Vector.h" extern JSObject * js_InitObjectClass(JSContext *cx, JSObject *obj); diff --git a/js/src/vm/RegExpObject.h b/js/src/vm/RegExpObject.h index 952f86fd8f0..74b6b2fa304 100644 --- a/js/src/vm/RegExpObject.h +++ b/js/src/vm/RegExpObject.h @@ -43,7 +43,8 @@ #include #include "jsobj.h" -#include "jstl.h" + +#include "js/TemplateLib.h" #include "yarr/Yarr.h" #if ENABLE_YARR_JIT diff --git a/js/src/vm/RegExpStatics.h b/js/src/vm/RegExpStatics.h index f3d7a917417..a9d89bc593c 100644 --- a/js/src/vm/RegExpStatics.h +++ b/js/src/vm/RegExpStatics.h @@ -42,7 +42,8 @@ #define RegExpStatics_h__ #include "jscntxt.h" -#include "jsvector.h" + +#include "js/Vector.h" namespace js { diff --git a/js/src/xpconnect/src/xpcmaps.cpp b/js/src/xpconnect/src/xpcmaps.cpp index d21619077dd..84808d5b8f5 100644 --- a/js/src/xpconnect/src/xpcmaps.cpp +++ b/js/src/xpconnect/src/xpcmaps.cpp @@ -41,7 +41,6 @@ /* Private maps (hashtables). */ #include "xpcprivate.h" -#include "jsbit.h" /***************************************************************************/ // static shared... diff --git a/js/src/xpconnect/src/xpcwrappednative.cpp b/js/src/xpconnect/src/xpcwrappednative.cpp index 41cc2f9fa5b..7a2106e1665 100644 --- a/js/src/xpconnect/src/xpcwrappednative.cpp +++ b/js/src/xpconnect/src/xpcwrappednative.cpp @@ -46,7 +46,6 @@ #include "XPCWrapper.h" #include "nsWrapperCacheInlines.h" #include "xpclog.h" -#include "jstl.h" #include "nsINode.h" #include "xpcquickstubs.h" #include "jsproxy.h" diff --git a/js/src/yarr/wtfbridge.h b/js/src/yarr/wtfbridge.h index 5c7c37909c9..ac41d08585f 100644 --- a/js/src/yarr/wtfbridge.h +++ b/js/src/yarr/wtfbridge.h @@ -47,7 +47,6 @@ #include "jsstr.h" #include "jsprvtd.h" -#include "jstl.h" #include "vm/String.h" #include "assembler/wtf/Platform.h" #if ENABLE_YARR_JIT diff --git a/layout/style/nsNthIndexCache.h b/layout/style/nsNthIndexCache.h index 43ed0ec8e2d..0797b19e1ae 100644 --- a/layout/style/nsNthIndexCache.h +++ b/layout/style/nsNthIndexCache.h @@ -40,7 +40,7 @@ #define nsContentIndexCache_h__ #include "nscore.h" -#include "jshashtable.h" +#include "js/HashTable.h" #include "mozilla/dom/Element.h" /* From 27db921de9409796a15d7e08e5da11c1829189f0 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Tue, 4 Oct 2011 10:50:25 -0700 Subject: [PATCH 11/57] Bug 690825 - Add a SecurityWrapper base between JS transparent wrappers and XPConnect security wrappers (r=mrbkap) --HG-- extra : rebase_source : c3b2057a725ddda79f2f9f8f1d8ef6a4c8581124 --- js/src/jswrapper.cpp | 45 ++++++++++++++++--- js/src/jswrapper.h | 22 +++++++++ js/src/xpconnect/wrappers/AccessCheck.cpp | 5 ++- .../xpconnect/wrappers/CrossOriginWrapper.cpp | 2 +- .../xpconnect/wrappers/FilteringWrapper.cpp | 15 ++++--- js/src/xpconnect/wrappers/WrapperFactory.cpp | 18 ++++---- js/src/xpconnect/wrappers/XrayWrapper.cpp | 18 +++++--- 7 files changed, 93 insertions(+), 32 deletions(-) diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index c09d43a9e13..650eeb06ae0 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -270,6 +270,13 @@ Wrapper::construct(JSContext *cx, JSObject *wrapper, uintN argc, Value *argv, Va GET(ProxyHandler::construct(cx, wrapper, argc, argv, vp)); } +bool +Wrapper::nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) +{ + const jsid id = JSID_VOID; + CHECKED(CallJSNative(cx, native, args), CALL); +} + bool Wrapper::hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) { @@ -773,13 +780,6 @@ CrossCompartmentWrapper::nativeCall(JSContext *cx, JSObject *wrapper, Class *cla return call.origin->wrap(cx, &srcArgs.rval()); } -bool -Wrapper::nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args) -{ - const jsid id = JSID_VOID; - CHECKED(CallJSNative(cx, native, args), CALL); -} - bool CrossCompartmentWrapper::hasInstance(JSContext *cx, JSObject *wrapper, const Value *vp, bool *bp) { @@ -848,3 +848,34 @@ CrossCompartmentWrapper::trace(JSTracer *trc, JSObject *wrapper) } CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u); + +/* Security wrappers. */ + +template +SecurityWrapper::SecurityWrapper(uintN flags) + : Base(flags) +{} + +template +bool +SecurityWrapper::nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, + CallArgs args) +{ + /* Let ProxyHandler report the error. */ + bool ret = ProxyHandler::nativeCall(cx, wrapper, clasp, native, args); + JS_ASSERT(!ret && cx->isExceptionPending()); + return ret; +} + +template +bool +SecurityWrapper::objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx) +{ + /* Let ProxyHandler say 'no'. */ + bool ret = ProxyHandler::objectClassIs(obj, classValue, cx); + JS_ASSERT(!ret && !cx->isExceptionPending()); + return ret; +} + +template class SecurityWrapper; +template class SecurityWrapper; diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index c45abe095dd..8577076ba99 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -157,6 +157,28 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper static CrossCompartmentWrapper singleton; }; +/* + * Base class for security wrappers. A security wrapper is potentially hiding + * all or part of some wrapped object thus SecurityWrapper defaults to denying + * access to the wrappee. This is the opposite of Wrapper which tries to be + * completely transparent. + * + * NB: Currently, only a few ProxyHandler operations are overridden to deny + * access, relying on derived SecurityWrapper to block access when necessary. + */ +template +class JS_FRIEND_API(SecurityWrapper) : public Base +{ + public: + SecurityWrapper(uintN flags); + + virtual bool nativeCall(JSContext *cx, JSObject *wrapper, Class *clasp, Native native, CallArgs args); + virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); +}; + +typedef SecurityWrapper SameCompartmentSecurityWrapper; +typedef SecurityWrapper CrossCompartmentSecurityWrapper; + /* * A hacky class that lets a friend force a fake frame. We must already be * in the compartment of |target| when we enter the forced frame. diff --git a/js/src/xpconnect/wrappers/AccessCheck.cpp b/js/src/xpconnect/wrappers/AccessCheck.cpp index 6b3f73f20e6..27e43ec8f6a 100644 --- a/js/src/xpconnect/wrappers/AccessCheck.cpp +++ b/js/src/xpconnect/wrappers/AccessCheck.cpp @@ -403,8 +403,9 @@ AccessCheck::isScriptAccessOnly(JSContext *cx, JSObject *wrapper) } // In addition, chrome objects can explicitly opt-in by setting .scriptOnly to true. - if (js::GetProxyHandler(wrapper) == &FilteringWrapper::singleton) { + if (js::GetProxyHandler(wrapper) == + &FilteringWrapper::singleton) { jsid scriptOnlyId = GetRTIdByIndex(cx, XPCJSRuntime::IDX_SCRIPTONLY); jsval scriptOnly; if (JS_LookupPropertyById(cx, obj, scriptOnlyId, &scriptOnly) && diff --git a/js/src/xpconnect/wrappers/CrossOriginWrapper.cpp b/js/src/xpconnect/wrappers/CrossOriginWrapper.cpp index 1757497f6f1..ab2e5718ca9 100644 --- a/js/src/xpconnect/wrappers/CrossOriginWrapper.cpp +++ b/js/src/xpconnect/wrappers/CrossOriginWrapper.cpp @@ -47,7 +47,7 @@ namespace xpc { -NoWaiverWrapper::NoWaiverWrapper(uintN flags) : CrossCompartmentWrapper(flags) +NoWaiverWrapper::NoWaiverWrapper(uintN flags) : js::CrossCompartmentWrapper(flags) { } diff --git a/js/src/xpconnect/wrappers/FilteringWrapper.cpp b/js/src/xpconnect/wrappers/FilteringWrapper.cpp index 9ec97ba0f8b..8a9708625d1 100644 --- a/js/src/xpconnect/wrappers/FilteringWrapper.cpp +++ b/js/src/xpconnect/wrappers/FilteringWrapper.cpp @@ -133,17 +133,18 @@ FilteringWrapper::enter(JSContext *cx, JSObject *wrapper, jsid id, return Base::enter(cx, wrapper, id, act, bp); } -#define SOW FilteringWrapper -#define SCSOW FilteringWrapper -#define COW FilteringWrapper -#define XOW FilteringWrapper, \ +#define SOW FilteringWrapper +#define SCSOW FilteringWrapper +#define COW FilteringWrapper +#define XOW FilteringWrapper, \ CrossOriginAccessiblePropertiesOnly> #define PXOW FilteringWrapper -#define NNXOW FilteringWrapper -#define LW FilteringWrapper, \ +#define NNXOW FilteringWrapper +#define LW FilteringWrapper, \ SameOriginOrCrossOriginAccessiblePropertiesOnly> -#define XLW FilteringWrapper, \ +#define XLW FilteringWrapper, \ SameOriginOrCrossOriginAccessiblePropertiesOnly> template<> SOW SOW::singleton(WrapperFactory::SCRIPT_ACCESS_ONLY_FLAG | diff --git a/js/src/xpconnect/wrappers/WrapperFactory.cpp b/js/src/xpconnect/wrappers/WrapperFactory.cpp index f504b6bae8a..c4695d76790 100644 --- a/js/src/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/src/xpconnect/wrappers/WrapperFactory.cpp @@ -303,7 +303,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO if (proxy) { wrapper = &XrayProxy::singleton; } else { - typedef XrayWrapper Xray; + typedef XrayWrapper Xray; wrapper = &Xray::singleton; xrayHolder = Xray::createHolder(cx, obj, parent); if (!xrayHolder) @@ -327,14 +327,14 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO if (targetdata && (wn = GetWrappedNative(cx, obj)) && wn->HasProto() && wn->GetProto()->ClassIsDOMObject()) { - typedef XrayWrapper Xray; + typedef XrayWrapper Xray; wrapper = &FilteringWrapper::singleton; xrayHolder = Xray::createHolder(cx, obj, parent); if (!xrayHolder) return nsnull; } else { - wrapper = &FilteringWrapper::singleton; } } else if (AccessCheck::isSameOrigin(origin, target)) { @@ -342,7 +342,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO // for an Xray or the wrapper needs a SOW. bool proxy; if (AccessCheck::needsSystemOnlyWrapper(obj)) { - wrapper = &FilteringWrapper::singleton; } else if (targetdata && targetdata->wantXrays && CanXray(obj, &proxy)) { if (proxy) { @@ -367,14 +367,14 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO // we filter out access to that property. bool proxy; if (!CanXray(obj, &proxy)) { - wrapper = &FilteringWrapper::singleton; } else { if (proxy) { wrapper = &FilteringWrapper::singleton; + CrossOriginAccessiblePropertiesOnly>::singleton; } else { - typedef XrayWrapper Xray; + typedef XrayWrapper Xray; // Location objects can become same origin after navigation, so we might // have to grant transparent access later on. @@ -403,7 +403,7 @@ WrapperFactory::Rewrap(JSContext *cx, JSObject *obj, JSObject *wrappedProto, JSO return wrapperObj; } -typedef FilteringWrapper, +typedef FilteringWrapper, SameOriginOrCrossOriginAccessiblePropertiesOnly> LW; bool @@ -457,7 +457,7 @@ WrapperFactory::WrapSOWObject(JSContext *cx, JSObject *obj) { JSObject *wrapperObj = Wrapper::New(cx, obj, JS_GetPrototype(cx, obj), JS_GetGlobalForObject(cx, obj), - &FilteringWrapper::singleton); return wrapperObj; } diff --git a/js/src/xpconnect/wrappers/XrayWrapper.cpp b/js/src/xpconnect/wrappers/XrayWrapper.cpp index fabced431b2..a721aa461a5 100644 --- a/js/src/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/src/xpconnect/wrappers/XrayWrapper.cpp @@ -1305,13 +1305,19 @@ XrayProxy XrayProxy::singleton(0); -#define XPCNW XrayWrapper -#define SCNW XrayWrapper +#define XRAY XrayWrapper +template <> XRAY XRAY::singleton(0); +template class XRAY; +#undef XRAY -template <> XPCNW XPCNW::singleton(0); -template <> SCNW SCNW::singleton(0); +#define XRAY XrayWrapper +template <> XRAY XRAY::singleton(0); +template class XRAY; +#undef XRAY -template class XPCNW; -template class SCNW; +#define XRAY XrayWrapper +template <> XRAY XRAY::singleton(0); +template class XRAY; +#undef XRAY } From 3f91084acfe1bfd0f987b6b333431826f0188946 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Wed, 12 Oct 2011 00:32:57 +0900 Subject: [PATCH 12/57] Bug 679271 - Intermittent a11y/accessible/events/test_tree.xul | Test timed out, sometimes with a leak, r=marcoz --- accessible/tests/mochitest/treeview.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accessible/tests/mochitest/treeview.js b/accessible/tests/mochitest/treeview.js index ce3d55cb35d..874be9ad6eb 100644 --- a/accessible/tests/mochitest/treeview.js +++ b/accessible/tests/mochitest/treeview.js @@ -40,8 +40,8 @@ nsTreeView.prototype = getCellText: function getCellText(aRow, aCol) { var data = this.getDataForIndex(aRow); - if (aCol in data.colsText) - return data.colsText[aCol]; + if (aCol.id in data.colsText) + return data.colsText[aCol.id]; return data.text + aCol.id; }, @@ -120,7 +120,7 @@ nsTreeView.prototype = setCellText: function setCellText(aRow, aCol, aValue) { var data = this.getDataForIndex(aRow); - data.colsText[aCol] = aValue; + data.colsText[aCol.id] = aValue; }, setCellValue: function setCellValue(aRow, aCol, aValue) { From 89e03c40ebffca374e91d8816da950e8c9ecfdd8 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Wed, 12 Oct 2011 00:33:06 +0900 Subject: [PATCH 13/57] Bug 506206 - ASSERTION: There should always be a DOM node for an event, one more patch, r=davidb --- .../src/base/NotificationController.cpp | 4 ++++ accessible/src/base/nsDocAccessible.cpp | 23 +++++++------------ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/accessible/src/base/NotificationController.cpp b/accessible/src/base/NotificationController.cpp index 50c56570648..e7ce1b9cf48 100644 --- a/accessible/src/base/NotificationController.cpp +++ b/accessible/src/base/NotificationController.cpp @@ -316,6 +316,10 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime) for (PRUint32 idx = 0; idx < eventCount; idx++) { AccEvent* accEvent = events[idx]; if (accEvent->mEventRule != AccEvent::eDoNotEmit) { + nsAccessible* target = accEvent->GetAccessible(); + if (!target || target->IsDefunct()) + continue; + // Dispatch the focus event if target is still focused. if (accEvent->mEventType == nsIAccessibleEvent::EVENT_FOCUS) { FocusMgr()->ProcessFocusEvent(accEvent); diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index 3ba4ad65193..ed5ddf787e3 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -1730,33 +1730,26 @@ nsDocAccessible::FireDelayedAccessibleEvent(AccEvent* aEvent) void nsDocAccessible::ProcessPendingEvent(AccEvent* aEvent) { - nsAccessible* accessible = aEvent->GetAccessible(); - if (!accessible) - return; - PRUint32 eventType = aEvent->GetEventType(); if (eventType == nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED) { - nsCOMPtr accessibleText = do_QueryObject(accessible); + nsHyperTextAccessible* hyperText = aEvent->GetAccessible()->AsHyperText(); PRInt32 caretOffset; - if (accessibleText && - NS_SUCCEEDED(accessibleText->GetCaretOffset(&caretOffset))) { + if (hyperText && + NS_SUCCEEDED(hyperText->GetCaretOffset(&caretOffset))) { #ifdef DEBUG_A11Y PRUnichar chAtOffset; - accessibleText->GetCharacterAtOffset(caretOffset, &chAtOffset); + hyperText->GetCharacterAtOffset(caretOffset, &chAtOffset); printf("\nCaret moved to %d with char %c", caretOffset, chAtOffset); #endif nsRefPtr caretMoveEvent = - new AccCaretMoveEvent(accessible, caretOffset); - if (!caretMoveEvent) - return; - + new AccCaretMoveEvent(hyperText, caretOffset); nsEventShell::FireEvent(caretMoveEvent); PRInt32 selectionCount; - accessibleText->GetSelectionCount(&selectionCount); + hyperText->GetSelectionCount(&selectionCount); if (selectionCount) { // There's a selection so fire selection change as well nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED, - accessible); + hyperText); } } } @@ -1765,7 +1758,7 @@ nsDocAccessible::ProcessPendingEvent(AccEvent* aEvent) // Post event processing if (eventType == nsIAccessibleEvent::EVENT_HIDE) - ShutdownChildrenInSubtree(accessible); + ShutdownChildrenInSubtree(aEvent->GetAccessible()); } } From a9f3ec881129a7e587349a4b549c3e01e35617c6 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Tue, 11 Oct 2011 08:50:50 -0700 Subject: [PATCH 14/57] Followup for b9c673621e1e: fixup missed ARM-only includes of jsvector/jshashtable --- js/src/assembler/wtf/SegmentedVector.h | 2 +- js/src/yarr/pcre/pcre_compile.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/assembler/wtf/SegmentedVector.h b/js/src/assembler/wtf/SegmentedVector.h index 0aed45e18b8..f679a21fe13 100644 --- a/js/src/assembler/wtf/SegmentedVector.h +++ b/js/src/assembler/wtf/SegmentedVector.h @@ -30,7 +30,7 @@ #define SegmentedVector_h #include "jsprvtd.h" -#include "jsvector.h" +#include "js/Vector.h" namespace WTF { diff --git a/js/src/yarr/pcre/pcre_compile.cpp b/js/src/yarr/pcre/pcre_compile.cpp index a6072668809..355e7253a07 100644 --- a/js/src/yarr/pcre/pcre_compile.cpp +++ b/js/src/yarr/pcre/pcre_compile.cpp @@ -45,7 +45,7 @@ supporting internal functions that are not used by other modules. */ #include #include "yarr/ASCIICType.h" -#include "jsvector.h" +#include "js/Vector.h" using namespace WTF; From c0e2936af0e6f188ba0360e70e522e94d24fd2b4 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 11 Oct 2011 10:50:57 -0400 Subject: [PATCH 15/57] Bug 677797 - Implement mandatory ASLR on Windows; r=bsmedberg --- toolkit/xre/nsWindowsDllBlocklist.cpp | 91 +++++++++++++++++++++------ 1 file changed, 72 insertions(+), 19 deletions(-) diff --git a/toolkit/xre/nsWindowsDllBlocklist.cpp b/toolkit/xre/nsWindowsDllBlocklist.cpp index 714ab5cec56..13044eb6422 100644 --- a/toolkit/xre/nsWindowsDllBlocklist.cpp +++ b/toolkit/xre/nsWindowsDllBlocklist.cpp @@ -148,6 +148,59 @@ typedef NTSTATUS (NTAPI *LdrLoadDll_func) (PWCHAR filePath, PULONG flags, PUNICO static LdrLoadDll_func stub_LdrLoadDll = 0; +namespace { + +template +struct RVAMap { + RVAMap(HANDLE map, unsigned offset) { + mMappedView = reinterpret_cast + (::MapViewOfFile(map, FILE_MAP_READ, 0, offset, sizeof(T))); + } + ~RVAMap() { + if (mMappedView) { + ::UnmapViewOfFile(mMappedView); + } + } + operator const T*() const { return mMappedView; } + const T* operator->() const { return mMappedView; } +private: + const T* mMappedView; +}; + +void +ForceASLR(const wchar_t* path) +{ + HANDLE file = ::CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, + NULL); + if (file != INVALID_HANDLE_VALUE) { + HANDLE map = ::CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL); + if (map) { + RVAMap peHeader(map, 0); + if (peHeader) { + RVAMap ntHeader(map, peHeader->e_lfanew); + if (ntHeader) { + // If we're dealing with a DLL which has code inside it, but does not have the + // ASLR bit set, allocate a page at its base address. + if (((ntHeader->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) == 0) && + (ntHeader->OptionalHeader.SizeOfCode > 0)) { + void* page = ::VirtualAlloc((LPVOID)ntHeader->OptionalHeader.ImageBase, 1, + MEM_RESERVE, PAGE_NOACCESS); + // Note that we will leak this page, but it's ok since it's just one page in + // the virtual address space, with no physical page backing it. + + // We're done at this point! + } + } + } + ::CloseHandle(map); + } + ::CloseHandle(file); + } +} + +} + static NTSTATUS NTAPI patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileName, PHANDLE handle) { @@ -160,6 +213,23 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam int len = moduleFileName->Length / 2; wchar_t *fname = moduleFileName->Buffer; + // figure out the length of the string that we need + DWORD pathlen = SearchPathW(filePath, fname, L".dll", 0, NULL, NULL); + if (pathlen == 0) { + // uh, we couldn't find the DLL at all, so... + printf_stderr("LdrLoadDll: Blocking load of '%s' (SearchPathW didn't find it?)\n", dllName); + return STATUS_DLL_NOT_FOUND; + } + + nsAutoArrayPtr full_fname(new wchar_t[pathlen+1]); + if (!full_fname) { + // couldn't allocate memory? + return STATUS_DLL_NOT_FOUND; + } + + // now actually grab it + SearchPathW(filePath, fname, L".dll", pathlen+1, full_fname, NULL); + // The filename isn't guaranteed to be null terminated, but in practice // it always will be; ensure that this is so, and bail if not. // This is done instead of the more robust approach because of bug 527122, @@ -235,23 +305,6 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam #endif if (info->maxVersion != ALL_VERSIONS) { - // figure out the length of the string that we need - DWORD pathlen = SearchPathW(filePath, fname, L".dll", 0, NULL, NULL); - if (pathlen == 0) { - // uh, we couldn't find the DLL at all, so... - printf_stderr("LdrLoadDll: Blocking load of '%s' (SearchPathW didn't find it?)\n", dllName); - return STATUS_DLL_NOT_FOUND; - } - - wchar_t *full_fname = (wchar_t*) malloc(sizeof(wchar_t)*(pathlen+1)); - if (!full_fname) { - // couldn't allocate memory? - return STATUS_DLL_NOT_FOUND; - } - - // now actually grab it - SearchPathW(filePath, fname, L".dll", pathlen+1, full_fname, NULL); - DWORD zero; DWORD infoSize = GetFileVersionInfoSizeW(full_fname, &zero); @@ -275,8 +328,6 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam load_ok = true; } } - - free(full_fname); } if (!load_ok) { @@ -292,6 +343,8 @@ continue_loading: NS_SetHasLoadedNewDLLs(); + ForceASLR(full_fname); + return stub_LdrLoadDll(filePath, flags, moduleFileName, handle); } From 666f605d3f3e645ce96ebbf9555332ad88bab304 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Tue, 11 Oct 2011 11:11:35 -0500 Subject: [PATCH 16/57] Bug 677883 - Bypass deferred message processing for accessible tab windows. Fixes occasional wm_getobject query failures, which must be responded to. r=davidb --- accessible/src/msaa/nsAccessNodeWrap.cpp | 4 ++++ accessible/src/msaa/nsWinUtils.cpp | 25 ++++++++++++++++-------- ipc/glue/WindowsMessageLoop.cpp | 8 ++++++++ 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/accessible/src/msaa/nsAccessNodeWrap.cpp b/accessible/src/msaa/nsAccessNodeWrap.cpp index 0b39c974105..e17244d64fc 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -743,6 +743,10 @@ nsRefPtrHashtable nsAccessNodeWrap::sHWNDCach LRESULT CALLBACK nsAccessNodeWrap::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { + // Note, this window's message handling should not invoke any call that + // may result in a cross-process ipc call. Doing so may violate RPC + // message semantics. + switch (msg) { case WM_GETOBJECT: { diff --git a/accessible/src/msaa/nsWinUtils.cpp b/accessible/src/msaa/nsWinUtils.cpp index 8c25afc35bb..7c422b68b5f 100644 --- a/accessible/src/msaa/nsWinUtils.cpp +++ b/accessible/src/msaa/nsWinUtils.cpp @@ -46,6 +46,10 @@ #include "nsArrayUtils.h" #include "nsIDocShellTreeItem.h" +// Window property used by ipc related code in identifying accessible +// tab windows. +const PRUnichar* kPropNameTabContent = L"AccessibleTabWindow"; + HRESULT nsWinUtils::ConvertToIA2Array(nsIArray *aGeckoArray, IUnknown ***aIA2Array, long *aIA2ArrayLen) @@ -149,14 +153,19 @@ nsWinUtils::CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd, int aX, int aY, int aWidth, int aHeight, bool aIsActive) { - return ::CreateWindowExW(WS_EX_TRANSPARENT, aWindowClass, - L"NetscapeDispatchWnd", - WS_CHILD | (aIsActive ? WS_VISIBLE : 0), - aX, aY, aWidth, aHeight, - aParentWnd, - NULL, - GetModuleHandle(NULL), - NULL); + HWND hwnd = ::CreateWindowExW(WS_EX_TRANSPARENT, aWindowClass, + L"NetscapeDispatchWnd", + WS_CHILD | (aIsActive ? WS_VISIBLE : 0), + aX, aY, aWidth, aHeight, + aParentWnd, + NULL, + GetModuleHandle(NULL), + NULL); + if (hwnd) { + // Mark this window so that ipc related code can identify it. + ::SetPropW(hwnd, kPropNameTabContent, (HANDLE)1); + } + return hwnd; } void diff --git a/ipc/glue/WindowsMessageLoop.cpp b/ipc/glue/WindowsMessageLoop.cpp index a7aaca7edae..df9c4dd2355 100644 --- a/ipc/glue/WindowsMessageLoop.cpp +++ b/ipc/glue/WindowsMessageLoop.cpp @@ -101,6 +101,8 @@ using namespace mozilla::ipc::windows; // pulled from widget's nsAppShell extern const PRUnichar* kAppShellEventId; +// pulled from accessibility's win utils +extern const PRUnichar* kPropNameTabContent; namespace { @@ -379,6 +381,12 @@ WindowIsDeferredWindow(HWND hWnd) return false; } + // Tab content creates a window that responds to accessible WM_GETOBJECT + // calls. This window can safely be ignored. + if (::GetPropW(hWnd, kPropNameTabContent)) { + return false; + } + // Common mozilla windows we must defer messages to. nsDependentString className(buffer, length); if (StringBeginsWith(className, NS_LITERAL_STRING("Mozilla")) || From 39510c10d998d552fa95f3f1a113dc5c8ccf34db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Tue, 11 Oct 2011 12:30:08 -0400 Subject: [PATCH 17/57] Bug 669953 - build debug builds with optimization. r=ted. --- browser/config/mozconfigs/linux32/debug | 1 - browser/config/mozconfigs/linux64/debug | 1 - browser/config/mozconfigs/macosx32/debug | 1 - browser/config/mozconfigs/macosx64/debug | 1 - browser/config/mozconfigs/win32/debug | 1 - browser/config/mozconfigs/win64/debug | 1 - mobile/config/mozconfigs/android/debug | 1 - 7 files changed, 7 deletions(-) diff --git a/browser/config/mozconfigs/linux32/debug b/browser/config/mozconfigs/linux32/debug index 60c3d25d9ef..c137123ec3d 100644 --- a/browser/config/mozconfigs/linux32/debug +++ b/browser/config/mozconfigs/linux32/debug @@ -1,6 +1,5 @@ ac_add_options --enable-application=browser -ac_add_options --disable-optimize ac_add_options --enable-debug ac_add_options --enable-libxul diff --git a/browser/config/mozconfigs/linux64/debug b/browser/config/mozconfigs/linux64/debug index 17949579e23..e67a4bcba06 100644 --- a/browser/config/mozconfigs/linux64/debug +++ b/browser/config/mozconfigs/linux64/debug @@ -1,6 +1,5 @@ ac_add_options --enable-application=browser -ac_add_options --disable-optimize ac_add_options --enable-debug ac_add_options --enable-tests diff --git a/browser/config/mozconfigs/macosx32/debug b/browser/config/mozconfigs/macosx32/debug index 61eb9cf7b26..0c6bb03df6f 100644 --- a/browser/config/mozconfigs/macosx32/debug +++ b/browser/config/mozconfigs/macosx32/debug @@ -3,7 +3,6 @@ ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk -ac_add_options --disable-optimize ac_add_options --enable-debug ac_add_options --enable-libxul diff --git a/browser/config/mozconfigs/macosx64/debug b/browser/config/mozconfigs/macosx64/debug index 6fdec131180..0f9aa057dcb 100644 --- a/browser/config/mozconfigs/macosx64/debug +++ b/browser/config/mozconfigs/macosx64/debug @@ -1,4 +1,3 @@ -ac_add_options --disable-optimize ac_add_options --enable-debug ac_add_options --enable-libxul diff --git a/browser/config/mozconfigs/win32/debug b/browser/config/mozconfigs/win32/debug index f2f8ea8502e..30d68050664 100644 --- a/browser/config/mozconfigs/win32/debug +++ b/browser/config/mozconfigs/win32/debug @@ -1,6 +1,5 @@ ac_add_options --enable-application=browser ac_add_options --enable-jemalloc -ac_add_options --disable-optimize ac_add_options --enable-debug ac_add_options --enable-libxul ac_add_options --enable-trace-malloc diff --git a/browser/config/mozconfigs/win64/debug b/browser/config/mozconfigs/win64/debug index 2c9c73e9098..3d52764f2fb 100644 --- a/browser/config/mozconfigs/win64/debug +++ b/browser/config/mozconfigs/win64/debug @@ -3,7 +3,6 @@ ac_add_options --host=x86_64-pc-mingw32 ac_add_options --enable-application=browser ac_add_options --enable-jemalloc -ac_add_options --disable-optimize ac_add_options --enable-debug ac_add_options --enable-libxul ac_add_options --enable-trace-malloc diff --git a/mobile/config/mozconfigs/android/debug b/mobile/config/mozconfigs/android/debug index 8a2ca92b8d2..522c28f685a 100644 --- a/mobile/config/mozconfigs/android/debug +++ b/mobile/config/mozconfigs/android/debug @@ -1,7 +1,6 @@ # Global options mk_add_options MOZ_MAKE_FLAGS=-j4 ac_add_options --enable-debug -ac_add_options --disable-optimize # Build Fennec ac_add_options --enable-application=mobile From c73741d535965d5f85d44a8fb6be5b5d6332977a Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Mon, 10 Oct 2011 12:15:41 +0200 Subject: [PATCH 18/57] Bug 692496 - Avoid table scan in expiration by restricting on flattened data. r=dietrich --- .../components/places/nsPlacesExpiration.js | 12 ++++----- .../expiration/test_annos_expire_policy.js | 25 +++++++++++++++++-- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/toolkit/components/places/nsPlacesExpiration.js b/toolkit/components/places/nsPlacesExpiration.js index 8447135c275..0bc8c02ed45 100644 --- a/toolkit/components/places/nsPlacesExpiration.js +++ b/toolkit/components/places/nsPlacesExpiration.js @@ -244,7 +244,8 @@ const EXPIRATION_QUERIES = { + "FROM moz_places h " + "LEFT JOIN moz_historyvisits v ON h.id = v.place_id " + "LEFT JOIN moz_bookmarks b ON h.id = b.fk " - + "WHERE v.id IS NULL " + + "WHERE h.last_visit_date IS NULL " + + "AND v.id IS NULL " + "AND b.id IS NULL " + "AND frecency <> -1 " + "LIMIT :limit_uris", @@ -268,7 +269,8 @@ const EXPIRATION_QUERIES = { + "FROM moz_places h " + "LEFT JOIN moz_historyvisits v ON h.id = v.place_id " + "LEFT JOIN moz_bookmarks b ON h.id = b.fk " - + "WHERE v.id IS NULL " + + "WHERE h.last_visit_date IS NULL " + + "AND v.id IS NULL " + "AND b.id IS NULL " + "LIMIT :limit_uris " + ")", @@ -293,9 +295,7 @@ const EXPIRATION_QUERIES = { sql: "DELETE FROM moz_annos WHERE id in ( " + "SELECT a.id FROM moz_annos a " + "LEFT JOIN moz_places h ON a.place_id = h.id " - + "LEFT JOIN moz_historyvisits v ON a.place_id = v.place_id " + "WHERE h.id IS NULL " - + "OR (v.id IS NULL AND a.expiration <> :expire_never) " + "LIMIT :limit_annos " + ")", actions: ACTION.TIMED | ACTION.TIMED_OVERLIMIT | ACTION.CLEAR_HISTORY | @@ -935,8 +935,8 @@ nsPlacesExpiration.prototype = { params.limit_favicons = baseLimit; break; case "QUERY_EXPIRE_ANNOS": - params.expire_never = Ci.nsIAnnotationService.EXPIRE_NEVER; - params.limit_annos = baseLimit; + // Each page may have multiple annos. + params.limit_annos = baseLimit * EXPIRE_AGGRESSIVITY_MULTIPLIER; break; case "QUERY_EXPIRE_ANNOS_WITH_POLICY": case "QUERY_EXPIRE_ITEMS_ANNOS_WITH_POLICY": diff --git a/toolkit/components/places/tests/expiration/test_annos_expire_policy.js b/toolkit/components/places/tests/expiration/test_annos_expire_policy.js index 16d3efe8911..fb2832f8a1b 100644 --- a/toolkit/components/places/tests/expiration/test_annos_expire_policy.js +++ b/toolkit/components/places/tests/expiration/test_annos_expire_policy.js @@ -117,7 +117,7 @@ function run_test() { // Expire all expirable pages. setMaxPages(0); - let now = Date.now() * 1000; + let now = getExpirablePRTime(); // Add some bookmarked page and timed annotations for each. for (let i = 0; i < 5; i++) { let pageURI = uri("http://item_anno." + i + ".mozilla.org/"); @@ -144,6 +144,27 @@ function run_test() { add_old_anno(id, "persist_lm_months", "test", as.EXPIRE_MONTHS, 181, 179); // Add a 181 days old anno. add_old_anno(id, "expire_months", "test", as.EXPIRE_MONTHS, 181); + + // Add a 6 days old anno. + add_old_anno(pageURI, "persist_days", "test", as.EXPIRE_DAYS, 6); + // Add a 8 days old anno, modified 5 days ago. + add_old_anno(pageURI, "persist_lm_days", "test", as.EXPIRE_DAYS, 8, 6); + // Add a 8 days old anno. + add_old_anno(pageURI, "expire_days", "test", as.EXPIRE_DAYS, 8); + + // Add a 29 days old anno. + add_old_anno(pageURI, "persist_weeks", "test", as.EXPIRE_WEEKS, 29); + // Add a 31 days old anno, modified 29 days ago. + add_old_anno(pageURI, "persist_lm_weeks", "test", as.EXPIRE_WEEKS, 31, 29); + // Add a 31 days old anno. + add_old_anno(pageURI, "expire_weeks", "test", as.EXPIRE_WEEKS, 31); + + // Add a 179 days old anno. + add_old_anno(pageURI, "persist_months", "test", as.EXPIRE_MONTHS, 179); + // Add a 181 days old anno, modified 179 days ago. + add_old_anno(pageURI, "persist_lm_months", "test", as.EXPIRE_MONTHS, 181, 179); + // Add a 181 days old anno. + add_old_anno(pageURI, "expire_months", "test", as.EXPIRE_MONTHS, 181); } // Add some visited page and timed annotations for each. @@ -190,7 +211,7 @@ function run_test() { ["persist_days", "persist_lm_days", "persist_weeks", "persist_lm_weeks", "persist_months", "persist_lm_months"].forEach(function(aAnno) { let pages = as.getPagesWithAnnotation(aAnno); - do_check_eq(pages.length, 5); + do_check_eq(pages.length, 10); }); ["persist_days", "persist_lm_days", "persist_weeks", "persist_lm_weeks", From 0c74a1c7b0d852b471aa21b8928cbea64c7370b7 Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Tue, 11 Oct 2011 19:04:29 +0200 Subject: [PATCH 19/57] Bug 692496 - Fix a coherence error in a Sync test. r=philikon --- .../sync/tests/unit/test_history_store.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/services/sync/tests/unit/test_history_store.js b/services/sync/tests/unit/test_history_store.js index 9e50825c130..df5967bd1f4 100644 --- a/services/sync/tests/unit/test_history_store.js +++ b/services/sync/tests/unit/test_history_store.js @@ -163,11 +163,21 @@ add_test(function test_null_title() { add_test(function test_invalid_records() { _("Make sure we handle invalid URLs in places databases gracefully."); - let query = "INSERT INTO moz_places " - + "(url, title, rev_host, visit_count, last_visit_date) " - + "VALUES ('invalid-uri', 'Invalid URI', '.', 1, " + TIMESTAMP3 + ")"; - let stmt = PlacesUtils.history.DBConnection.createAsyncStatement(query); - let result = Async.querySpinningly(stmt); + let stmt = PlacesUtils.history.DBConnection.createAsyncStatement( + "INSERT INTO moz_places " + + "(url, title, rev_host, visit_count, last_visit_date) " + + "VALUES ('invalid-uri', 'Invalid URI', '.', 1, " + TIMESTAMP3 + ")" + ); + Async.querySpinningly(stmt); + stmt.finalize(); + // Add the corresponding visit to retain database coherence. + stmt = PlacesUtils.history.DBConnection.createAsyncStatement( + "INSERT INTO moz_historyvisits " + + "(place_id, visit_date, visit_type, session) " + + "VALUES ((SELECT id FROM moz_places WHERE url = 'invalid-uri'), " + + TIMESTAMP3 + ", " + Ci.nsINavHistoryService.TRANSITION_TYPED + ", 1)" + ); + Async.querySpinningly(stmt); stmt.finalize(); do_check_attribute_count(store.getAllIDs(), 4); From ace97dcf1d20326e4dd8ac7c3903fc42390282e9 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Tue, 23 Aug 2011 17:35:09 -0700 Subject: [PATCH 20/57] Bug 677411 - Replace JS GC statistics gathering (r=cdleary) --- configure.in | 11 -- js/src/Makefile.in | 8 +- js/src/configure.in | 22 --- js/src/gc/Statistics.cpp | 208 +++++++++++++++++++++++++++ js/src/gc/Statistics.h | 158 ++++++++++++++++++++ js/src/jsapi-tests/testThreadGC.cpp | 2 +- js/src/jsapi.cpp | 5 +- js/src/jscntxt.cpp | 18 +-- js/src/jscntxt.h | 55 +------ js/src/jsgc.cpp | 214 ++++++++++++---------------- js/src/jsgc.h | 11 +- js/src/jsgcstats.cpp | 191 +------------------------ js/src/jsgcstats.h | 116 --------------- js/src/jsscope.cpp | 3 +- 14 files changed, 490 insertions(+), 532 deletions(-) create mode 100644 js/src/gc/Statistics.cpp create mode 100644 js/src/gc/Statistics.h diff --git a/configure.in b/configure.in index a550a636d81..7dcdd840915 100644 --- a/configure.in +++ b/configure.in @@ -7122,17 +7122,6 @@ if test -n "$MOZ_TRACEVIS"; then AC_DEFINE(MOZ_TRACEVIS) fi -dnl ======================================================== -dnl = Use GCTimer -dnl ======================================================== -MOZ_ARG_ENABLE_BOOL(gctimer, -[ --enable-gctimer Enable GC timer (default=no)], - MOZ_GCTIMER=1, - MOZ_GCTIMER= ) -if test -n "$MOZ_GCTIMER"; then - AC_DEFINE(MOZ_GCTIMER) -fi - dnl ======================================================== dnl ETW - Event Tracing for Windows dnl ======================================================== diff --git a/js/src/Makefile.in b/js/src/Makefile.in index b110ac0c1c1..cc6d8a69fc1 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -100,6 +100,7 @@ VPATH = \ $(srcdir)/builtin \ $(srcdir)/ds \ $(srcdir)/frontend \ + $(srcdir)/gc \ $(srcdir)/vm \ $(NULL) @@ -169,6 +170,7 @@ CPPSRCS = \ RegExpObject.cpp \ RegExpStatics.cpp \ RegExp.cpp \ + Statistics.cpp \ Unicode.cpp \ $(NULL) @@ -233,7 +235,7 @@ INSTALLED_HEADERS = \ # BEGIN exported headers that are only exported # because of inclusion by an INSTALLED_HEADER # -EXPORTS_NAMESPACES += vm ds +EXPORTS_NAMESPACES += vm ds gc EXPORTS_vm = \ String.h \ @@ -245,6 +247,10 @@ EXPORTS_ds = \ LifoAlloc.h \ $(NULL) +EXPORTS_gc = \ + Statistics.h \ + $(NULL) + ###################################################### # BEGIN include exported headers from the JS engine # diff --git a/js/src/configure.in b/js/src/configure.in index a5e00855129..63e842edfd1 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -4416,28 +4416,6 @@ if test -n "$MOZ_TRACEVIS"; then fi fi -dnl ======================================================== -dnl = Use GCTimer -dnl ======================================================== -MOZ_ARG_ENABLE_BOOL(gctimer, -[ --enable-gctimer Enable GC timer (default=no)], - MOZ_GCTIMER=1, - MOZ_GCTIMER= ) -if test -n "$MOZ_GCTIMER"; then - AC_DEFINE(MOZ_GCTIMER) -fi - -dnl ======================================================== -dnl = Don't enable GC-TestPilot plumbing -dnl ======================================================== -JSGC_TESTPILOT=1 -MOZ_ARG_DISABLE_BOOL(gctestpilot, -[ --disable-gctestpilot Disable GC TestPilot study hooks], - JSGC_TESTPILOT= ) -if test -n "$JSGC_TESTPILOT"; then - AC_DEFINE(JSGC_TESTPILOT) -fi - dnl ======================================================== dnl = Use Valgrind dnl ======================================================== diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp new file mode 100644 index 00000000000..c09711e7130 --- /dev/null +++ b/js/src/gc/Statistics.cpp @@ -0,0 +1,208 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=78: + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is SpiderMonkey JavaScript engine. + * + * The Initial Developer of the Original Code is + * the Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * 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"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include + +#include "jscntxt.h" +#include "jsprobes.h" +#include "jsutil.h" +#include "jscrashformat.h" +#include "jscrashreport.h" +#include "prmjtime.h" + +#include "gc/Statistics.h" + +namespace js { +namespace gcstats { + +Statistics::Statistics(JSRuntime *rt) + : runtime(rt) +{ + char *env = getenv("MOZ_GCTIMER"); + if (!env || strcmp(env, "none") == 0) { + fp = NULL; + return; + } + + if (strcmp(env, "stdout") == 0) { + fullFormat = false; + fp = stdout; + } else if (strcmp(env, "stderr") == 0) { + fullFormat = false; + fp = stderr; + } else { + fullFormat = true; + + fp = fopen(env, "a"); + JS_ASSERT(fp); + + fprintf(fp, " AppTime, Total, Wait, Mark, Sweep, FinObj," + " FinStr, FinScr, FinShp, Destry, End, +Chu, -Chu, T, Reason\n"); + } + + PodArrayZero(counts); + + startupTime = PRMJ_Now(); +} + +Statistics::~Statistics() +{ + if (fp && fp != stdout && fp != stderr) + fclose(fp); +} + +struct GCCrashData +{ + int isRegen; + int isCompartment; +}; + +void +Statistics::beginGC(JSCompartment *comp, Reason reason) +{ + compartment = comp; + + PodArrayZero(phaseStarts); + PodArrayZero(phaseEnds); + PodArrayZero(phaseTimes); + + triggerReason = reason; + + beginPhase(PHASE_GC); + Probes::GCStart(compartment); + + GCCrashData crashData; + crashData.isRegen = runtime->shapeGen & SHAPE_OVERFLOW_BIT; + crashData.isCompartment = !!compartment; + crash::SaveCrashData(crash::JS_CRASH_TAG_GC, &crashData, sizeof(crashData)); +} + +double +Statistics::t(Phase phase) +{ + return double(phaseTimes[phase]) / PRMJ_USEC_PER_MSEC; +} + +double +Statistics::beginDelay(Phase phase1, Phase phase2) +{ + return double(phaseStarts[phase1] - phaseStarts[phase2]) / PRMJ_USEC_PER_MSEC; +} + +double +Statistics::endDelay(Phase phase1, Phase phase2) +{ + return double(phaseEnds[phase1] - phaseEnds[phase2]) / PRMJ_USEC_PER_MSEC; +} + +void +Statistics::printStats() +{ + if (fullFormat) { + /* App , Total, Wait , Mark , Sweep, FinOb, FinSt, FinSc, FinSh, Destry, End */ + fprintf(fp, + "%12.0f, %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, ", + double(phaseStarts[PHASE_GC] - startupTime) / PRMJ_USEC_PER_MSEC, + t(PHASE_GC), + beginDelay(PHASE_MARK, PHASE_GC), + t(PHASE_MARK), t(PHASE_SWEEP), + t(PHASE_SWEEP_OBJECT), t(PHASE_SWEEP_STRING), + t(PHASE_SWEEP_SCRIPT), t(PHASE_SWEEP_SHAPE), + t(PHASE_DESTROY), + endDelay(PHASE_GC, PHASE_DESTROY)); + + fprintf(fp, "%4d, %4d,", counts[STAT_NEW_CHUNK], counts[STAT_DESTROY_CHUNK]); + fprintf(fp, " %s, %s\n", compartment ? "C" : "G", ExplainReason(triggerReason)); + } else { + fprintf(fp, "%f %f %f\n", + t(PHASE_GC), t(PHASE_MARK), t(PHASE_SWEEP)); + } + fflush(fp); +} + +void +Statistics::endGC() +{ + Probes::GCEnd(compartment); + endPhase(PHASE_GC); + crash::SnapshotGCStack(); + + if (fp) + printStats(); + + PodArrayZero(counts); +} + +void +Statistics::beginPhase(Phase phase) +{ + phaseStarts[phase] = PRMJ_Now(); + + if (phase == gcstats::PHASE_SWEEP) { + Probes::GCStartSweepPhase(NULL); + if (!compartment) { + for (JSCompartment **c = runtime->compartments.begin(); + c != runtime->compartments.end(); ++c) + { + Probes::GCStartSweepPhase(*c); + } + } + } +} + +void +Statistics::endPhase(Phase phase) +{ + phaseEnds[phase] = PRMJ_Now(); + phaseTimes[phase] += phaseEnds[phase] - phaseStarts[phase]; + + if (phase == gcstats::PHASE_SWEEP) { + if (!compartment) { + for (JSCompartment **c = runtime->compartments.begin(); + c != runtime->compartments.end(); ++c) + { + Probes::GCEndSweepPhase(*c); + } + } + Probes::GCEndSweepPhase(NULL); + } +} + +} /* namespace gcstats */ +} /* namespace js */ diff --git a/js/src/gc/Statistics.h b/js/src/gc/Statistics.h new file mode 100644 index 00000000000..5c60afeaaaf --- /dev/null +++ b/js/src/gc/Statistics.h @@ -0,0 +1,158 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * vim: set ts=8 sw=4 et tw=78: + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is SpiderMonkey JavaScript engine. + * + * The Initial Developer of the Original Code is + * the Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2011 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * 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"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef jsgc_statistics_h___ +#define jsgc_statistics_h___ + +#include + +#include "jspubtd.h" +#include "jsutil.h" + +struct JSCompartment; + +namespace js { +namespace gcstats { + +enum Reason { + PUBLIC_API, + MAYBEGC, + LASTCONTEXT, + DESTROYCONTEXT, + LASTDITCH, + TOOMUCHMALLOC, + ALLOCTRIGGER, + CHUNK, + SHAPE, + REFILL +}; +static int NUM_REASONS = REFILL + 1; + +static inline const char * +ExplainReason(Reason r) +{ + static const char *strs[] = {" API", "Maybe", "LastC", "DestC", "LastD", + "Mallc", "Alloc", "Chunk", "Shape", "Refil"}; + + JS_ASSERT(strcmp(strs[SHAPE], "Shape") == 0 && + sizeof(strs) / sizeof(strs[0]) == NUM_REASONS); + + return strs[r]; +} + +enum Phase { + PHASE_GC, + PHASE_MARK, + PHASE_SWEEP, + PHASE_SWEEP_OBJECT, + PHASE_SWEEP_STRING, + PHASE_SWEEP_SCRIPT, + PHASE_SWEEP_SHAPE, + PHASE_DESTROY, + + PHASE_LIMIT +}; + +enum Stat { + STAT_NEW_CHUNK, + STAT_DESTROY_CHUNK, + + STAT_LIMIT +}; + +struct Statistics { + Statistics(JSRuntime *rt); + ~Statistics(); + + void beginGC(JSCompartment *comp, Reason reason); + void endGC(); + + void beginPhase(Phase phase); + void endPhase(Phase phase); + + void count(Stat s) { + JS_ASSERT(s < STAT_LIMIT); + counts[s]++; + } + + private: + JSRuntime *runtime; + + uint64 startupTime; + + FILE *fp; + bool fullFormat; + + Reason triggerReason; + JSCompartment *compartment; + + uint64 phaseStarts[PHASE_LIMIT]; + uint64 phaseEnds[PHASE_LIMIT]; + uint64 phaseTimes[PHASE_LIMIT]; + unsigned int counts[STAT_LIMIT]; + + double t(Phase phase); + double beginDelay(Phase phase1, Phase phase2); + double endDelay(Phase phase1, Phase phase2); + void printStats(); +}; + +struct AutoGC { + AutoGC(Statistics &stats, JSCompartment *comp, Reason reason JS_GUARD_OBJECT_NOTIFIER_PARAM) + : stats(stats) { JS_GUARD_OBJECT_NOTIFIER_INIT; stats.beginGC(comp, reason); } + ~AutoGC() { stats.endGC(); } + + Statistics &stats; + JS_DECL_USE_GUARD_OBJECT_NOTIFIER +}; + +struct AutoPhase { + AutoPhase(Statistics &stats, Phase phase JS_GUARD_OBJECT_NOTIFIER_PARAM) + : stats(stats), phase(phase) { JS_GUARD_OBJECT_NOTIFIER_INIT; stats.beginPhase(phase); } + ~AutoPhase() { stats.endPhase(phase); } + + Statistics &stats; + Phase phase; + JS_DECL_USE_GUARD_OBJECT_NOTIFIER +}; + +} /* namespace gcstats */ +} /* namespace js */ + +#endif /* jsgc_statistics_h___ */ diff --git a/js/src/jsapi-tests/testThreadGC.cpp b/js/src/jsapi-tests/testThreadGC.cpp index fadbf97187d..6a9772d700a 100644 --- a/js/src/jsapi-tests/testThreadGC.cpp +++ b/js/src/jsapi-tests/testThreadGC.cpp @@ -164,7 +164,7 @@ BEGIN_TEST(testThreadGC_bug590533) * loop. Then run the GC with JSRuntime->gcIsNeeded flag set. */ js::AutoLockGC lock(rt); - js::TriggerGC(rt); + js::TriggerGC(rt, js::gcstats::PUBLIC_API); } JS_GC(cx); diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 72482311483..204c0d08639 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -662,6 +662,7 @@ JSRuntime::JSRuntime() gcMode(JSGC_MODE_GLOBAL), gcIsNeeded(0), gcWeakMapList(NULL), + gcStats(thisFromCtor()), gcTriggerCompartment(NULL), gcCurrentCompartment(NULL), gcCheckCompartment(NULL), @@ -2704,14 +2705,12 @@ JS_CompartmentGC(JSContext *cx, JSCompartment *comp) LeaveTrace(cx); - GCREASON(PUBLIC_API); - js_GC(cx, comp, GC_NORMAL); + js_GC(cx, comp, GC_NORMAL, gcstats::PUBLIC_API); } JS_PUBLIC_API(void) JS_GC(JSContext *cx) { - GCREASON(PUBLIC_API); JS_CompartmentGC(cx, NULL); } diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index 4f6980a3c92..ffcec33aad0 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -533,21 +533,18 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode) #endif if (last) { - GCREASON(LASTCONTEXT); - js_GC(cx, NULL, GC_LAST_CONTEXT); + js_GC(cx, NULL, GC_LAST_CONTEXT, gcstats::LASTCONTEXT); /* Take the runtime down, now that it has no contexts or atoms. */ JS_LOCK_GC(rt); rt->state = JSRTS_DOWN; JS_NOTIFY_ALL_CONDVAR(rt->stateChange); } else { - if (mode == JSDCM_FORCE_GC) { - GCREASON(DESTROYCONTEXT); - js_GC(cx, NULL, GC_NORMAL); - } else if (mode == JSDCM_MAYBE_GC) { - GCREASON(DESTROYCONTEXT); + if (mode == JSDCM_FORCE_GC) + js_GC(cx, NULL, GC_NORMAL, gcstats::DESTROYCONTEXT); + else if (mode == JSDCM_MAYBE_GC) JS_MaybeGC(cx); - } + JS_LOCK_GC(rt); js_WaitForGC(rt); } @@ -1165,7 +1162,7 @@ js_InvokeOperationCallback(JSContext *cx) JS_UNLOCK_GC(rt); if (rt->gcIsNeeded) { - js_GC(cx, rt->gcTriggerCompartment, GC_NORMAL); + js_GC(cx, rt->gcTriggerCompartment, GC_NORMAL, rt->gcTriggerReason); /* * On trace we can exceed the GC quota, see comments in NewGCArena. So @@ -1514,8 +1511,7 @@ JSRuntime::onTooMuchMalloc() */ js_WaitForGC(this); #endif - GCREASON(TOOMUCHMALLOC); - TriggerGC(this); + TriggerGC(this, gcstats::TOOMUCHMALLOC); } JS_FRIEND_API(void *) diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index aaabc759224..3e79b87deb2 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -58,6 +58,7 @@ #include "prmjtime.h" #include "ds/LifoAlloc.h" +#include "gc/Statistics.h" #include "js/HashTable.h" #include "js/Vector.h" #include "vm/StackSpace.h" @@ -430,6 +431,10 @@ struct JSRuntime { JSGCMode gcMode; volatile jsuword gcIsNeeded; js::WeakMapBase *gcWeakMapList; + js::gcstats::Statistics gcStats; + + /* The reason that an interrupt-triggered GC should be called. */ + js::gcstats::Reason gcTriggerReason; /* Pre-allocated space for the GC mark stacks. Pointer type ensures alignment. */ void *gcMarkStackObjs[js::OBJECT_MARK_STACK_SIZE / sizeof(void *)]; @@ -673,59 +678,13 @@ struct JSRuntime { */ int32 inOOMReport; -#if defined(MOZ_GCTIMER) || defined(JSGC_TESTPILOT) - struct GCData { - GCData() - : firstEnter(0), - firstEnterValid(false) -#ifdef JSGC_TESTPILOT - , infoEnabled(false), - start(0), - count(0) -#endif - { } - - /* - * Timestamp of the first GCTimer -- application runtime is determined - * relative to this value. - */ - uint64 firstEnter; - bool firstEnterValid; - - void setFirstEnter(uint64 v) { - JS_ASSERT(!firstEnterValid); - firstEnter = v; - firstEnterValid = true; - } - -#ifdef JSGC_TESTPILOT - bool infoEnabled; - - bool isTimerEnabled() { - return infoEnabled; - } - - /* - * Circular buffer with GC data. - * count may grow >= INFO_LIMIT, which would indicate data loss. - */ - static const size_t INFO_LIMIT = 64; - JSGCInfo info[INFO_LIMIT]; - size_t start; - size_t count; -#else /* defined(MOZ_GCTIMER) */ - bool isTimerEnabled() { - return true; - } -#endif - } gcData; -#endif - JSRuntime(); ~JSRuntime(); bool init(uint32 maxbytes); + JSRuntime *thisFromCtor() { return this; } + void setGCLastBytes(size_t lastBytes, JSGCInvocationKind gckind); void reduceGCTriggerBytes(uint32 amount); diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 5ed18eef8ae..3515041bc13 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -440,7 +440,7 @@ ChunkPool::get(JSRuntime *rt) --emptyCount; } else { JS_ASSERT(!emptyCount); - chunk = Chunk::allocate(); + chunk = Chunk::allocate(rt); if (!chunk) return NULL; } @@ -473,7 +473,7 @@ ChunkPool::put(JSRuntime *rt, Chunk *chunk) */ if (rt->gcHelperThread.sweeping()) { if (rt->gcHelperThread.shouldShrink()) { - Chunk::release(chunk); + Chunk::release(rt, chunk); return; } @@ -512,7 +512,7 @@ ChunkPool::expire(JSRuntime *rt, bool releaseAll) if (releaseAll || chunk->info.age == MAX_EMPTY_CHUNK_AGE) { *chunkp = chunk->info.next; --emptyCount; - Chunk::release(chunk); + Chunk::release(rt, chunk); } else { /* Keep the chunk but increase its age. */ ++chunk->info.age; @@ -523,25 +523,21 @@ ChunkPool::expire(JSRuntime *rt, bool releaseAll) } /* static */ Chunk * -Chunk::allocate() +Chunk::allocate(JSRuntime *rt) { Chunk *chunk = static_cast(AllocGCChunk()); if (!chunk) return NULL; chunk->init(); -#ifdef MOZ_GCTIMER - JS_ATOMIC_INCREMENT(&newChunkCount); -#endif + rt->gcStats.count(gcstats::STAT_NEW_CHUNK); return chunk; } /* static */ inline void -Chunk::release(Chunk *chunk) +Chunk::release(JSRuntime *rt, Chunk *chunk) { JS_ASSERT(chunk); -#ifdef MOZ_GCTIMER - JS_ATOMIC_INCREMENT(&destroyChunkCount); -#endif + rt->gcStats.count(gcstats::STAT_DESTROY_CHUNK); FreeGCChunk(chunk); } @@ -625,7 +621,7 @@ Chunk::allocateArena(JSCompartment *comp, AllocKind thingKind) JS_ATOMIC_ADD(&rt->gcBytes, ArenaSize); JS_ATOMIC_ADD(&comp->gcBytes, ArenaSize); if (comp->gcBytes >= comp->gcTriggerBytes) - TriggerCompartmentGC(comp); + TriggerCompartmentGC(comp, gcstats::ALLOCTRIGGER); return aheader; } @@ -698,7 +694,7 @@ PickChunk(JSCompartment *comp) GCChunkSet::AddPtr p = rt->gcChunkSet.lookupForAdd(chunk); JS_ASSERT(!p); if (!rt->gcChunkSet.add(p, chunk)) { - Chunk::release(chunk); + Chunk::release(rt, chunk); return NULL; } @@ -1057,7 +1053,7 @@ js_FinishGC(JSRuntime *rt) rt->gcSystemAvailableChunkListHead = NULL; rt->gcUserAvailableChunkListHead = NULL; for (GCChunkSet::Range r(rt->gcChunkSet.all()); !r.empty(); r.popFront()) - Chunk::release(r.front()); + Chunk::release(rt, r.front()); rt->gcChunkSet.clear(); #ifdef JS_THREADSAFE @@ -1525,8 +1521,7 @@ RunLastDitchGC(JSContext *cx) #endif /* The last ditch GC preserves all atoms. */ AutoKeepAtoms keep(rt); - GCREASON(LASTDITCH); - js_GC(cx, rt->gcTriggerCompartment, GC_NORMAL); + js_GC(cx, rt->gcTriggerCompartment, GC_NORMAL, gcstats::LASTDITCH); #ifdef JS_THREADSAFE if (rt->gcBytes >= rt->gcMaxBytes) { @@ -1579,8 +1574,7 @@ ArenaLists::refillFreeList(JSContext *cx, AllocKind thingKind) */ if (runGC || !IsGCAllowed(cx)) { AutoLockGC lock(rt); - GCREASON(REFILL); - TriggerGC(rt); + TriggerGC(rt, gcstats::REFILL); break; } runGC = true; @@ -1980,7 +1974,7 @@ MarkRuntime(JSTracer *trc) } void -TriggerGC(JSRuntime *rt) +TriggerGC(JSRuntime *rt, gcstats::Reason reason) { JS_ASSERT(!rt->gcRunning); if (rt->gcIsNeeded) @@ -1992,24 +1986,24 @@ TriggerGC(JSRuntime *rt) */ rt->gcIsNeeded = true; rt->gcTriggerCompartment = NULL; + rt->gcTriggerReason = reason; TriggerAllOperationCallbacks(rt); } void -TriggerCompartmentGC(JSCompartment *comp) +TriggerCompartmentGC(JSCompartment *comp, gcstats::Reason reason) { JSRuntime *rt = comp->rt; JS_ASSERT(!rt->gcRunning); - GCREASON(COMPARTMENT); if (rt->gcZeal()) { - TriggerGC(rt); + TriggerGC(rt, reason); return; } if (rt->gcMode != JSGC_MODE_COMPARTMENT || comp == rt->atomsCompartment) { /* We can't do a compartmental GC of the default compartment. */ - TriggerGC(rt); + TriggerGC(rt, reason); return; } @@ -2022,7 +2016,7 @@ TriggerCompartmentGC(JSCompartment *comp) if (rt->gcBytes > 8192 && rt->gcBytes >= 3 * (rt->gcTriggerBytes / 2)) { /* If we're using significantly more than our quota, do a full GC. */ - TriggerGC(rt); + TriggerGC(rt, reason); return; } @@ -2032,6 +2026,7 @@ TriggerCompartmentGC(JSCompartment *comp) */ rt->gcIsNeeded = true; rt->gcTriggerCompartment = comp; + rt->gcTriggerReason = reason; TriggerAllOperationCallbacks(comp->rt); } @@ -2041,21 +2036,18 @@ MaybeGC(JSContext *cx) JSRuntime *rt = cx->runtime; if (rt->gcZeal()) { - GCREASON(MAYBEGC); - js_GC(cx, NULL, GC_NORMAL); + js_GC(cx, NULL, GC_NORMAL, gcstats::MAYBEGC); return; } JSCompartment *comp = cx->compartment; if (rt->gcIsNeeded) { - GCREASON(MAYBEGC); - js_GC(cx, (comp == rt->gcTriggerCompartment) ? comp : NULL, GC_NORMAL); + js_GC(cx, (comp == rt->gcTriggerCompartment) ? comp : NULL, GC_NORMAL, gcstats::MAYBEGC); return; } if (comp->gcBytes > 8192 && comp->gcBytes >= 3 * (comp->gcTriggerBytes / 4)) { - GCREASON(MAYBEGC); - js_GC(cx, (rt->gcMode == JSGC_MODE_COMPARTMENT) ? comp : NULL, GC_NORMAL); + js_GC(cx, (rt->gcMode == JSGC_MODE_COMPARTMENT) ? comp : NULL, GC_NORMAL, gcstats::MAYBEGC); return; } @@ -2065,12 +2057,10 @@ MaybeGC(JSContext *cx) */ int64 now = PRMJ_Now(); if (rt->gcNextFullGCTime && rt->gcNextFullGCTime <= now) { - if (rt->gcChunkAllocationSinceLastGC) { - GCREASON(MAYBEGC); - js_GC(cx, NULL, GC_SHRINK); - } else { + if (rt->gcChunkAllocationSinceLastGC) + js_GC(cx, NULL, GC_SHRINK, gcstats::MAYBEGC); + else rt->gcNextFullGCTime = now + GC_IDLE_FULL_SPAN; - } } } @@ -2157,7 +2147,7 @@ GCHelperThread::threadLoop() Chunk *chunk; { AutoUnlockGC unlock(rt); - chunk = Chunk::allocate(); + chunk = Chunk::allocate(rt); } /* OOM stops the background allocation. */ @@ -2284,7 +2274,7 @@ GCHelperThread::doSweep() freeVector.resize(0); } -} +} /* namespace js */ #endif /* JS_THREADSAFE */ @@ -2344,7 +2334,7 @@ SweepCompartments(JSContext *cx, JSGCInvocationKind gckind) } static void -BeginMarkPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIMER_PARAM) +BeginMarkPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind) { JSRuntime *rt = cx->runtime; @@ -2374,7 +2364,7 @@ BeginMarkPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTI /* * Mark phase. */ - GCTIMESTAMP(startMark); + rt->gcStats.beginPhase(gcstats::PHASE_MARK); for (GCChunkSet::Range r(rt->gcChunkSet.all()); !r.empty(); r.popFront()) r.front()->bitmap.clear(); @@ -2389,7 +2379,7 @@ BeginMarkPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTI } static void -EndMarkPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIMER_PARAM) +EndMarkPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind) { JSRuntime *rt = cx->runtime; @@ -2411,6 +2401,8 @@ EndMarkPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIME rt->gcMarkingTracer = NULL; + rt->gcStats.endPhase(gcstats::PHASE_MARK); + if (rt->gcCallback) (void) rt->gcCallback(cx, JSGC_MARK_END); @@ -2426,7 +2418,7 @@ EndMarkPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIME } static void -SweepPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIMER_PARAM) +SweepPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind) { JSRuntime *rt = cx->runtime; @@ -2444,7 +2436,7 @@ SweepPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIMER_ * unique. This works since the atomization API must not be called during * the GC. */ - GCTIMESTAMP(startSweep); + gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP); /* Finalize unreachable (key,value) pairs in all weak maps. */ WeakMapBase::sweepAll(gcmarker); @@ -2454,10 +2446,6 @@ SweepPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIMER_ /* Collect watch points associated with unreachable objects. */ WatchpointMap::sweepAll(cx); - Probes::GCStartSweepPhase(NULL); - for (GCCompartmentsIter c(rt); !c.done(); c.next()) - Probes::GCStartSweepPhase(c); - if (!rt->gcCurrentCompartment) Debugger::sweepAll(cx); @@ -2465,63 +2453,67 @@ SweepPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIMER_ for (GCCompartmentsIter c(rt); !c.done(); c.next()) c->sweep(cx, releaseInterval); - /* - * We finalize objects before other GC things to ensure that the object's - * finalizer can access the other things even if they will be freed. - */ - for (GCCompartmentsIter c(rt); !c.done(); c.next()) - c->arenas.finalizeObjects(cx); + { + gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_OBJECT); - GCTIMESTAMP(sweepObjectEnd); + /* + * We finalize objects before other GC things to ensure that the object's + * finalizer can access the other things even if they will be freed. + */ + for (GCCompartmentsIter c(rt); !c.done(); c.next()) + c->arenas.finalizeObjects(cx); + } - for (GCCompartmentsIter c(rt); !c.done(); c.next()) - c->arenas.finalizeStrings(cx); + { + gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_STRING); + for (GCCompartmentsIter c(rt); !c.done(); c.next()) + c->arenas.finalizeStrings(cx); + } - GCTIMESTAMP(sweepStringEnd); + { + gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_SCRIPT); + for (GCCompartmentsIter c(rt); !c.done(); c.next()) + c->arenas.finalizeScripts(cx); + } - for (GCCompartmentsIter c(rt); !c.done(); c.next()) - c->arenas.finalizeScripts(cx); - - GCTIMESTAMP(sweepScriptEnd); - - for (GCCompartmentsIter c(rt); !c.done(); c.next()) - c->arenas.finalizeShapes(cx); - - GCTIMESTAMP(sweepShapeEnd); - - for (GCCompartmentsIter c(rt); !c.done(); c.next()) - Probes::GCEndSweepPhase(c); - Probes::GCEndSweepPhase(NULL); + { + gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_SHAPE); + for (GCCompartmentsIter c(rt); !c.done(); c.next()) + c->arenas.finalizeShapes(cx); + } #ifdef DEBUG PropertyTree::dumpShapes(cx); #endif - /* - * Sweep script filenames after sweeping functions in the generic loop - * above. In this way when a scripted function's finalizer destroys the - * script and calls rt->destroyScriptHook, the hook can still access the - * script's filename. See bug 323267. - */ - for (GCCompartmentsIter c(rt); !c.done(); c.next()) - js_SweepScriptFilenames(c); + { + gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_DESTROY); - /* - * This removes compartments from rt->compartment, so we do it last to make - * sure we don't miss sweeping any compartments. - */ - if (!rt->gcCurrentCompartment) - SweepCompartments(cx, gckind); + /* + * Sweep script filenames after sweeping functions in the generic loop + * above. In this way when a scripted function's finalizer destroys the + * script and calls rt->destroyScriptHook, the hook can still access the + * script's filename. See bug 323267. + */ + for (GCCompartmentsIter c(rt); !c.done(); c.next()) + js_SweepScriptFilenames(c); + + /* + * This removes compartments from rt->compartment, so we do it last to make + * sure we don't miss sweeping any compartments. + */ + if (!rt->gcCurrentCompartment) + SweepCompartments(cx, gckind); #ifndef JS_THREADSAFE - /* - * Destroy arenas after we finished the sweeping so finalizers can safely - * use IsAboutToBeFinalized(). - * This is done on the GCHelperThread if JS_THREADSAFE is defined. - */ - rt->gcChunkPool.expire(rt, gckind == GC_SHRINK); + /* + * Destroy arenas after we finished the sweeping so finalizers can safely + * use IsAboutToBeFinalized(). + * This is done on the GCHelperThread if JS_THREADSAFE is defined. + */ + rt->gcChunkPool.expire(rt, gckind == GC_SHRINK); #endif - GCTIMESTAMP(sweepDestroyEnd); + } if (rt->gcCallback) (void) rt->gcCallback(cx, JSGC_FINALIZE_END); @@ -2535,7 +2527,7 @@ SweepPhase(JSContext *cx, GCMarker *gcmarker, JSGCInvocationKind gckind GCTIMER_ * to finish. The caller must hold rt->gcLock. */ static void -MarkAndSweep(JSContext *cx, JSGCInvocationKind gckind GCTIMER_PARAM) +MarkAndSweep(JSContext *cx, JSGCInvocationKind gckind) { JSRuntime *rt = cx->runtime; rt->gcNumber++; @@ -2554,10 +2546,10 @@ MarkAndSweep(JSContext *cx, JSGCInvocationKind gckind GCTIMER_PARAM) JS_ASSERT(gcmarker.getMarkColor() == BLACK); rt->gcMarkingTracer = &gcmarker; - BeginMarkPhase(cx, &gcmarker, gckind GCTIMER_ARG); + BeginMarkPhase(cx, &gcmarker, gckind); gcmarker.drainMarkStack(); - EndMarkPhase(cx, &gcmarker, gckind GCTIMER_ARG); - SweepPhase(cx, &gcmarker, gckind GCTIMER_ARG); + EndMarkPhase(cx, &gcmarker, gckind); + SweepPhase(cx, &gcmarker, gckind); } #ifdef JS_THREADSAFE @@ -2739,7 +2731,7 @@ AutoGCSession::~AutoGCSession() * js_GC excludes any pointers we use during the marking implementation. */ static JS_NEVER_INLINE void -GCCycle(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIMER_PARAM) +GCCycle(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind) { JSRuntime *rt = cx->runtime; @@ -2801,7 +2793,7 @@ GCCycle(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIMER_P } #endif - MarkAndSweep(cx, gckind GCTIMER_ARG); + MarkAndSweep(cx, gckind); #ifdef JS_THREADSAFE if (gckind != GC_LAST_CONTEXT && rt->state != JSRTS_LANDING) { @@ -2823,14 +2815,8 @@ GCCycle(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIMER_P (*c)->setGCLastBytes((*c)->gcBytes, gckind); } -struct GCCrashData -{ - int isRegen; - int isCompartment; -}; - void -js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind) +js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind, gcstats::Reason reason) { JSRuntime *rt = cx->runtime; @@ -2850,22 +2836,7 @@ js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind) RecordNativeStackTopForGC(cx); - GCCrashData crashData; - crashData.isRegen = rt->shapeGen & SHAPE_OVERFLOW_BIT; - crashData.isCompartment = !!comp; - crash::SaveCrashData(crash::JS_CRASH_TAG_GC, &crashData, sizeof(crashData)); - - GCTIMER_BEGIN(rt, comp); - - struct AutoGCProbe { - JSCompartment *comp; - AutoGCProbe(JSCompartment *comp) : comp(comp) { - Probes::GCStart(comp); - } - ~AutoGCProbe() { - Probes::GCEnd(comp); /* background thread may still be sweeping */ - } - } autoGCProbe(comp); + gcstats::AutoGC agc(rt->gcStats, comp, reason); do { /* @@ -2883,7 +2854,7 @@ js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind) /* Lock out other GC allocator and collector invocations. */ AutoLockGC lock(rt); rt->gcPoke = false; - GCCycle(cx, comp, gckind GCTIMER_ARG); + GCCycle(cx, comp, gckind); } /* We re-sample the callback again as the finalizers can change it. */ @@ -2899,9 +2870,6 @@ js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind) rt->gcNextFullGCTime = PRMJ_Now() + GC_IDLE_FULL_SPAN; rt->gcChunkAllocationSinceLastGC = false; - GCTIMER_END(gckind == GC_LAST_CONTEXT); - - crash::SnapshotGCStack(); } namespace js { diff --git a/js/src/jsgc.h b/js/src/jsgc.h index a2a4c6f586c..06985fa37f1 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -57,6 +57,7 @@ #include "jsgcstats.h" #include "jscell.h" +#include "gc/Statistics.h" #include "js/HashTable.h" #include "js/Vector.h" @@ -657,8 +658,8 @@ struct Chunk { void releaseArena(ArenaHeader *aheader); - static Chunk *allocate(); - static inline void release(Chunk *chunk); + static Chunk *allocate(JSRuntime *rt); + static inline void release(JSRuntime *rt, Chunk *chunk); private: inline void init(); @@ -1266,11 +1267,11 @@ MarkContext(JSTracer *trc, JSContext *acx); /* Must be called with GC lock taken. */ extern void -TriggerGC(JSRuntime *rt); +TriggerGC(JSRuntime *rt, js::gcstats::Reason reason); /* Must be called with GC lock taken. */ extern void -TriggerCompartmentGC(JSCompartment *comp); +TriggerCompartmentGC(JSCompartment *comp, js::gcstats::Reason reason); extern void MaybeGC(JSContext *cx); @@ -1296,7 +1297,7 @@ typedef enum JSGCInvocationKind { /* Pass NULL for |comp| to get a full GC. */ extern void -js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind); +js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind, js::gcstats::Reason r); #ifdef JS_THREADSAFE /* diff --git a/js/src/jsgcstats.cpp b/js/src/jsgcstats.cpp index b2d2ddd5f45..f8ab5d3ec6e 100644 --- a/js/src/jsgcstats.cpp +++ b/js/src/jsgcstats.cpp @@ -80,54 +80,6 @@ ConservativeGCStats::dump(FILE *fp) #endif } //gc -} //js - -#ifdef JSGC_TESTPILOT -typedef JSRuntime::GCData GCData; - -JS_PUBLIC_API(bool) -JS_GetGCInfoEnabled(JSRuntime *rt) -{ - return rt->gcData.infoEnabled; -} - -JS_PUBLIC_API(void) -JS_SetGCInfoEnabled(JSRuntime *rt, bool enabled) -{ - rt->gcData.infoEnabled = enabled; -} - -JS_PUBLIC_API(JSGCInfo *) -JS_GCInfoFront(JSRuntime *rt) -{ - GCData &data = rt->gcData; - JS_ASSERT(data.infoEnabled); - if (!data.count) - return NULL; - - return &data.info[data.start]; -} - -JS_PUBLIC_API(bool) -JS_GCInfoPopFront(JSRuntime *rt) -{ - GCData &data = rt->gcData; - JS_ASSERT(data.infoEnabled); - JS_ASSERT(data.count); - - if (data.count >= GCData::INFO_LIMIT) { - data.count = data.start = 0; - return true; - } - - data.start = (data.start + 1) % GCData::INFO_LIMIT; - data.count -= 1; - return false; -} -#endif - - -namespace js { #ifdef JS_DUMP_CONSERVATIVE_GC_ROOTS void @@ -153,7 +105,7 @@ GCMarker::dumpConservativeRoots() for (void **thingp = conservativeRoots.begin(); thingp != conservativeRoots.end(); ++thingp) { void *thing = thingp; fprintf(fp, " %p: ", thing); - + switch (GetGCThingTraceKind(thing)) { case JSTRACE_OBJECT: { JSObject *obj = (JSObject *) thing; @@ -200,143 +152,4 @@ GCMarker::dumpConservativeRoots() } #endif /* JS_DUMP_CONSERVATIVE_GC_ROOTS */ -#if defined(MOZ_GCTIMER) || defined(JSGC_TESTPILOT) - -volatile GCTimer::JSGCReason gcReason = GCTimer::NOREASON; -const char *gcReasons[] = {" API", "Maybe", "LastC", "DestC", "Compa", "LastD", - "Malloc", "Refill", "Chunk", "Shape", " None"}; - -jsrefcount newChunkCount = 0; -jsrefcount destroyChunkCount = 0; - -#ifdef MOZ_GCTIMER -static const char *gcTimerStatPath = NULL; -#endif - -GCTimer::GCTimer(JSRuntime *rt, JSCompartment *comp) - : rt(rt), isCompartmental(comp), - enabled(rt->gcData.isTimerEnabled()) -{ -#ifdef MOZ_GCTIMER - if (!gcTimerStatPath) { - gcTimerStatPath = getenv("MOZ_GCTIMER"); - if (!gcTimerStatPath || !gcTimerStatPath[0]) - gcTimerStatPath = "gcTimer.dat"; - } - if (!strcmp(gcTimerStatPath, "none")) - enabled = false; -#endif - clearTimestamps(); - getFirstEnter(); - enter = PRMJ_Now(); -} - -uint64 -GCTimer::getFirstEnter() -{ - JSRuntime::GCData &data = rt->gcData; - if (enabled && !data.firstEnterValid) - data.setFirstEnter(PRMJ_Now()); - - return data.firstEnter; -} - -#define TIMEDIFF(start, end) ((double)(end - start) / PRMJ_USEC_PER_MSEC) - -void -GCTimer::finish(bool lastGC) -{ -#if defined(JSGC_TESTPILOT) - if (!enabled) { - newChunkCount = 0; - destroyChunkCount = 0; - return; - } -#endif - end = PRMJ_Now(); - - if (startMark > 0) { - double appTime = TIMEDIFF(getFirstEnter(), enter); - double gcTime = TIMEDIFF(enter, end); - double waitTime = TIMEDIFF(enter, startMark); - double markTime = TIMEDIFF(startMark, startSweep); - double sweepTime = TIMEDIFF(startSweep, sweepDestroyEnd); - double sweepObjTime = TIMEDIFF(startSweep, sweepObjectEnd); - double sweepStringTime = TIMEDIFF(sweepObjectEnd, sweepStringEnd); - double sweepScriptTime = TIMEDIFF(sweepStringEnd, sweepScriptEnd); - double sweepShapeTime = TIMEDIFF(sweepScriptEnd, sweepShapeEnd); - double destroyTime = TIMEDIFF(sweepShapeEnd, sweepDestroyEnd); - double endTime = TIMEDIFF(sweepDestroyEnd, end); - -#if defined(JSGC_TESTPILOT) - GCData &data = rt->gcData; - size_t oldLimit = (data.start + data.count) % GCData::INFO_LIMIT; - data.count += 1; - - JSGCInfo &info = data.info[oldLimit]; - info.appTime = appTime; - info.gcTime = gcTime; - info.waitTime = waitTime; - info.markTime = markTime; - info.sweepTime = sweepTime; - info.sweepObjTime = sweepObjTime; - info.sweepStringTime = sweepStringTime; - info.sweepScriptTime = sweepScriptTime; - info.sweepShapeTime = sweepShapeTime; - info.destroyTime = destroyTime; - info.endTime = endTime; - info.isCompartmental = isCompartmental; -#endif - -#if defined(MOZ_GCTIMER) - static FILE *gcFile; - static bool fullFormat; - - if (!gcFile) { - if (!strcmp(gcTimerStatPath, "stdout")) { - gcFile = stdout; - fullFormat = false; - } else if (!strcmp(gcTimerStatPath, "stderr")) { - gcFile = stderr; - fullFormat = false; - } else { - gcFile = fopen(gcTimerStatPath, "a"); - JS_ASSERT(gcFile); - fullFormat = true; - fprintf(gcFile, " AppTime, Total, Wait, Mark, Sweep, FinObj," - " FinStr, SwScripts, SwShapes, Destroy, End, +Chu, -Chu, T, Reason\n"); - } - } - - if (!fullFormat) { - fprintf(stderr, "%f %f %f\n", - TIMEDIFF(enter, end), - TIMEDIFF(startMark, startSweep), - TIMEDIFF(startSweep, sweepDestroyEnd)); - } else { - /* App , Tot , Wai , Mar , Swe , FiO , FiS , SwScr , SwS , Des , End */ - fprintf(gcFile, "%12.0f, %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, %8.1f, %6.1f, %6.1f, ", - appTime, gcTime, waitTime, markTime, sweepTime, sweepObjTime, sweepStringTime, - sweepScriptTime, sweepShapeTime, destroyTime, endTime); - fprintf(gcFile, "%4d, %4d,", newChunkCount, destroyChunkCount); - fprintf(gcFile, " %s, %s\n", isCompartmental ? "C" : "G", gcReasons[gcReason]); - } - fflush(gcFile); - - if (lastGC && gcFile != stdout && gcFile != stderr) - fclose(gcFile); -#endif - } - newChunkCount = 0; - destroyChunkCount = 0; - gcReason = NOREASON; -} - -#undef TIMEDIFF - -#endif - -} //js - -#undef UL -#undef PERCENT +} /* namespace js */ diff --git a/js/src/jsgcstats.h b/js/src/jsgcstats.h index 1c69a106786..0dfb0f08a51 100644 --- a/js/src/jsgcstats.h +++ b/js/src/jsgcstats.h @@ -43,49 +43,6 @@ # define JS_DUMP_CONSERVATIVE_GC_ROOTS 1 #endif -#ifdef JSGC_TESTPILOT -JS_BEGIN_EXTERN_C - -struct JSGCInfo -{ - double appTime, gcTime, waitTime, markTime, sweepTime; - double sweepObjTime, sweepStringTime, sweepScriptTime, sweepShapeTime; - double destroyTime, endTime; - bool isCompartmental; -}; - -extern JS_PUBLIC_API(void) -JS_SetGCInfoEnabled(JSRuntime *rt, bool enabled); - -extern JS_PUBLIC_API(bool) -JS_GetGCInfoEnabled(JSRuntime *rt); - -/* - * Data in the circular buffer may end up clobbered before the API client - * consumes it. Because of this we have a multi-part API. The client uses code - * like the following: - * - * - Call GetInfo, which provides an info pointer. - * - Read data out of the info pointer to a location the client owns. - * - Call PopInfo, which provides a "did info get dropped?" value. If that - * value is true, the data read out of the info pointer may be tainted, and - * must be thrown out. Otherwise, the data was definitely safe to read, and - * may be committed to a database or some such. - * - * When PopInfo indicates that data has been dropped, all of the information in - * the circular buffer is reset. - */ - -extern JS_PUBLIC_API(JSGCInfo *) -JS_GCInfoFront(JSRuntime *rt); - -/* Return whether info has dropped. See comment above. */ -extern JS_PUBLIC_API(bool) -JS_GCInfoPopFront(JSRuntime *rt); - -JS_END_EXTERN_C -#endif - namespace js { namespace gc { /* @@ -121,79 +78,6 @@ struct ConservativeGCStats } //gc -#if defined(MOZ_GCTIMER) || defined(JSGC_TESTPILOT) - -extern jsrefcount newChunkCount; -extern jsrefcount destroyChunkCount; - -struct GCTimer -{ - JSRuntime *rt; - - uint64 enter; - uint64 startMark; - uint64 startSweep; - uint64 sweepObjectEnd; - uint64 sweepStringEnd; - uint64 sweepScriptEnd; - uint64 sweepShapeEnd; - uint64 sweepDestroyEnd; - uint64 end; - - bool isCompartmental; - bool enabled; /* Disabled timers should cause no PRMJ calls. */ - - GCTimer(JSRuntime *rt, JSCompartment *comp); - - uint64 getFirstEnter(); - - void clearTimestamps() { - memset(&enter, 0, &end - &enter + sizeof(end)); - } - - void finish(bool lastGC); - - enum JSGCReason { - PUBLIC_API, - MAYBEGC, - LASTCONTEXT, - DESTROYCONTEXT, - COMPARTMENT, - LASTDITCH, - TOOMUCHMALLOC, - ALLOCTRIGGER, - REFILL, - SHAPE, - NOREASON - }; -}; - -/* We accept the possiblility of races for this variable. */ -extern volatile GCTimer::JSGCReason gcReason; - -#define GCREASON(x) ((gcReason == GCTimer::NOREASON) ? gcReason = GCTimer::x : gcReason = gcReason) - -# define GCTIMER_PARAM , GCTimer &gcTimer -# define GCTIMER_ARG , gcTimer -# define GCTIMESTAMP(stamp_name_) \ - JS_BEGIN_MACRO \ - if (gcTimer.enabled) \ - gcTimer.stamp_name_ = PRMJ_Now(); \ - JS_END_MACRO -# define GCTIMER_BEGIN(rt, comp) GCTimer gcTimer(rt, comp) -# define GCTIMER_END(last) (gcTimer.finish(last)) -#else -# define GCREASON(x) ((void) 0) -# define GCTIMER_PARAM -# define GCTIMER_ARG -# define GCTIMESTAMP(x) ((void) 0) -# define GCTIMER_BEGIN(rt, comp) ((void) 0) -# define GCTIMER_END(last) ((void) 0) -#endif - } //js -extern JS_FRIEND_API(void) -js_DumpGCStats(JSRuntime *rt, FILE *fp); - #endif /* jsgcstats_h__ */ diff --git a/js/src/jsscope.cpp b/js/src/jsscope.cpp index 9658841e337..2eb94c23ac9 100644 --- a/js/src/jsscope.cpp +++ b/js/src/jsscope.cpp @@ -87,8 +87,7 @@ js_GenerateShape(JSRuntime *rt) #ifdef JS_THREADSAFE AutoLockGC lockIf(rt); #endif - GCREASON(SHAPE); - TriggerGC(rt); + TriggerGC(rt, gcstats::SHAPE); } return shape; } From 956b988318df7eb15136b0077912771fce56d00c Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 11 Oct 2011 11:25:02 -0700 Subject: [PATCH 21/57] Bug 693712 - fix --enable-dtrace build by including appropriate headers in jsprobes.h (r=billm) --- js/src/Makefile.in | 1 - js/src/jsobjinlines.h | 1 - js/src/jsprobes.h | 2 ++ 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/Makefile.in b/js/src/Makefile.in index cc6d8a69fc1..80a62ea4da1 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -209,7 +209,6 @@ INSTALLED_HEADERS = \ jsotypes.h \ jsproxy.h \ jsprf.h \ - jsprobes.h \ jspropertycache.h \ jspropertytree.h \ jsproto.tbl \ diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index 50324a422b5..a2ad4b97c39 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -71,7 +71,6 @@ #include "jsatominlines.h" #include "jsfuninlines.h" #include "jsgcinlines.h" -#include "jsprobes.h" #include "jsscopeinlines.h" inline bool diff --git a/js/src/jsprobes.h b/js/src/jsprobes.h index 47ae8658b67..d6b79a1fc69 100644 --- a/js/src/jsprobes.h +++ b/js/src/jsprobes.h @@ -45,6 +45,8 @@ #endif #include "jspubtd.h" #include "jsprvtd.h" +#include "jsscript.h" +#include "jsobj.h" namespace js { From 978be36690eb9a74b2d8e982f7abe9574a716874 Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Tue, 11 Oct 2011 12:03:17 -0700 Subject: [PATCH 22/57] Bug 692536 - Prevent sending mousemove events if preventDefault is called on touchevents. r=mbrubeck --- mobile/chrome/content/browser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index a324212b242..2b77c7cbe9f 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -1978,7 +1978,8 @@ const ContentTouchHandler = { }, tapOver: function tapOver(aX, aY) { - this._dispatchMouseEvent("Browser:MouseOver", aX, aY); + if (!this.clickPrevented) + this._dispatchMouseEvent("Browser:MouseOver", aX, aY); }, tapUp: function tapUp(aX, aY) { From d33f3a2246804e67b7170ce2b33778156e246bf7 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 26 Sep 2011 20:45:25 -0400 Subject: [PATCH 23/57] Bug 689397 - Work around the broken-ness of gcc4.2 on Mac which causes the protection implemented in bug 666414 not take effect; r=bsmedberg --- content/xslt/src/xslt/txStylesheetCompiler.h | 4 ++-- xpcom/glue/nsCOMPtr.h | 13 ++++++++++--- xpcom/glue/nsISupportsImpl.h | 7 +++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/content/xslt/src/xslt/txStylesheetCompiler.h b/content/xslt/src/xslt/txStylesheetCompiler.h index d2d3f99c622..475ac23f2f2 100644 --- a/content/xslt/src/xslt/txStylesheetCompiler.h +++ b/content/xslt/src/xslt/txStylesheetCompiler.h @@ -77,8 +77,8 @@ public: class txACompileObserver { public: - virtual void AddRef() = 0; - virtual void Release() = 0; + NS_IMETHOD_(nsrefcnt) AddRef() = 0; + NS_IMETHOD_(nsrefcnt) Release() = 0; virtual nsresult loadURI(const nsAString& aUri, const nsAString& aReferrerUri, diff --git a/xpcom/glue/nsCOMPtr.h b/xpcom/glue/nsCOMPtr.h index 216c22a0304..a4ddd7eb022 100644 --- a/xpcom/glue/nsCOMPtr.h +++ b/xpcom/glue/nsCOMPtr.h @@ -443,9 +443,16 @@ nsCOMPtr_base */ { private: - using T::AddRef; - using T::Release; - + NS_METHOD_(nsrefcnt) AddRef(); + NS_METHOD_(nsrefcnt) Release(); + //using T::AddRef; + //using T::Release; + /* + We could use |using| above, except that gcc 4.2 on Mac has a bug + which causes |using| be unable to make the function private in + templated derived classes (see bug 689397). + */ + ~nsDerivedSafe(); // NOT TO BE IMPLEMENTED /* This dtor is added to make this class compatible with GCC 4.6. diff --git a/xpcom/glue/nsISupportsImpl.h b/xpcom/glue/nsISupportsImpl.h index 1a265ecd285..68889971a5e 100644 --- a/xpcom/glue/nsISupportsImpl.h +++ b/xpcom/glue/nsISupportsImpl.h @@ -326,13 +326,14 @@ public: */ #define NS_INLINE_DECL_REFCOUNTING(_class) \ public: \ - void AddRef(void) { \ + NS_METHOD_(nsrefcnt) AddRef(void) { \ NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \ NS_ASSERT_OWNINGTHREAD_AND_NOT_CCTHREAD(_class); \ ++mRefCnt; \ NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \ + return mRefCnt; \ } \ - void Release(void) { \ + NS_METHOD_(nsrefcnt) Release(void) { \ NS_PRECONDITION(0 != mRefCnt, "dup release"); \ NS_ASSERT_OWNINGTHREAD_AND_NOT_CCTHREAD(_class); \ --mRefCnt; \ @@ -341,7 +342,9 @@ public: \ NS_ASSERT_OWNINGTHREAD(_class); \ mRefCnt = 1; /* stabilize */ \ delete this; \ + return 0; \ } \ + return mRefCnt; \ } \ protected: \ nsAutoRefCnt mRefCnt; \ From 53b53ebd9e5533a981ba294ebbaf9b397649375c Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 11 Oct 2011 22:05:08 +0100 Subject: [PATCH 24/57] Bug 693191 - Unblacklist D3D9 layers on NVIDIA 6200 device ID 0221; r=bjacob --- widget/src/windows/GfxInfo.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/widget/src/windows/GfxInfo.cpp b/widget/src/windows/GfxInfo.cpp index 24fdcee179d..86e574390d8 100644 --- a/widget/src/windows/GfxInfo.cpp +++ b/widget/src/windows/GfxInfo.cpp @@ -822,7 +822,6 @@ static const PRUint32 deviceFamilyNvidiaBlockD3D9Layers[] = { 0x0167, /* NV43 [GeForce Go 6200/6400 (TM)] */ 0x0168, /* NV43 [GeForce Go 6200/6400 (TM)] */ 0x0169, /* NV44 [GeForce 6250 (TM)] */ - 0x0221, /* NV44A [GeForce 6200 (TM)] */ 0x0222, /* NV44 [GeForce 6200 A-LE (TM)] */ 0x0240, /* C51PV [GeForce 6150 (TM)] */ 0x0241, /* C51 [GeForce 6150 LE (TM)] */ From a9ab4a68e2dc8888c86218ae63279454a5680dc2 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 11 Oct 2011 17:29:12 -0400 Subject: [PATCH 25/57] Bug 682088. Allow arbitrary CSS colors as values of the various color preferences. r=dbaron --- layout/base/nsPresContext.cpp | 37 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index a72cdd2753b..8be6ae60b9f 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -118,20 +118,23 @@ //needed for resetting of image service color #include "nsLayoutCID.h" +#include "nsCSSParser.h" + using namespace mozilla; using namespace mozilla::dom; static nscolor -MakeColorPref(const nsCString& aColor) +MakeColorPref(const nsString& aColor) { - PRUint32 red, green, blue; - nscolor colorref; - - // 4.x stored RGB color values as a string rather than as an int, - // thus we need to do this conversion - PR_sscanf(aColor.get(), "#%02x%02x%02x", &red, &green, &blue); - colorref = NS_RGB(red, green, blue); - return colorref; + nscolor color; + nsCSSParser parser; + nsresult rv = + parser.ParseColorString(aColor, nsnull, 0, &color); + if (NS_FAILED(rv)) { + // Any better choices? + color = NS_RGB(0, 0, 0); + } + return color; } int @@ -601,14 +604,14 @@ nsPresContext::GetDocumentColorPreferences() } if (usePrefColors) { - nsAdoptingCString colorStr = - Preferences::GetCString("browser.display.foreground_color"); + nsAdoptingString colorStr = + Preferences::GetString("browser.display.foreground_color"); if (!colorStr.IsEmpty()) { mDefaultColor = MakeColorPref(colorStr); } - colorStr = Preferences::GetCString("browser.display.background_color"); + colorStr = Preferences::GetString("browser.display.background_color"); if (!colorStr.IsEmpty()) { mBackgroundColor = MakeColorPref(colorStr); @@ -656,19 +659,19 @@ nsPresContext::GetUserPreferences() mUnderlineLinks = Preferences::GetBool("browser.underline_anchors", mUnderlineLinks); - nsAdoptingCString colorStr = Preferences::GetCString("browser.anchor_color"); + nsAdoptingString colorStr = Preferences::GetString("browser.anchor_color"); if (!colorStr.IsEmpty()) { mLinkColor = MakeColorPref(colorStr); } - colorStr = Preferences::GetCString("browser.active_color"); + colorStr = Preferences::GetString("browser.active_color"); if (!colorStr.IsEmpty()) { mActiveLinkColor = MakeColorPref(colorStr); } - colorStr = Preferences::GetCString("browser.visited_color"); + colorStr = Preferences::GetString("browser.visited_color"); if (!colorStr.IsEmpty()) { mVisitedLinkColor = MakeColorPref(colorStr); @@ -680,13 +683,13 @@ nsPresContext::GetUserPreferences() mFocusTextColor = mDefaultColor; mFocusBackgroundColor = mBackgroundColor; - colorStr = Preferences::GetCString("browser.display.focus_text_color"); + colorStr = Preferences::GetString("browser.display.focus_text_color"); if (!colorStr.IsEmpty()) { mFocusTextColor = MakeColorPref(colorStr); } - colorStr = Preferences::GetCString("browser.display.focus_background_color"); + colorStr = Preferences::GetString("browser.display.focus_background_color"); if (!colorStr.IsEmpty()) { mFocusBackgroundColor = MakeColorPref(colorStr); From b37e1f1245f96ad4ab374f37f4783d981b50c54c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 11 Oct 2011 17:29:12 -0400 Subject: [PATCH 26/57] Bug 690056. Implement a vendor-prefixed version of the visibility API. r=sicking The idea is to fire the visibilitychange event synchronously during pageshow and pagehide, since we're already running script there for the pageshow/pagehide events. For docshell active state changes, we fire the event asynchronously. In all cases, the actual state changes just before the event fires. --- content/base/public/nsIDocument.h | 12 +- content/base/src/nsDocument.cpp | 71 +++++++++ content/base/src/nsDocument.h | 16 ++ content/base/test/Makefile.in | 1 + content/base/test/test_bug690056.html | 54 +++++++ docshell/base/nsDocShell.cpp | 4 + docshell/test/chrome/Makefile.in | 2 + docshell/test/chrome/bug690056_window.xul | 176 +++++++++++++++++++++ docshell/test/chrome/docshell_helpers.js | 27 +++- docshell/test/chrome/test_bug690056.xul | 26 +++ dom/base/nsPIDOMWindow.h | 8 + dom/interfaces/core/nsIDOMDocument.idl | 8 +- dom/interfaces/core/nsIDOMXMLDocument.idl | 2 +- dom/interfaces/html/nsIDOMHTMLDocument.idl | 2 +- dom/interfaces/svg/nsIDOMSVGDocument.idl | 2 +- 15 files changed, 401 insertions(+), 10 deletions(-) create mode 100644 content/base/test/test_bug690056.html create mode 100644 docshell/test/chrome/bug690056_window.xul create mode 100644 docshell/test/chrome/test_bug690056.xul diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index adfa5f47de6..089ca57acc7 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -126,8 +126,8 @@ class Element; } // namespace mozilla #define NS_IDOCUMENT_IID \ -{ 0xd76bcf5f, 0xd02f, 0x459a, \ - { 0xb1, 0x23, 0x8e, 0x2c, 0x9a, 0x0d, 0x84, 0x68 } } +{ 0x448c396a, 0x013c, 0x47b8, \ + { 0x95, 0xf4, 0x56, 0x68, 0x0f, 0x5f, 0x12, 0xf8 } } // Flag for AddStyleSheet(). #define NS_STYLESHEET_FROM_CATALOG (1 << 0) @@ -1321,17 +1321,17 @@ public: * OnPageShow() having been called already and OnPageHide() not having been * called yet. */ - bool IsShowing() { return mIsShowing; } + bool IsShowing() const { return mIsShowing; } /** * Return whether the document is currently visible (in the sense of * OnPageHide having been called and OnPageShow not yet having been called) */ - bool IsVisible() { return mVisible; } + bool IsVisible() const { return mVisible; } /** * Return true when this document is active, i.e., the active document * in a content viewer. */ - bool IsActive() { return mDocumentContainer && !mRemovedFromDocShell; } + bool IsActive() const { return mDocumentContainer && !mRemovedFromDocShell; } void RegisterFreezableElement(nsIContent* aContent); bool UnregisterFreezableElement(nsIContent* aContent); @@ -1573,6 +1573,8 @@ public: #undef DEPRECATED_OPERATION void WarnOnceAbout(DeprecatedOperations aOperation); + virtual void PostVisibilityUpdateEvent() = 0; + private: PRUint64 mWarnedAbout; diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 86ae7b03737..4f90b4e66a3 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1526,6 +1526,7 @@ nsDocument::nsDocument(const char* aContentType) : nsIDocument() , mAnimatingImages(PR_TRUE) , mIsFullScreen(PR_FALSE) + , mVisibilityState(eHidden) { SetContentTypeInternal(nsDependentCString(aContentType)); @@ -3837,6 +3838,13 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject) // having to QI every time it's asked for. nsCOMPtr window = do_QueryInterface(mScriptGlobalObject); mWindow = window; + + // Set our visibility state, but do not fire the event. This is correct + // because either we're coming out of bfcache (in which case IsVisible() will + // still test false at this point and no state change will happen) or we're + // doing the initial document load and don't want to fire the event for this + // change. + mVisibilityState = GetVisibilityState(); } nsIScriptGlobalObject* @@ -7322,6 +7330,8 @@ nsDocument::OnPageShow(bool aPersisted, SetImagesNeedAnimating(PR_TRUE); } + UpdateVisibilityState(); + nsCOMPtr target = aDispatchStartTarget; if (!target) { target = do_QueryInterface(GetWindow()); @@ -7383,6 +7393,9 @@ nsDocument::OnPageHide(bool aPersisted, DispatchPageTransition(target, NS_LITERAL_STRING("pagehide"), aPersisted); mVisible = PR_FALSE; + + UpdateVisibilityState(); + EnumerateExternalResources(NotifyPageHide, &aPersisted); EnumerateFreezableElements(NotifyActivityChanged, nsnull); } @@ -8658,3 +8671,61 @@ nsDocument::SizeOf() const #undef DOCUMENT_ONLY_EVENT #undef TOUCH_EVENT #undef EVENT + +void +nsDocument::UpdateVisibilityState() +{ + VisibilityState oldState = mVisibilityState; + mVisibilityState = GetVisibilityState(); + if (oldState != mVisibilityState) { + nsContentUtils::DispatchTrustedEvent(this, static_cast(this), + NS_LITERAL_STRING("mozvisibilitychange"), + false, false); + } +} + +nsDocument::VisibilityState +nsDocument::GetVisibilityState() const +{ + // We have to check a few pieces of information here: + // 1) Are we in bfcache (!IsVisible())? If so, nothing else matters. + // 2) Do we have an outer window? If not, we're hidden. Note that we don't + // want to use GetWindow here because it does weird groveling for windows + // in some cases. + // 3) Is our outer window background? If so, we're hidden. + // Otherwise, we're visible. + if (!IsVisible() || !mWindow || !mWindow->GetOuterWindow() || + mWindow->GetOuterWindow()->IsBackground()) { + return eHidden; + } + + return eVisible; +} + +/* virtual */ void +nsDocument::PostVisibilityUpdateEvent() +{ + nsCOMPtr event = + NS_NewRunnableMethod(this, &nsDocument::UpdateVisibilityState); + NS_DispatchToMainThread(event); +} + +NS_IMETHODIMP +nsDocument::GetMozHidden(bool* aHidden) +{ + *aHidden = mVisibilityState != eVisible; + return NS_OK; +} + +NS_IMETHODIMP +nsDocument::GetMozVisibilityState(nsAString& aState) +{ + // This needs to stay in sync with the VisibilityState enum. + static const char states[][8] = { + "hidden", + "visible" + }; + PR_STATIC_ASSERT(NS_ARRAY_LENGTH(states) == eVisibilityStateCount); + aState.AssignASCII(states[mVisibilityState]); + return NS_OK; +} diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index e8e7c095c85..637bacc755b 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -948,6 +948,12 @@ public: virtual void UpdateFullScreenStatus(bool aIsFullScreen); virtual bool IsFullScreenDoc(); + // This method may fire a DOM event; if it does so it will happen + // synchronously. + void UpdateVisibilityState(); + // Posts an event to call UpdateVisibilityState + virtual void PostVisibilityUpdateEvent(); + protected: friend class nsNodeUtils; @@ -1150,6 +1156,14 @@ protected: nsRefPtr mTiming; private: friend class nsUnblockOnloadEvent; + // This needs to stay in sync with the list in GetMozVisibilityState. + enum VisibilityState { + eHidden = 0, + eVisible, + eVisibilityStateCount + }; + // Recomputes the visibility state but doesn't set the new value. + VisibilityState GetVisibilityState() const; void PostUnblockOnloadEvent(); void DoUnblockOnload(); @@ -1230,6 +1244,8 @@ private: // Tracking for images in the document. nsDataHashtable< nsPtrHashKey, PRUint32> mImageTracker; + VisibilityState mVisibilityState; + #ifdef DEBUG protected: bool mWillReparent; diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index bea950a208d..d98ca83be03 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -516,6 +516,7 @@ _TEST_FILES2 = \ test_bug684671.html \ test_bug685798.html \ test_bug686449.xhtml \ + test_bug690056.html \ test_bug692434.html \ file_bug692434.xml \ $(NULL) diff --git a/content/base/test/test_bug690056.html b/content/base/test/test_bug690056.html new file mode 100644 index 00000000000..4911764b714 --- /dev/null +++ b/content/base/test/test_bug690056.html @@ -0,0 +1,54 @@ + + + + + Test for Bug 690056 + + + + +Mozilla Bug 690056 +

+ + +

+ +
+
+
+ + diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 81fb5db7f16..cc0be8c85d9 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -4882,6 +4882,10 @@ nsDocShell::SetIsActive(bool aIsActive) nsCOMPtr win = do_QueryInterface(mScriptGlobal); if (win) { win->SetIsBackground(!aIsActive); + nsCOMPtr doc = do_QueryInterface(win->GetExtantDocument()); + if (doc) { + doc->PostVisibilityUpdateEvent(); + } } // Recursively tell all of our children diff --git a/docshell/test/chrome/Makefile.in b/docshell/test/chrome/Makefile.in index 825e6598ad9..b92291c281f 100644 --- a/docshell/test/chrome/Makefile.in +++ b/docshell/test/chrome/Makefile.in @@ -120,6 +120,8 @@ _TEST_FILES = \ 662200a.html \ 662200b.html \ 662200c.html \ + test_bug690056.xul \ + bug690056_window.xul \ $(NULL) _DOCSHELL_SUBHARNESS = \ diff --git a/docshell/test/chrome/bug690056_window.xul b/docshell/test/chrome/bug690056_window.xul new file mode 100644 index 00000000000..d81040789af --- /dev/null +++ b/docshell/test/chrome/bug690056_window.xul @@ -0,0 +1,176 @@ + + + + + + + + + \ No newline at end of file diff --git a/docshell/test/chrome/docshell_helpers.js b/docshell/test/chrome/docshell_helpers.js index 172cf7a025b..0c078efa687 100755 --- a/docshell/test/chrome/docshell_helpers.js +++ b/docshell/test/chrome/docshell_helpers.js @@ -18,6 +18,8 @@ const NAV_RELOAD = 4; var gExpectedEvents; // an array of events which are expected to // be triggered by this navigation +var gUnexpectedEvents; // an array of event names which are NOT expected + // to be triggered by this navigation var gFinalEvent; // true if the last expected event has fired var gUrisNotInBFCache = []; // an array of uri's which shouldn't be stored // in the bfcache @@ -95,6 +97,8 @@ function doPageNavigation(params) { params.eventsToListenFor : ["pageshow"]; gExpectedEvents = typeof(params.eventsToListenFor) == "undefined" || eventsToListenFor.length == 0 ? undefined : params.expectedEvents; + gUnexpectedEvents = typeof(params.eventsToListenFor) == "undefined" || + eventsToListenFor.length == 0 ? undefined : params.unexpectedEvents; let preventBFCache = (typeof[params.preventBFCache] == "undefined") ? false : params.preventBFCache; let waitOnly = (typeof(params.waitForEventsOnly) == "boolean" @@ -129,6 +133,10 @@ function doPageNavigation(params) { if (anExpectedEvent.type == anEventType) eventFound = true; } + for each (let anExpectedEventType in gUnexpectedEvents) { + if (anExpectedEventType == anEventType) + eventFound = true; + } if (!eventFound) throw "Event type " + anEventType + " is specified in " + "eventsToListenFor, but not in expectedEvents"; @@ -260,7 +268,12 @@ function pageEventListener(event) { "though it was loaded with .preventBFCache previously\n"); } } - + + if (typeof(gUnexpectedEvents) != "undefined") { + is(gUnexpectedEvents.indexOf(event.type), -1, + "Should not get unexpected event " + event.type); + } + // If no expected events were specified, mark the final event as having been // triggered when a pageshow event is fired; this will allow // doPageNavigation() to return. @@ -301,6 +314,18 @@ function pageEventListener(event) { event.originalTarget.location + " had an unexpected value"); } + if ("visibilityState" in expected) { + is(event.originalTarget.mozVisibilityState, expected.visibilityState, + "The visibilityState property of the document on page " + + event.originalTarget.location + " had an unexpected value"); + } + + if ("hidden" in expected) { + is(event.originalTarget.mozHidden, expected.hidden, + "The hidden property of the document on page " + + event.originalTarget.location + " had an unexpected value"); + } + // If we're out of expected events, let doPageNavigation() return. if (gExpectedEvents.length == 0) setTimeout(function() { gFinalEvent = true; }, 0); diff --git a/docshell/test/chrome/test_bug690056.xul b/docshell/test/chrome/test_bug690056.xul new file mode 100644 index 00000000000..caeed09d3cc --- /dev/null +++ b/docshell/test/chrome/test_bug690056.xul @@ -0,0 +1,26 @@ + + + + + + + diff --git a/dom/base/nsPIDOMWindow.h b/dom/base/nsPIDOMWindow.h index f3d6606f5a7..669b21f51be 100644 --- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -97,21 +97,29 @@ public: virtual void SetActive(bool aActive) { + NS_PRECONDITION(IsOuterWindow(), + "active state is only maintained on outer windows"); mIsActive = aActive; } bool IsActive() { + NS_PRECONDITION(IsOuterWindow(), + "active state is only maintained on outer windows"); return mIsActive; } virtual void SetIsBackground(bool aIsBackground) { + NS_PRECONDITION(IsOuterWindow(), + "background state is only maintained on outer windows"); mIsBackground = aIsBackground; } bool IsBackground() { + NS_PRECONDITION(IsOuterWindow(), + "background state is only maintained on outer windows"); return mIsBackground; } diff --git a/dom/interfaces/core/nsIDOMDocument.idl b/dom/interfaces/core/nsIDOMDocument.idl index 40c03e294f9..7c0c21346b5 100644 --- a/dom/interfaces/core/nsIDOMDocument.idl +++ b/dom/interfaces/core/nsIDOMDocument.idl @@ -66,7 +66,7 @@ interface nsIDOMLocation; * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html */ -[scriptable, uuid(3f845f32-cb34-459c-8f79-2dfaa3088bbf)] +[scriptable, uuid(CD4CD7C3-C688-4E50-9A72-4A00EABE66AB)] interface nsIDOMDocument : nsIDOMNode { readonly attribute nsIDOMDocumentType doctype; @@ -411,4 +411,10 @@ interface nsIDOMDocument : nsIDOMNode [implicit_jscontext] attribute jsval onmouseenter; [implicit_jscontext] attribute jsval onmouseleave; + + /** + * Visibility API implementation. + */ + readonly attribute boolean mozHidden; + readonly attribute DOMString mozVisibilityState; }; diff --git a/dom/interfaces/core/nsIDOMXMLDocument.idl b/dom/interfaces/core/nsIDOMXMLDocument.idl index 1427479b772..7793eef4746 100644 --- a/dom/interfaces/core/nsIDOMXMLDocument.idl +++ b/dom/interfaces/core/nsIDOMXMLDocument.idl @@ -38,7 +38,7 @@ #include "nsIDOMDocument.idl" -[scriptable, uuid(9f566fd8-8bd7-49eb-be8b-16fb50d00d32)] +[scriptable, uuid(BB4D4D76-3802-4191-88E2-933BA609C4E1)] interface nsIDOMXMLDocument : nsIDOMDocument { // DOM Level 3 Load & Save, DocumentLS diff --git a/dom/interfaces/html/nsIDOMHTMLDocument.idl b/dom/interfaces/html/nsIDOMHTMLDocument.idl index da10493c786..c6505332bae 100644 --- a/dom/interfaces/html/nsIDOMHTMLDocument.idl +++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl @@ -47,7 +47,7 @@ */ interface nsISelection; -[scriptable, uuid(280857b8-c52c-455e-8b47-c56ad96614f7)] +[scriptable, uuid(C94A5F14-F79F-4054-A93C-E8FF35623460)] interface nsIDOMHTMLDocument : nsIDOMDocument { readonly attribute DOMString URL; diff --git a/dom/interfaces/svg/nsIDOMSVGDocument.idl b/dom/interfaces/svg/nsIDOMSVGDocument.idl index 1daaf8a836f..dc204913cf3 100644 --- a/dom/interfaces/svg/nsIDOMSVGDocument.idl +++ b/dom/interfaces/svg/nsIDOMSVGDocument.idl @@ -39,7 +39,7 @@ interface nsIDOMSVGSVGElement; -[scriptable, uuid(78ebe55f-631f-4b3b-9eba-c3689ff5ccbc)] +[scriptable, uuid(B3806DF6-7ED4-4426-84E6-545EEFE5AA9A)] interface nsIDOMSVGDocument : nsIDOMDocument { readonly attribute DOMString domain; From a7535fded8aff17b1d90f4028ac81b86a0fab815 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 11 Oct 2011 17:29:12 -0400 Subject: [PATCH 27/57] Bug 693219. Don't use TimeDuration methods from static constructors. r=roc --- layout/base/nsPresContext.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 8be6ae60b9f..a5f8605aef5 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -2155,8 +2155,9 @@ static PRUint32 sInterruptCounter; static PRUint32 sInterruptChecksToSkip = 200; // Number of milliseconds that a reflow should be allowed to run for before we // actually allow interruption. Controlled by the -// GECKO_REFLOW_MIN_NOINTERRUPT_DURATION env var. -static TimeDuration sInterruptTimeout = TimeDuration::FromMilliseconds(100); +// GECKO_REFLOW_MIN_NOINTERRUPT_DURATION env var. Can't be initialized here, +// because TimeDuration/TimeStamp is not safe to use in static constructors.. +static TimeDuration sInterruptTimeout; static void GetInterruptEnv() { @@ -2187,9 +2188,8 @@ static void GetInterruptEnv() } ev = PR_GetEnv("GECKO_REFLOW_MIN_NOINTERRUPT_DURATION"); - if (ev) { - sInterruptTimeout = TimeDuration::FromMilliseconds(atoi(ev)); - } + int duration_ms = ev ? atoi(ev) : 100; + sInterruptTimeout = TimeDuration::FromMilliseconds(duration_ms); } bool From 747a4896684f068f95fc147e0e923a41cb0d2089 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Mon, 10 Oct 2011 22:05:06 -0700 Subject: [PATCH 28/57] Add a misplaced test for bug 648471, found in an old .hg/patches directory while pruning my Mozilla tree count. r=itsatest --HG-- extra : rebase_source : 7c46baa4297335c05e71ac2e0229c06b84848d99 --- js/src/tests/ecma_5/JSON/jstests.list | 1 + ...stringify-replacer-array-boxed-elements.js | 60 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 js/src/tests/ecma_5/JSON/stringify-replacer-array-boxed-elements.js diff --git a/js/src/tests/ecma_5/JSON/jstests.list b/js/src/tests/ecma_5/JSON/jstests.list index fb9d9e760cb..daf1238056f 100644 --- a/js/src/tests/ecma_5/JSON/jstests.list +++ b/js/src/tests/ecma_5/JSON/jstests.list @@ -24,6 +24,7 @@ script stringify-missing-arguments.js script stringify-nonarray-noncallable-replacer.js script stringify-primitives.js script stringify-replacer.js +script stringify-replacer-array-boxed-elements.js script stringify-replacer-array-duplicated-element.js script stringify-replacer-array-edgecase-jsid-elements.js script stringify-replacer-array-hijinks.js diff --git a/js/src/tests/ecma_5/JSON/stringify-replacer-array-boxed-elements.js b/js/src/tests/ecma_5/JSON/stringify-replacer-array-boxed-elements.js new file mode 100644 index 00000000000..16c9b770c3d --- /dev/null +++ b/js/src/tests/ecma_5/JSON/stringify-replacer-array-boxed-elements.js @@ -0,0 +1,60 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +var gTestfile = 'stringify-replacer-array-boxed-elements.js'; +//----------------------------------------------------------------------------- +var BUGNUMBER = 648471; +var summary = "Boxed-string/number objects in replacer arrays"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +var S = new String(3); +var N = new Number(4); + +assertEq(JSON.stringify({ 3: 3, 4: 4 }, [S]), + '{"3":3}'); +assertEq(JSON.stringify({ 3: 3, 4: 4 }, [N]), + '{"4":4}'); + +Number.prototype.toString = function() { return 3; }; +assertEq(JSON.stringify({ 3: 3, 4: 4 }, [N]), + '{"3":3}'); + +String.prototype.toString = function() { return 4; }; +assertEq(JSON.stringify({ 3: 3, 4: 4 }, [S]), + '{"4":4}'); + +Number.prototype.toString = function() { return new String(42); }; +assertEq(JSON.stringify({ 3: 3, 4: 4 }, [N]), + '{"3":3}'); + +String.prototype.toString = function() { return new Number(17); }; +assertEq(JSON.stringify({ 3: 3, 4: 4 }, [S]), + '{"4":4}'); + +Number.prototype.toString = null; +assertEq(JSON.stringify({ 3: 3, 4: 4 }, [N]), + '{"4":4}'); + +String.prototype.toString = null; +assertEq(JSON.stringify({ 3: 3, 4: 4 }, [S]), + '{"3":3}'); + +Number.prototype.valueOf = function() { return 17; }; +assertEq(JSON.stringify({ 4: 4, 17: 17 }, [N]), + '{"17":17}'); + +String.prototype.valueOf = function() { return 42; }; +assertEq(JSON.stringify({ 3: 3, 42: 42 }, [S]), + '{"42":42}'); + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("Tests complete"); From bcbb00033850384afd52e85c7a81a388dc1bfbb3 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Tue, 11 Oct 2011 15:42:15 -0700 Subject: [PATCH 29/57] Bug 679509 - Make sure convert hooks in plugin code always return a non-primitive value. r=luke --HG-- extra : rebase_source : 0efa84079b3acb44b796e8542340e8fbd7e7c303 --- dom/plugins/base/nsJSNPRuntime.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index f53797e50a9..d51028356f4 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -160,9 +160,6 @@ static JSBool NPObjWrapper_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags, JSObject **objp); -static JSBool -NPObjWrapper_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp); - static void NPObjWrapper_Finalize(JSContext *cx, JSObject *obj); @@ -183,7 +180,7 @@ static JSClass sNPObjectJSWrapperClass = NPObjWrapper_AddProperty, NPObjWrapper_DelProperty, NPObjWrapper_GetProperty, NPObjWrapper_SetProperty, (JSEnumerateOp)NPObjWrapper_newEnumerate, - (JSResolveOp)NPObjWrapper_NewResolve, NPObjWrapper_Convert, + (JSResolveOp)NPObjWrapper_NewResolve, JS_ConvertStub, NPObjWrapper_Finalize, nsnull, nsnull, NPObjWrapper_Call, NPObjWrapper_Construct, nsnull, nsnull }; @@ -1683,18 +1680,6 @@ NPObjWrapper_NewResolve(JSContext *cx, JSObject *obj, jsid id, uintN flags, return JS_TRUE; } -static JSBool -NPObjWrapper_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp) -{ - // The sole reason we implement this hook is to prevent the JS - // engine from calling valueOf() on NPObject's. Some NPObject's may - // actually implement a method named valueOf, but it's unlikely to - // behave as the JS engine expects it to. IOW, this is an empty hook - // that overrides what the default hook does. - - return JS_TRUE; -} - static void NPObjWrapper_Finalize(JSContext *cx, JSObject *obj) { @@ -2195,6 +2180,9 @@ NPObjectMember_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp) case JSTYPE_BOOLEAN: case JSTYPE_OBJECT: *vp = memberPrivate->fieldValue; + if (!JSVAL_IS_PRIMITIVE(*vp)) { + return JS_ConvertStub(cx, JSVAL_TO_OBJECT(*vp), type, vp); + } return JS_TRUE; case JSTYPE_FUNCTION: // Leave this to NPObjectMember_Call. From 126648f5f36069dbf3cf7975302f875c0f8d604d Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Tue, 11 Oct 2011 09:36:18 -0700 Subject: [PATCH 30/57] Bug 679509 - Test that plugin conversion hooks properly convert to a primitive value. r=mrbkap --HG-- extra : rebase_source : 54d0eb69de7180b2b1ba361c51031ffb83c3f2ac --- dom/plugins/test/mochitest/Makefile.in | 1 + .../test/mochitest/test_defaultValue.html | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 dom/plugins/test/mochitest/test_defaultValue.html diff --git a/dom/plugins/test/mochitest/Makefile.in b/dom/plugins/test/mochitest/Makefile.in index cc1bedc03a6..5d7d2e07a02 100644 --- a/dom/plugins/test/mochitest/Makefile.in +++ b/dom/plugins/test/mochitest/Makefile.in @@ -46,6 +46,7 @@ include $(topsrcdir)/config/rules.mk _MOCHITEST_FILES = \ utils.js \ + test_defaultValue.html \ test_getauthenticationinfo.html \ test_npobject_getters.html \ test_npruntime_npnevaluate.html \ diff --git a/dom/plugins/test/mochitest/test_defaultValue.html b/dom/plugins/test/mochitest/test_defaultValue.html new file mode 100644 index 00000000000..1960cc7bdc1 --- /dev/null +++ b/dom/plugins/test/mochitest/test_defaultValue.html @@ -0,0 +1,36 @@ + + + NPObject [[DefaultValue]] implementation + + + + + + + + + + + + From ffbd27f9cb2c0fc376fa71d40d58f929ba6b30dc Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 11 Oct 2011 19:09:56 -0400 Subject: [PATCH 31/57] Bug 693323 - Explcitly instantiate the ListBase class with the template arguments that we use it with, since apparently clang doesn't see the need to instantiate it automatically; r=peterv --- js/src/xpconnect/src/dombindingsgen.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/src/xpconnect/src/dombindingsgen.py b/js/src/xpconnect/src/dombindingsgen.py index 25d87f631a1..74a964958e8 100644 --- a/js/src/xpconnect/src/dombindingsgen.py +++ b/js/src/xpconnect/src/dombindingsgen.py @@ -537,6 +537,8 @@ listTemplateFooter = ( "${methods}\n" "};\n" "\n" +"template class ListBase<${name}Class>;\n" +"\n" "JSObject*\n" "${name}::create(JSContext *cx, XPCWrappedNativeScope *scope, ${nativeClass} *list, nsWrapperCache *cache, bool *triedToWrap)\n" "{\n" From 80c2a0fd78eb0d7d10bc41a453b6593ac7ded34a Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Tue, 11 Oct 2011 17:43:25 -0700 Subject: [PATCH 32/57] Followup fixes to misplaced test for bug 648471, seems I made them in the patch in a tree I didn't push. :-\ r=orange --HG-- extra : rebase_source : cb9b119601b30fd3d66e0699f5c66bac850ec1c7 --- .../ecma_5/JSON/stringify-replacer-array-boxed-elements.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/tests/ecma_5/JSON/stringify-replacer-array-boxed-elements.js b/js/src/tests/ecma_5/JSON/stringify-replacer-array-boxed-elements.js index 16c9b770c3d..561f7009c76 100644 --- a/js/src/tests/ecma_5/JSON/stringify-replacer-array-boxed-elements.js +++ b/js/src/tests/ecma_5/JSON/stringify-replacer-array-boxed-elements.js @@ -30,11 +30,11 @@ assertEq(JSON.stringify({ 3: 3, 4: 4 }, [S]), Number.prototype.toString = function() { return new String(42); }; assertEq(JSON.stringify({ 3: 3, 4: 4 }, [N]), - '{"3":3}'); + '{"4":4}'); String.prototype.toString = function() { return new Number(17); }; assertEq(JSON.stringify({ 3: 3, 4: 4 }, [S]), - '{"4":4}'); + '{"3":3}'); Number.prototype.toString = null; assertEq(JSON.stringify({ 3: 3, 4: 4 }, [N]), From c1f4fa5c8ebb17c1486a8667f25592674bca9bba Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Tue, 11 Oct 2011 17:47:56 -0700 Subject: [PATCH 33/57] Fix an order-of-initialization warning just recently added, to move the warnings-as-errors build closer to green again. r=trivial --- js/src/jscntxt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index 95d2a0c06f2..6925e94cb02 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -1339,6 +1339,7 @@ JSContext::JSContext(JSRuntime *rt) throwing(false), exception(UndefinedValue()), runOptions(0), + reportGranularity(JS_DEFAULT_JITREPORT_GRANULARITY), localeCallbacks(NULL), resolvingList(NULL), generatingError(false), @@ -1370,7 +1371,6 @@ JSContext::JSContext(JSRuntime *rt) resolveFlags(0), rngSeed(0), iterValue(MagicValue(JS_NO_ITER_VALUE)), - reportGranularity(JS_DEFAULT_JITREPORT_GRANULARITY), #ifdef JS_TRACER traceJitEnabled(false), #endif From b68dcd1a379175dfd433935d5be5e1548dfca845 Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Tue, 11 Oct 2011 21:11:03 -0400 Subject: [PATCH 34/57] Bug 626694 - Remove unused TextureImage::IsRGB(). r=mattwoodrow --- gfx/layers/opengl/ThebesLayerOGL.cpp | 2 -- gfx/thebes/GLContext.cpp | 3 --- gfx/thebes/GLContext.h | 4 ---- gfx/thebes/GLContextProviderEGL.cpp | 3 --- 4 files changed, 12 deletions(-) diff --git a/gfx/layers/opengl/ThebesLayerOGL.cpp b/gfx/layers/opengl/ThebesLayerOGL.cpp index 97204dbf59c..181628670ee 100644 --- a/gfx/layers/opengl/ThebesLayerOGL.cpp +++ b/gfx/layers/opengl/ThebesLayerOGL.cpp @@ -147,8 +147,6 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset, if (passes == 2) { ComponentAlphaTextureLayerProgram *alphaProgram; - NS_ASSERTION(!mTexImage->IsRGB() && !mTexImageOnWhite->IsRGB(), - "Only BGR image surported with component alpha (currently!)"); if (pass == 1) { alphaProgram = aManager->GetComponentAlphaPass1LayerProgram(); gl()->fBlendFuncSeparate(LOCAL_GL_ZERO, LOCAL_GL_ONE_MINUS_SRC_COLOR, diff --git a/gfx/thebes/GLContext.cpp b/gfx/thebes/GLContext.cpp index 67df7568d0c..e3b50df766c 100644 --- a/gfx/thebes/GLContext.cpp +++ b/gfx/thebes/GLContext.cpp @@ -775,7 +775,6 @@ TiledTextureImage::DirectUpdate(gfxASurface* aSurf, const nsIntRegion& aRegion, aFrom + nsIntPoint(xPos, yPos)); } mShaderType = mImages[0]->GetShaderProgramType(); - mIsRGBFormat = mImages[0]->IsRGB(); mTextureState = Valid; return result; } @@ -888,7 +887,6 @@ TiledTextureImage::EndUpdate() mInUpdate = PR_FALSE; mTextureState = Valid; mShaderType = mImages[mCurrentImage]->GetShaderProgramType(); - mIsRGBFormat = mImages[mCurrentImage]->IsRGB(); return; } @@ -916,7 +914,6 @@ TiledTextureImage::EndUpdate() mUpdateSurface = nsnull; mInUpdate = PR_FALSE; mShaderType = mImages[0]->GetShaderProgramType(); - mIsRGBFormat = mImages[0]->IsRGB(); mTextureState = Valid; } diff --git a/gfx/thebes/GLContext.h b/gfx/thebes/GLContext.h index cf087469f39..1262ab99653 100644 --- a/gfx/thebes/GLContext.h +++ b/gfx/thebes/GLContext.h @@ -321,8 +321,6 @@ public: virtual bool InUpdate() const = 0; GLenum GetWrapMode() const { return mWrapMode; } - bool IsRGB() const { return mIsRGBFormat; } - void SetFilter(gfxPattern::GraphicsFilter aFilter) { mFilter = aFilter; } protected: @@ -340,7 +338,6 @@ protected: : mSize(aSize) , mWrapMode(aWrapMode) , mContentType(aContentType) - , mIsRGBFormat(aIsRGB) {} /** @@ -352,7 +349,6 @@ protected: nsIntSize mSize; GLenum mWrapMode; ContentType mContentType; - bool mIsRGBFormat; ShaderProgramType mShaderType; gfxPattern::GraphicsFilter mFilter; }; diff --git a/gfx/thebes/GLContextProviderEGL.cpp b/gfx/thebes/GLContextProviderEGL.cpp index aa636a990f0..18b48dfc66a 100644 --- a/gfx/thebes/GLContextProviderEGL.cpp +++ b/gfx/thebes/GLContextProviderEGL.cpp @@ -1275,9 +1275,6 @@ public: return mUpdateSurface; } - // if we get this far, then we're using Cairo's byte order - mIsRGBFormat = PR_FALSE; - //printf_stderr("creating image surface %dx%d format %d\n", mUpdateRect.width, mUpdateRect.height, mUpdateFormat); mUpdateSurface = From fef1f7c12232a89f3e276f1125606ced01e1a923 Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Tue, 11 Oct 2011 21:36:03 -0400 Subject: [PATCH 35/57] Bug 626694 - Forgot an instance of mIsRGBFormat. r=bustage --- gfx/thebes/GLContextProviderEGL.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gfx/thebes/GLContextProviderEGL.cpp b/gfx/thebes/GLContextProviderEGL.cpp index 18b48dfc66a..90cf7b79427 100644 --- a/gfx/thebes/GLContextProviderEGL.cpp +++ b/gfx/thebes/GLContextProviderEGL.cpp @@ -1207,7 +1207,7 @@ public: // for RGB24. No easy way to upload that to GL. // // Note that if we start using RGB565 here, we'll need to - // watch for a) setting mIsRGBFormat to TRUE; and b) getting + // watch for a) setting the correct format; and b) getting // the stride right. if (mUpdateFormat == gfxASurface::ImageFormatRGB24) { mUpdateFormat = gfxASurface::ImageFormatARGB32; @@ -1643,7 +1643,6 @@ public: } mBackingSurface = xsurface; - mIsRGBFormat = PR_TRUE; #endif return mBackingSurface != nsnull; From 0c94cc241a4d205d7b6932bd1af46d7516cab0d1 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Tue, 11 Oct 2011 18:41:45 -0700 Subject: [PATCH 36/57] Disable jstracer by default, bug 693815. r=dmandelin --- js/src/tests/user.js | 4 ++-- modules/libpref/src/init/all.js | 4 ++-- .../tests/fennec-tile-testapp/defaults/preferences/prefs.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/js/src/tests/user.js b/js/src/tests/user.js index 4ded6fd1a55..bd5e19c9364 100755 --- a/js/src/tests/user.js +++ b/js/src/tests/user.js @@ -27,8 +27,8 @@ user_pref("browser.cache.check_doc_frequency", 1); user_pref("extensions.checkCompatibility", false); user_pref("extensions.checkUpdateSecurity", false); user_pref("browser.EULA.override", true); -user_pref("javascript.options.tracejit.chrome", true); -user_pref("javascript.options.tracejit.content", true); +user_pref("javascript.options.tracejit.chrome", false); +user_pref("javascript.options.tracejit.content", false); user_pref("javascript.options.methodjit.chrome", true); user_pref("javascript.options.methodjit.content", true); user_pref("javascript.options.jitprofiling.chrome", true); diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 8951cce884f..3a2bc634212 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -625,8 +625,8 @@ pref("javascript.options.strict", false); pref("javascript.options.strict.debug", true); #endif pref("javascript.options.relimit", true); -pref("javascript.options.tracejit.content", true); -pref("javascript.options.tracejit.chrome", true); +pref("javascript.options.tracejit.content", false); +pref("javascript.options.tracejit.chrome", false); pref("javascript.options.methodjit.content", true); pref("javascript.options.methodjit.chrome", true); pref("javascript.options.jitprofiling.content", true); diff --git a/toolkit/content/tests/fennec-tile-testapp/defaults/preferences/prefs.js b/toolkit/content/tests/fennec-tile-testapp/defaults/preferences/prefs.js index 89d07c51991..3e3c0f592e0 100644 --- a/toolkit/content/tests/fennec-tile-testapp/defaults/preferences/prefs.js +++ b/toolkit/content/tests/fennec-tile-testapp/defaults/preferences/prefs.js @@ -1,4 +1,4 @@ pref("toolkit.defaultChromeURI", "chrome://tile/content/foo.xul"); -pref("javascript.options.tracejit.chrome", true); +pref("javascript.options.tracejit.chrome", false); pref("javascript.options.tracejit.content", false); pref("browser.dom.window.dump.enabled", true); From 89d4176e04efecd8083fa3ca8c01e19b8c048c27 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Tue, 11 Oct 2011 19:05:33 -0700 Subject: [PATCH 37/57] Don't load high bits when getting typed array lengths, bug 693144. r=dvander --- js/src/methodjit/Compiler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/methodjit/Compiler.cpp b/js/src/methodjit/Compiler.cpp index 905afedc857..5edc2247567 100644 --- a/js/src/methodjit/Compiler.cpp +++ b/js/src/methodjit/Compiler.cpp @@ -4382,8 +4382,8 @@ mjit::Compiler::jsop_getprop(JSAtom *atom, JSValueType knownType, } RegisterID reg = frame.copyDataIntoReg(top); frame.pop(); - frame.pushWord(Address(reg, TypedArray::lengthOffset()), JSVAL_TYPE_INT32); - frame.freeReg(reg); + masm.loadPayload(Address(reg, TypedArray::lengthOffset()), reg); + frame.pushTypedPayload(JSVAL_TYPE_INT32, reg); if (!isObject) stubcc.rejoin(Changes(1)); return true; From 9fdc63636add7f5ec9b13c75bc27367cd8719c12 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sun, 28 Aug 2011 23:16:37 -0700 Subject: [PATCH 38/57] Bug 682754 - date_parseISOString should tolerate a missing colon in the timezone, arr=Waldo --HG-- extra : rebase_source : 96fc6fd1c3b3a8db5d653f065da9b3c6a00f057c --- js/src/jsdate.cpp | 7 +- js/src/tests/ecma_5/extensions/15.9.4.2.js | 91 +++++++++++++++++++++ js/src/tests/ecma_5/extensions/jstests.list | 1 + 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 js/src/tests/ecma_5/extensions/15.9.4.2.js diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index a96d6ac802c..dcfdf0a90f0 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -847,7 +847,12 @@ date_parseISOString(JSLinearString *str, jsdouble *result, JSContext *cx) tzMul = -1; ++i; NEED_NDIGITS(2, tzHour); - NEED(':'); + /* + * Non-standard extension to the ISO date format (permitted by ES5): + * allow "-0700" as a time zone offset, not just "-07:00". + */ + if (PEEK(':')) + ++i; NEED_NDIGITS(2, tzMin); } else { isLocalTime = JS_TRUE; diff --git a/js/src/tests/ecma_5/extensions/15.9.4.2.js b/js/src/tests/ecma_5/extensions/15.9.4.2.js new file mode 100644 index 00000000000..eedc2a14d28 --- /dev/null +++ b/js/src/tests/ecma_5/extensions/15.9.4.2.js @@ -0,0 +1,91 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is JavaScript Engine testing utilities. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): Bruce Hoult + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 682754; + + +//----------------------------------------------------------------------------- +test(); +//----------------------------------------------------------------------------- + +function iso(d) +{ + return new Date(d).toISOString(); +} + +function check(s, millis){ + description = "Date.parse('"+s+"') == '"+iso(millis)+"'"; + expected = millis; + actual = Date.parse(s); + reportCompare(expected, actual, description); +} + +function checkInvalid(s) +{ + description = "Date.parse('"+s+"') produces invalid date"; + expected = NaN; + actual = Date.parse(s); + reportCompare(expected, actual, description); +} + +function dd(year, month, day, hour, minute, second, millis){ + return Date.UTC(year, month-1, day, hour, minute, second, millis); +} + +function TZAtDate(d){ + return d.getTimezoneOffset() * 60000; +} + +function TZInMonth(month){ + return TZAtDate(new Date(dd(2009,month,1,0,0,0,0))); +} + +function test() +{ + enterFunc ('test'); + printBugNumber(BUGNUMBER); + + JanTZ = TZInMonth(1); + JulTZ = TZInMonth(7); + CurrTZ = TZAtDate(new Date()); + + // Allow non-standard "-0700" as timezone, not just "-07:00" + check("2009-07-23T00:53:21.001-0700", dd(2009,7,23,7,53,21,1)); + + exitFunc ('test'); +} diff --git a/js/src/tests/ecma_5/extensions/jstests.list b/js/src/tests/ecma_5/extensions/jstests.list index 3f7f590dce1..442f05ea8fe 100644 --- a/js/src/tests/ecma_5/extensions/jstests.list +++ b/js/src/tests/ecma_5/extensions/jstests.list @@ -1,6 +1,7 @@ url-prefix ../../jsreftest.html?test=ecma_5/extensions/ fails-if(Android) script 8.12.5-01.js script 15.4.4.11.js +script 15.9.4.2.js script Boolean-toSource.js script Number-toSource.js script Object-keys-and-object-ids.js From 83ee122f0c6c6c84bcb72e5637f6261c2aa745d8 Mon Sep 17 00:00:00 2001 From: Gavin Sharp Date: Wed, 5 Oct 2011 08:46:47 -0700 Subject: [PATCH 39/57] Bug 692130: move tabview code and tests to browser/components/tabview; r=ttaubert --HG-- rename : browser/components/places/Makefile.in => browser/components/tabview/Makefile.in rename : browser/base/content/tabview/content.js => browser/components/tabview/content.js rename : browser/base/content/tabview/drag.js => browser/components/tabview/drag.js rename : browser/base/content/tabview/groupitems.js => browser/components/tabview/groupitems.js rename : browser/base/content/tabview/iq.js => browser/components/tabview/iq.js rename : browser/base/content/tabview/items.js => browser/components/tabview/items.js rename : browser/base/content/tabview/modules/utils.jsm => browser/components/tabview/modules/utils.jsm rename : browser/base/content/tabview/search.js => browser/components/tabview/search.js rename : browser/base/content/tabview/storage.js => browser/components/tabview/storage.js rename : browser/base/content/tabview/storagePolicy.js => browser/components/tabview/storagePolicy.js rename : browser/base/content/tabview/tabitems.js => browser/components/tabview/tabitems.js rename : browser/base/content/tabview/tabview.css => browser/components/tabview/tabview.css rename : browser/base/content/tabview/tabview.html => browser/components/tabview/tabview.html rename : browser/base/content/tabview/tabview.js => browser/components/tabview/tabview.js rename : browser/base/content/test/tabview/Makefile.in => browser/components/tabview/test/Makefile.in rename : browser/base/content/test/tabview/browser_tabview_alltabs.js => browser/components/tabview/test/browser_tabview_alltabs.js rename : browser/base/content/test/tabview/browser_tabview_apptabs.js => browser/components/tabview/test/browser_tabview_apptabs.js rename : browser/base/content/test/tabview/browser_tabview_bug580412.js => browser/components/tabview/test/browser_tabview_bug580412.js rename : browser/base/content/test/tabview/browser_tabview_bug586553.js => browser/components/tabview/test/browser_tabview_bug586553.js rename : browser/base/content/test/tabview/browser_tabview_bug587043.js => browser/components/tabview/test/browser_tabview_bug587043.js rename : browser/base/content/test/tabview/browser_tabview_bug587231.js => browser/components/tabview/test/browser_tabview_bug587231.js rename : browser/base/content/test/tabview/browser_tabview_bug587276.js => browser/components/tabview/test/browser_tabview_bug587276.js rename : browser/base/content/test/tabview/browser_tabview_bug587351.js => browser/components/tabview/test/browser_tabview_bug587351.js rename : browser/base/content/test/tabview/browser_tabview_bug587503.js => browser/components/tabview/test/browser_tabview_bug587503.js rename : browser/base/content/test/tabview/browser_tabview_bug587990.js => browser/components/tabview/test/browser_tabview_bug587990.js rename : browser/base/content/test/tabview/browser_tabview_bug588265.js => browser/components/tabview/test/browser_tabview_bug588265.js rename : browser/base/content/test/tabview/browser_tabview_bug589324.js => browser/components/tabview/test/browser_tabview_bug589324.js rename : browser/base/content/test/tabview/browser_tabview_bug590606.js => browser/components/tabview/test/browser_tabview_bug590606.js rename : browser/base/content/test/tabview/browser_tabview_bug591706.js => browser/components/tabview/test/browser_tabview_bug591706.js rename : browser/base/content/test/tabview/browser_tabview_bug593283.js => browser/components/tabview/test/browser_tabview_bug593283.js rename : browser/base/content/test/tabview/browser_tabview_bug594958.js => browser/components/tabview/test/browser_tabview_bug594958.js rename : browser/base/content/test/tabview/browser_tabview_bug595020.js => browser/components/tabview/test/browser_tabview_bug595020.js rename : browser/base/content/test/tabview/browser_tabview_bug595191.js => browser/components/tabview/test/browser_tabview_bug595191.js rename : browser/base/content/test/tabview/browser_tabview_bug595436.js => browser/components/tabview/test/browser_tabview_bug595436.js rename : browser/base/content/test/tabview/browser_tabview_bug595518.js => browser/components/tabview/test/browser_tabview_bug595518.js rename : browser/base/content/test/tabview/browser_tabview_bug595521.js => browser/components/tabview/test/browser_tabview_bug595521.js rename : browser/base/content/test/tabview/browser_tabview_bug595560.js => browser/components/tabview/test/browser_tabview_bug595560.js rename : browser/base/content/test/tabview/browser_tabview_bug595601.js => browser/components/tabview/test/browser_tabview_bug595601.js rename : browser/base/content/test/tabview/browser_tabview_bug595804.js => browser/components/tabview/test/browser_tabview_bug595804.js rename : browser/base/content/test/tabview/browser_tabview_bug595930.js => browser/components/tabview/test/browser_tabview_bug595930.js rename : browser/base/content/test/tabview/browser_tabview_bug595943.js => browser/components/tabview/test/browser_tabview_bug595943.js rename : browser/base/content/test/tabview/browser_tabview_bug595965.js => browser/components/tabview/test/browser_tabview_bug595965.js rename : browser/base/content/test/tabview/browser_tabview_bug596781.js => browser/components/tabview/test/browser_tabview_bug596781.js rename : browser/base/content/test/tabview/browser_tabview_bug597248.js => browser/components/tabview/test/browser_tabview_bug597248.js rename : browser/base/content/test/tabview/browser_tabview_bug597360.js => browser/components/tabview/test/browser_tabview_bug597360.js rename : browser/base/content/test/tabview/browser_tabview_bug597399.js => browser/components/tabview/test/browser_tabview_bug597399.js rename : browser/base/content/test/tabview/browser_tabview_bug597980.js => browser/components/tabview/test/browser_tabview_bug597980.js rename : browser/base/content/test/tabview/browser_tabview_bug598375.js => browser/components/tabview/test/browser_tabview_bug598375.js rename : browser/base/content/test/tabview/browser_tabview_bug598600.js => browser/components/tabview/test/browser_tabview_bug598600.js rename : browser/base/content/test/tabview/browser_tabview_bug599626.js => browser/components/tabview/test/browser_tabview_bug599626.js rename : browser/base/content/test/tabview/browser_tabview_bug600645.js => browser/components/tabview/test/browser_tabview_bug600645.js rename : browser/base/content/test/tabview/browser_tabview_bug600812.js => browser/components/tabview/test/browser_tabview_bug600812.js rename : browser/base/content/test/tabview/browser_tabview_bug602432.js => browser/components/tabview/test/browser_tabview_bug602432.js rename : browser/base/content/test/tabview/browser_tabview_bug604098.js => browser/components/tabview/test/browser_tabview_bug604098.js rename : browser/base/content/test/tabview/browser_tabview_bug606657.js => browser/components/tabview/test/browser_tabview_bug606657.js rename : browser/base/content/test/tabview/browser_tabview_bug606905.js => browser/components/tabview/test/browser_tabview_bug606905.js rename : browser/base/content/test/tabview/browser_tabview_bug607108.js => browser/components/tabview/test/browser_tabview_bug607108.js rename : browser/base/content/test/tabview/browser_tabview_bug608037.js => browser/components/tabview/test/browser_tabview_bug608037.js rename : browser/base/content/test/tabview/browser_tabview_bug608158.js => browser/components/tabview/test/browser_tabview_bug608158.js rename : browser/base/content/test/tabview/browser_tabview_bug608184.js => browser/components/tabview/test/browser_tabview_bug608184.js rename : browser/base/content/test/tabview/browser_tabview_bug608405.js => browser/components/tabview/test/browser_tabview_bug608405.js rename : browser/base/content/test/tabview/browser_tabview_bug610208.js => browser/components/tabview/test/browser_tabview_bug610208.js rename : browser/base/content/test/tabview/browser_tabview_bug610242.js => browser/components/tabview/test/browser_tabview_bug610242.js rename : browser/base/content/test/tabview/browser_tabview_bug612470.js => browser/components/tabview/test/browser_tabview_bug612470.js rename : browser/base/content/test/tabview/browser_tabview_bug613541.js => browser/components/tabview/test/browser_tabview_bug613541.js rename : browser/base/content/test/tabview/browser_tabview_bug616729.js => browser/components/tabview/test/browser_tabview_bug616729.js rename : browser/base/content/test/tabview/browser_tabview_bug616967.js => browser/components/tabview/test/browser_tabview_bug616967.js rename : browser/base/content/test/tabview/browser_tabview_bug618816.js => browser/components/tabview/test/browser_tabview_bug618816.js rename : browser/base/content/test/tabview/browser_tabview_bug618828.js => browser/components/tabview/test/browser_tabview_bug618828.js rename : browser/base/content/test/tabview/browser_tabview_bug619937.js => browser/components/tabview/test/browser_tabview_bug619937.js rename : browser/base/content/test/tabview/browser_tabview_bug622835.js => browser/components/tabview/test/browser_tabview_bug622835.js rename : browser/base/content/test/tabview/browser_tabview_bug623768.js => browser/components/tabview/test/browser_tabview_bug623768.js rename : browser/base/content/test/tabview/browser_tabview_bug624265.js => browser/components/tabview/test/browser_tabview_bug624265.js rename : browser/base/content/test/tabview/browser_tabview_bug624692.js => browser/components/tabview/test/browser_tabview_bug624692.js rename : browser/base/content/test/tabview/browser_tabview_bug624727.js => browser/components/tabview/test/browser_tabview_bug624727.js rename : browser/base/content/test/tabview/browser_tabview_bug624847.js => browser/components/tabview/test/browser_tabview_bug624847.js rename : browser/base/content/test/tabview/browser_tabview_bug624931.js => browser/components/tabview/test/browser_tabview_bug624931.js rename : browser/base/content/test/tabview/browser_tabview_bug624953.js => browser/components/tabview/test/browser_tabview_bug624953.js rename : browser/base/content/test/tabview/browser_tabview_bug625195.js => browser/components/tabview/test/browser_tabview_bug625195.js rename : browser/base/content/test/tabview/browser_tabview_bug625269.js => browser/components/tabview/test/browser_tabview_bug625269.js rename : browser/base/content/test/tabview/browser_tabview_bug625424.js => browser/components/tabview/test/browser_tabview_bug625424.js rename : browser/base/content/test/tabview/browser_tabview_bug625955.js => browser/components/tabview/test/browser_tabview_bug625955.js rename : browser/base/content/test/tabview/browser_tabview_bug626368.js => browser/components/tabview/test/browser_tabview_bug626368.js rename : browser/base/content/test/tabview/browser_tabview_bug626455.js => browser/components/tabview/test/browser_tabview_bug626455.js rename : browser/base/content/test/tabview/browser_tabview_bug626525.js => browser/components/tabview/test/browser_tabview_bug626525.js rename : browser/base/content/test/tabview/browser_tabview_bug626791.js => browser/components/tabview/test/browser_tabview_bug626791.js rename : browser/base/content/test/tabview/browser_tabview_bug627288.js => browser/components/tabview/test/browser_tabview_bug627288.js rename : browser/base/content/test/tabview/browser_tabview_bug627736.js => browser/components/tabview/test/browser_tabview_bug627736.js rename : browser/base/content/test/tabview/browser_tabview_bug628061.js => browser/components/tabview/test/browser_tabview_bug628061.js rename : browser/base/content/test/tabview/browser_tabview_bug628165.js => browser/components/tabview/test/browser_tabview_bug628165.js rename : browser/base/content/test/tabview/browser_tabview_bug628270.js => browser/components/tabview/test/browser_tabview_bug628270.js rename : browser/base/content/test/tabview/browser_tabview_bug628887.js => browser/components/tabview/test/browser_tabview_bug628887.js rename : browser/base/content/test/tabview/browser_tabview_bug629189.js => browser/components/tabview/test/browser_tabview_bug629189.js rename : browser/base/content/test/tabview/browser_tabview_bug629195.js => browser/components/tabview/test/browser_tabview_bug629195.js rename : browser/base/content/test/tabview/browser_tabview_bug630102.js => browser/components/tabview/test/browser_tabview_bug630102.js rename : browser/base/content/test/tabview/browser_tabview_bug630157.js => browser/components/tabview/test/browser_tabview_bug630157.js rename : browser/base/content/test/tabview/browser_tabview_bug631662.js => browser/components/tabview/test/browser_tabview_bug631662.js rename : browser/base/content/test/tabview/browser_tabview_bug631752.js => browser/components/tabview/test/browser_tabview_bug631752.js rename : browser/base/content/test/tabview/browser_tabview_bug633190.js => browser/components/tabview/test/browser_tabview_bug633190.js rename : browser/base/content/test/tabview/browser_tabview_bug633788.js => browser/components/tabview/test/browser_tabview_bug633788.js rename : browser/base/content/test/tabview/browser_tabview_bug634077.js => browser/components/tabview/test/browser_tabview_bug634077.js rename : browser/base/content/test/tabview/browser_tabview_bug634085.js => browser/components/tabview/test/browser_tabview_bug634085.js rename : browser/base/content/test/tabview/browser_tabview_bug634672.js => browser/components/tabview/test/browser_tabview_bug634672.js rename : browser/base/content/test/tabview/browser_tabview_bug635696.js => browser/components/tabview/test/browser_tabview_bug635696.js rename : browser/base/content/test/tabview/browser_tabview_bug637840.js => browser/components/tabview/test/browser_tabview_bug637840.js rename : browser/base/content/test/tabview/browser_tabview_bug640765.js => browser/components/tabview/test/browser_tabview_bug640765.js rename : browser/base/content/test/tabview/browser_tabview_bug641802.js => browser/components/tabview/test/browser_tabview_bug641802.js rename : browser/base/content/test/tabview/browser_tabview_bug642793.js => browser/components/tabview/test/browser_tabview_bug642793.js rename : browser/base/content/test/tabview/browser_tabview_bug643392.js => browser/components/tabview/test/browser_tabview_bug643392.js rename : browser/base/content/test/tabview/browser_tabview_bug644097.js => browser/components/tabview/test/browser_tabview_bug644097.js rename : browser/base/content/test/tabview/browser_tabview_bug648882.js => browser/components/tabview/test/browser_tabview_bug648882.js rename : browser/base/content/test/tabview/browser_tabview_bug649006.js => browser/components/tabview/test/browser_tabview_bug649006.js rename : browser/base/content/test/tabview/browser_tabview_bug649307.js => browser/components/tabview/test/browser_tabview_bug649307.js rename : browser/base/content/test/tabview/browser_tabview_bug649319.js => browser/components/tabview/test/browser_tabview_bug649319.js rename : browser/base/content/test/tabview/browser_tabview_bug650280.js => browser/components/tabview/test/browser_tabview_bug650280.js rename : browser/base/content/test/tabview/browser_tabview_bug650573.js => browser/components/tabview/test/browser_tabview_bug650573.js rename : browser/base/content/test/tabview/browser_tabview_bug651311.js => browser/components/tabview/test/browser_tabview_bug651311.js rename : browser/base/content/test/tabview/browser_tabview_bug654721.js => browser/components/tabview/test/browser_tabview_bug654721.js rename : browser/base/content/test/tabview/browser_tabview_bug654941.js => browser/components/tabview/test/browser_tabview_bug654941.js rename : browser/base/content/test/tabview/browser_tabview_bug655269.js => browser/components/tabview/test/browser_tabview_bug655269.js rename : browser/base/content/test/tabview/browser_tabview_bug656778.js => browser/components/tabview/test/browser_tabview_bug656778.js rename : browser/base/content/test/tabview/browser_tabview_bug656913.js => browser/components/tabview/test/browser_tabview_bug656913.js rename : browser/base/content/test/tabview/browser_tabview_bug662266.js => browser/components/tabview/test/browser_tabview_bug662266.js rename : browser/base/content/test/tabview/browser_tabview_bug663421.js => browser/components/tabview/test/browser_tabview_bug663421.js rename : browser/base/content/test/tabview/browser_tabview_bug665502.js => browser/components/tabview/test/browser_tabview_bug665502.js rename : browser/base/content/test/tabview/browser_tabview_bug669694.js => browser/components/tabview/test/browser_tabview_bug669694.js rename : browser/base/content/test/tabview/browser_tabview_bug673196.js => browser/components/tabview/test/browser_tabview_bug673196.js rename : browser/base/content/test/tabview/browser_tabview_bug673729.js => browser/components/tabview/test/browser_tabview_bug673729.js rename : browser/base/content/test/tabview/browser_tabview_bug677310.js => browser/components/tabview/test/browser_tabview_bug677310.js rename : browser/base/content/test/tabview/browser_tabview_bug679853.js => browser/components/tabview/test/browser_tabview_bug679853.js rename : browser/base/content/test/tabview/browser_tabview_bug681599.js => browser/components/tabview/test/browser_tabview_bug681599.js rename : browser/base/content/test/tabview/browser_tabview_bug685476.js => browser/components/tabview/test/browser_tabview_bug685476.js rename : browser/base/content/test/tabview/browser_tabview_bug685692.js => browser/components/tabview/test/browser_tabview_bug685692.js rename : browser/base/content/test/tabview/browser_tabview_bug686654.js => browser/components/tabview/test/browser_tabview_bug686654.js rename : browser/base/content/test/tabview/browser_tabview_click_group.js => browser/components/tabview/test/browser_tabview_click_group.js rename : browser/base/content/test/tabview/browser_tabview_dragdrop.js => browser/components/tabview/test/browser_tabview_dragdrop.js rename : browser/base/content/test/tabview/browser_tabview_exit_button.js => browser/components/tabview/test/browser_tabview_exit_button.js rename : browser/base/content/test/tabview/browser_tabview_expander.js => browser/components/tabview/test/browser_tabview_expander.js rename : browser/base/content/test/tabview/browser_tabview_firstrun_pref.js => browser/components/tabview/test/browser_tabview_firstrun_pref.js rename : browser/base/content/test/tabview/browser_tabview_group.js => browser/components/tabview/test/browser_tabview_group.js rename : browser/base/content/test/tabview/browser_tabview_launch.js => browser/components/tabview/test/browser_tabview_launch.js rename : browser/base/content/test/tabview/browser_tabview_layout.js => browser/components/tabview/test/browser_tabview_layout.js rename : browser/base/content/test/tabview/browser_tabview_multiwindow_search.js => browser/components/tabview/test/browser_tabview_multiwindow_search.js rename : browser/base/content/test/tabview/browser_tabview_privatebrowsing.js => browser/components/tabview/test/browser_tabview_privatebrowsing.js rename : browser/base/content/test/tabview/browser_tabview_rtl.js => browser/components/tabview/test/browser_tabview_rtl.js rename : browser/base/content/test/tabview/browser_tabview_search.js => browser/components/tabview/test/browser_tabview_search.js rename : browser/base/content/test/tabview/browser_tabview_snapping.js => browser/components/tabview/test/browser_tabview_snapping.js rename : browser/base/content/test/tabview/browser_tabview_startup_transitions.js => browser/components/tabview/test/browser_tabview_startup_transitions.js rename : browser/base/content/test/tabview/browser_tabview_storage_policy.js => browser/components/tabview/test/browser_tabview_storage_policy.js rename : browser/base/content/test/tabview/browser_tabview_thumbnail_storage.js => browser/components/tabview/test/browser_tabview_thumbnail_storage.js rename : browser/base/content/test/tabview/browser_tabview_undo_group.js => browser/components/tabview/test/browser_tabview_undo_group.js rename : browser/base/content/test/tabview/dummy_page.html => browser/components/tabview/test/dummy_page.html rename : browser/base/content/test/tabview/head.js => browser/components/tabview/test/head.js rename : browser/base/content/test/tabview/search1.html => browser/components/tabview/test/search1.html rename : browser/base/content/test/tabview/search2.html => browser/components/tabview/test/search2.html rename : browser/base/content/test/tabview/test_bug600645.html => browser/components/tabview/test/test_bug600645.html rename : browser/base/content/test/tabview/test_bug644097.html => browser/components/tabview/test/test_bug644097.html rename : browser/base/content/tabview/thumbnailStorage.js => browser/components/tabview/thumbnailStorage.js rename : browser/base/content/tabview/trench.js => browser/components/tabview/trench.js rename : browser/base/content/tabview/ui.js => browser/components/tabview/ui.js --- browser/base/Makefile.in | 3 -- browser/base/content/test/Makefile.in | 4 -- browser/base/jar.mn | 4 -- browser/components/Makefile.in | 1 + browser/components/tabview/Makefile.in | 53 +++++++++++++++++++ .../content => components}/tabview/content.js | 0 .../content => components}/tabview/drag.js | 0 .../tabview/groupitems.js | 0 .../content => components}/tabview/iq.js | 0 .../content => components}/tabview/items.js | 0 browser/components/tabview/jar.mn | 5 ++ .../tabview/modules/utils.jsm | 0 .../content => components}/tabview/search.js | 0 .../content => components}/tabview/storage.js | 0 .../tabview/storagePolicy.js | 0 .../tabview/tabitems.js | 0 .../tabview/tabview.css | 0 .../tabview/tabview.html | 0 .../content => components}/tabview/tabview.js | 0 .../tabview/test}/Makefile.in | 4 +- .../tabview/test}/browser_tabview_alltabs.js | 0 .../tabview/test}/browser_tabview_apptabs.js | 0 .../test}/browser_tabview_bug580412.js | 0 .../test}/browser_tabview_bug586553.js | 0 .../test}/browser_tabview_bug587043.js | 0 .../test}/browser_tabview_bug587231.js | 0 .../test}/browser_tabview_bug587276.js | 0 .../test}/browser_tabview_bug587351.js | 0 .../test}/browser_tabview_bug587503.js | 0 .../test}/browser_tabview_bug587990.js | 0 .../test}/browser_tabview_bug588265.js | 0 .../test}/browser_tabview_bug589324.js | 2 +- .../test}/browser_tabview_bug590606.js | 0 .../test}/browser_tabview_bug591706.js | 0 .../test}/browser_tabview_bug593283.js | 0 .../test}/browser_tabview_bug594958.js | 0 .../test}/browser_tabview_bug595020.js | 0 .../test}/browser_tabview_bug595191.js | 0 .../test}/browser_tabview_bug595436.js | 0 .../test}/browser_tabview_bug595518.js | 0 .../test}/browser_tabview_bug595521.js | 0 .../test}/browser_tabview_bug595560.js | 0 .../test}/browser_tabview_bug595601.js | 0 .../test}/browser_tabview_bug595804.js | 0 .../test}/browser_tabview_bug595930.js | 0 .../test}/browser_tabview_bug595943.js | 0 .../test}/browser_tabview_bug595965.js | 0 .../test}/browser_tabview_bug596781.js | 0 .../test}/browser_tabview_bug597248.js | 4 +- .../test}/browser_tabview_bug597360.js | 0 .../test}/browser_tabview_bug597399.js | 0 .../test}/browser_tabview_bug597980.js | 0 .../test}/browser_tabview_bug598375.js | 0 .../test}/browser_tabview_bug598600.js | 0 .../test}/browser_tabview_bug599626.js | 0 .../test}/browser_tabview_bug600645.js | 2 +- .../test}/browser_tabview_bug600812.js | 0 .../test}/browser_tabview_bug602432.js | 0 .../test}/browser_tabview_bug604098.js | 0 .../test}/browser_tabview_bug606657.js | 0 .../test}/browser_tabview_bug606905.js | 0 .../test}/browser_tabview_bug607108.js | 0 .../test}/browser_tabview_bug608037.js | 2 +- .../test}/browser_tabview_bug608158.js | 0 .../test}/browser_tabview_bug608184.js | 0 .../test}/browser_tabview_bug608405.js | 0 .../test}/browser_tabview_bug610208.js | 0 .../test}/browser_tabview_bug610242.js | 0 .../test}/browser_tabview_bug612470.js | 0 .../test}/browser_tabview_bug613541.js | 0 .../test}/browser_tabview_bug616729.js | 0 .../test}/browser_tabview_bug616967.js | 0 .../test}/browser_tabview_bug618816.js | 0 .../test}/browser_tabview_bug618828.js | 0 .../test}/browser_tabview_bug619937.js | 0 .../test}/browser_tabview_bug622835.js | 0 .../test}/browser_tabview_bug623768.js | 0 .../test}/browser_tabview_bug624265.js | 0 .../test}/browser_tabview_bug624692.js | 0 .../test}/browser_tabview_bug624727.js | 0 .../test}/browser_tabview_bug624847.js | 0 .../test}/browser_tabview_bug624931.js | 0 .../test}/browser_tabview_bug624953.js | 0 .../test}/browser_tabview_bug625195.js | 0 .../test}/browser_tabview_bug625269.js | 0 .../test}/browser_tabview_bug625424.js | 0 .../test}/browser_tabview_bug625955.js | 0 .../test}/browser_tabview_bug626368.js | 0 .../test}/browser_tabview_bug626455.js | 0 .../test}/browser_tabview_bug626525.js | 0 .../test}/browser_tabview_bug626791.js | 0 .../test}/browser_tabview_bug627288.js | 0 .../test}/browser_tabview_bug627736.js | 0 .../test}/browser_tabview_bug628061.js | 0 .../test}/browser_tabview_bug628165.js | 0 .../test}/browser_tabview_bug628270.js | 0 .../test}/browser_tabview_bug628887.js | 0 .../test}/browser_tabview_bug629189.js | 0 .../test}/browser_tabview_bug629195.js | 0 .../test}/browser_tabview_bug630102.js | 0 .../test}/browser_tabview_bug630157.js | 0 .../test}/browser_tabview_bug631662.js | 0 .../test}/browser_tabview_bug631752.js | 0 .../test}/browser_tabview_bug633190.js | 0 .../test}/browser_tabview_bug633788.js | 0 .../test}/browser_tabview_bug634077.js | 0 .../test}/browser_tabview_bug634085.js | 0 .../test}/browser_tabview_bug634672.js | 0 .../test}/browser_tabview_bug635696.js | 0 .../test}/browser_tabview_bug637840.js | 0 .../test}/browser_tabview_bug640765.js | 0 .../test}/browser_tabview_bug641802.js | 0 .../test}/browser_tabview_bug642793.js | 0 .../test}/browser_tabview_bug643392.js | 0 .../test}/browser_tabview_bug644097.js | 2 +- .../test}/browser_tabview_bug648882.js | 0 .../test}/browser_tabview_bug649006.js | 0 .../test}/browser_tabview_bug649307.js | 0 .../test}/browser_tabview_bug649319.js | 0 .../test}/browser_tabview_bug650280.js | 0 .../test}/browser_tabview_bug650573.js | 0 .../test}/browser_tabview_bug651311.js | 0 .../test}/browser_tabview_bug654721.js | 0 .../test}/browser_tabview_bug654941.js | 0 .../test}/browser_tabview_bug655269.js | 0 .../test}/browser_tabview_bug656778.js | 0 .../test}/browser_tabview_bug656913.js | 2 +- .../test}/browser_tabview_bug662266.js | 0 .../test}/browser_tabview_bug663421.js | 0 .../test}/browser_tabview_bug665502.js | 0 .../test}/browser_tabview_bug669694.js | 0 .../test}/browser_tabview_bug673196.js | 0 .../test}/browser_tabview_bug673729.js | 0 .../test}/browser_tabview_bug677310.js | 0 .../test}/browser_tabview_bug679853.js | 0 .../test}/browser_tabview_bug681599.js | 0 .../test}/browser_tabview_bug685476.js | 0 .../test}/browser_tabview_bug685692.js | 0 .../test}/browser_tabview_bug686654.js | 0 .../test}/browser_tabview_click_group.js | 0 .../tabview/test}/browser_tabview_dragdrop.js | 0 .../test}/browser_tabview_exit_button.js | 0 .../tabview/test}/browser_tabview_expander.js | 0 .../test}/browser_tabview_firstrun_pref.js | 0 .../tabview/test}/browser_tabview_group.js | 0 .../tabview/test}/browser_tabview_launch.js | 0 .../tabview/test}/browser_tabview_layout.js | 0 .../browser_tabview_multiwindow_search.js | 0 .../test}/browser_tabview_privatebrowsing.js | 0 .../tabview/test}/browser_tabview_rtl.js | 0 .../tabview/test}/browser_tabview_search.js | 2 +- .../tabview/test}/browser_tabview_snapping.js | 0 .../browser_tabview_startup_transitions.js | 0 .../test}/browser_tabview_storage_policy.js | 6 +-- .../browser_tabview_thumbnail_storage.js | 0 .../test}/browser_tabview_undo_group.js | 0 .../tabview/test}/dummy_page.html | 0 .../tabview/test}/head.js | 0 .../tabview/test}/search1.html | 0 .../tabview/test}/search2.html | 0 .../tabview/test}/test_bug600645.html | 0 .../tabview/test}/test_bug644097.html | 0 .../tabview/thumbnailStorage.js | 0 .../content => components}/tabview/trench.js | 0 .../content => components}/tabview/ui.js | 0 165 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 browser/components/tabview/Makefile.in rename browser/{base/content => components}/tabview/content.js (100%) rename browser/{base/content => components}/tabview/drag.js (100%) rename browser/{base/content => components}/tabview/groupitems.js (100%) rename browser/{base/content => components}/tabview/iq.js (100%) rename browser/{base/content => components}/tabview/items.js (100%) create mode 100644 browser/components/tabview/jar.mn rename browser/{base/content => components}/tabview/modules/utils.jsm (100%) rename browser/{base/content => components}/tabview/search.js (100%) rename browser/{base/content => components}/tabview/storage.js (100%) rename browser/{base/content => components}/tabview/storagePolicy.js (100%) rename browser/{base/content => components}/tabview/tabitems.js (100%) rename browser/{base/content => components}/tabview/tabview.css (100%) rename browser/{base/content => components}/tabview/tabview.html (100%) rename browser/{base/content => components}/tabview/tabview.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/Makefile.in (99%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_alltabs.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_apptabs.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug580412.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug586553.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug587043.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug587231.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug587276.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug587351.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug587503.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug587990.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug588265.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug589324.js (96%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug590606.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug591706.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug593283.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug594958.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595020.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595191.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595436.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595518.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595521.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595560.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595601.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595804.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595930.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595943.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug595965.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug596781.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug597248.js (95%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug597360.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug597399.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug597980.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug598375.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug598600.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug599626.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug600645.js (96%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug600812.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug602432.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug604098.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug606657.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug606905.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug607108.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug608037.js (96%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug608158.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug608184.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug608405.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug610208.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug610242.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug612470.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug613541.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug616729.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug616967.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug618816.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug618828.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug619937.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug622835.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug623768.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug624265.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug624692.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug624727.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug624847.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug624931.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug624953.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug625195.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug625269.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug625424.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug625955.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug626368.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug626455.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug626525.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug626791.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug627288.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug627736.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug628061.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug628165.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug628270.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug628887.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug629189.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug629195.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug630102.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug630157.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug631662.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug631752.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug633190.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug633788.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug634077.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug634085.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug634672.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug635696.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug637840.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug640765.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug641802.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug642793.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug643392.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug644097.js (94%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug648882.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug649006.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug649307.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug649319.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug650280.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug650573.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug651311.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug654721.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug654941.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug655269.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug656778.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug656913.js (93%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug662266.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug663421.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug665502.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug669694.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug673196.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug673729.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug677310.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug679853.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug681599.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug685476.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug685692.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_bug686654.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_click_group.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_dragdrop.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_exit_button.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_expander.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_firstrun_pref.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_group.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_launch.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_layout.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_multiwindow_search.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_privatebrowsing.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_rtl.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_search.js (98%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_snapping.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_startup_transitions.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_storage_policy.js (97%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_thumbnail_storage.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/browser_tabview_undo_group.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/dummy_page.html (100%) rename browser/{base/content/test/tabview => components/tabview/test}/head.js (100%) rename browser/{base/content/test/tabview => components/tabview/test}/search1.html (100%) rename browser/{base/content/test/tabview => components/tabview/test}/search2.html (100%) rename browser/{base/content/test/tabview => components/tabview/test}/test_bug600645.html (100%) rename browser/{base/content/test/tabview => components/tabview/test}/test_bug644097.html (100%) rename browser/{base/content => components}/tabview/thumbnailStorage.js (100%) rename browser/{base/content => components}/tabview/trench.js (100%) rename browser/{base/content => components}/tabview/ui.js (100%) diff --git a/browser/base/Makefile.in b/browser/base/Makefile.in index df14dfeddfa..3523ab62895 100644 --- a/browser/base/Makefile.in +++ b/browser/base/Makefile.in @@ -83,6 +83,3 @@ endif ifneq (,$(filter windows gtk2, $(MOZ_WIDGET_TOOLKIT))) DEFINES += -DMENUBAR_CAN_AUTOHIDE=1 endif - -libs:: - $(NSINSTALL) $(srcdir)/content/tabview/modules/* $(FINAL_TARGET)/modules/tabview diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in index d4dcd04986a..59a0c58e6cf 100644 --- a/browser/base/content/test/Makefile.in +++ b/browser/base/content/test/Makefile.in @@ -40,10 +40,6 @@ srcdir = @srcdir@ VPATH = @srcdir@ relativesrcdir = browser/base/content/test -DIRS += \ - tabview \ - $(NULL) - include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk diff --git a/browser/base/jar.mn b/browser/base/jar.mn index 8f7cc13010a..e492eed48f6 100644 --- a/browser/base/jar.mn +++ b/browser/base/jar.mn @@ -49,10 +49,6 @@ browser.jar: content/browser/sanitizeDialog.css (content/sanitizeDialog.css) * content/browser/tabbrowser.css (content/tabbrowser.css) * content/browser/tabbrowser.xml (content/tabbrowser.xml) - content/browser/tabview.css (content/tabview/tabview.css) -* content/browser/tabview.js (content/tabview/tabview.js) - content/browser/tabview.html (content/tabview/tabview.html) - content/browser/tabview-content.js (content/tabview/content.js) * content/browser/urlbarBindings.xml (content/urlbarBindings.xml) * content/browser/utilityOverlay.js (content/utilityOverlay.js) * content/browser/web-panels.js (content/web-panels.js) diff --git a/browser/components/Makefile.in b/browser/components/Makefile.in index f1b9d587fb5..1780ced292a 100644 --- a/browser/components/Makefile.in +++ b/browser/components/Makefile.in @@ -70,6 +70,7 @@ PARALLEL_DIRS = \ sessionstore \ shell \ sidebar \ + tabview \ migration \ $(NULL) diff --git a/browser/components/tabview/Makefile.in b/browser/components/tabview/Makefile.in new file mode 100644 index 00000000000..c86fb752212 --- /dev/null +++ b/browser/components/tabview/Makefile.in @@ -0,0 +1,53 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is Places code +# +# The Initial Developer of the Original Code is +# Google Inc. +# Portions created by the Initial Developer are Copyright (C) 2005 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Brett Wilson +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +ifdef ENABLE_TESTS + DIRS += test +endif + +include $(topsrcdir)/config/rules.mk + +libs:: + $(NSINSTALL) $(srcdir)/modules/* $(FINAL_TARGET)/modules/tabview diff --git a/browser/base/content/tabview/content.js b/browser/components/tabview/content.js similarity index 100% rename from browser/base/content/tabview/content.js rename to browser/components/tabview/content.js diff --git a/browser/base/content/tabview/drag.js b/browser/components/tabview/drag.js similarity index 100% rename from browser/base/content/tabview/drag.js rename to browser/components/tabview/drag.js diff --git a/browser/base/content/tabview/groupitems.js b/browser/components/tabview/groupitems.js similarity index 100% rename from browser/base/content/tabview/groupitems.js rename to browser/components/tabview/groupitems.js diff --git a/browser/base/content/tabview/iq.js b/browser/components/tabview/iq.js similarity index 100% rename from browser/base/content/tabview/iq.js rename to browser/components/tabview/iq.js diff --git a/browser/base/content/tabview/items.js b/browser/components/tabview/items.js similarity index 100% rename from browser/base/content/tabview/items.js rename to browser/components/tabview/items.js diff --git a/browser/components/tabview/jar.mn b/browser/components/tabview/jar.mn new file mode 100644 index 00000000000..7b54b18afd9 --- /dev/null +++ b/browser/components/tabview/jar.mn @@ -0,0 +1,5 @@ +browser.jar: + content/browser/tabview.css (tabview.css) +* content/browser/tabview.js (tabview.js) + content/browser/tabview.html (tabview.html) + content/browser/tabview-content.js (content.js) diff --git a/browser/base/content/tabview/modules/utils.jsm b/browser/components/tabview/modules/utils.jsm similarity index 100% rename from browser/base/content/tabview/modules/utils.jsm rename to browser/components/tabview/modules/utils.jsm diff --git a/browser/base/content/tabview/search.js b/browser/components/tabview/search.js similarity index 100% rename from browser/base/content/tabview/search.js rename to browser/components/tabview/search.js diff --git a/browser/base/content/tabview/storage.js b/browser/components/tabview/storage.js similarity index 100% rename from browser/base/content/tabview/storage.js rename to browser/components/tabview/storage.js diff --git a/browser/base/content/tabview/storagePolicy.js b/browser/components/tabview/storagePolicy.js similarity index 100% rename from browser/base/content/tabview/storagePolicy.js rename to browser/components/tabview/storagePolicy.js diff --git a/browser/base/content/tabview/tabitems.js b/browser/components/tabview/tabitems.js similarity index 100% rename from browser/base/content/tabview/tabitems.js rename to browser/components/tabview/tabitems.js diff --git a/browser/base/content/tabview/tabview.css b/browser/components/tabview/tabview.css similarity index 100% rename from browser/base/content/tabview/tabview.css rename to browser/components/tabview/tabview.css diff --git a/browser/base/content/tabview/tabview.html b/browser/components/tabview/tabview.html similarity index 100% rename from browser/base/content/tabview/tabview.html rename to browser/components/tabview/tabview.html diff --git a/browser/base/content/tabview/tabview.js b/browser/components/tabview/tabview.js similarity index 100% rename from browser/base/content/tabview/tabview.js rename to browser/components/tabview/tabview.js diff --git a/browser/base/content/test/tabview/Makefile.in b/browser/components/tabview/test/Makefile.in similarity index 99% rename from browser/base/content/test/tabview/Makefile.in rename to browser/components/tabview/test/Makefile.in index 785606e0cbc..81807e1cce1 100644 --- a/browser/base/content/test/tabview/Makefile.in +++ b/browser/components/tabview/test/Makefile.in @@ -34,11 +34,11 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../../../.. +DEPTH = ../../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ -relativesrcdir = browser/base/content/test/tabview +relativesrcdir = browser/components/tabview/test include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk diff --git a/browser/base/content/test/tabview/browser_tabview_alltabs.js b/browser/components/tabview/test/browser_tabview_alltabs.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_alltabs.js rename to browser/components/tabview/test/browser_tabview_alltabs.js diff --git a/browser/base/content/test/tabview/browser_tabview_apptabs.js b/browser/components/tabview/test/browser_tabview_apptabs.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_apptabs.js rename to browser/components/tabview/test/browser_tabview_apptabs.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug580412.js b/browser/components/tabview/test/browser_tabview_bug580412.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug580412.js rename to browser/components/tabview/test/browser_tabview_bug580412.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug586553.js b/browser/components/tabview/test/browser_tabview_bug586553.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug586553.js rename to browser/components/tabview/test/browser_tabview_bug586553.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug587043.js b/browser/components/tabview/test/browser_tabview_bug587043.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug587043.js rename to browser/components/tabview/test/browser_tabview_bug587043.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug587231.js b/browser/components/tabview/test/browser_tabview_bug587231.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug587231.js rename to browser/components/tabview/test/browser_tabview_bug587231.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug587276.js b/browser/components/tabview/test/browser_tabview_bug587276.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug587276.js rename to browser/components/tabview/test/browser_tabview_bug587276.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug587351.js b/browser/components/tabview/test/browser_tabview_bug587351.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug587351.js rename to browser/components/tabview/test/browser_tabview_bug587351.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug587503.js b/browser/components/tabview/test/browser_tabview_bug587503.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug587503.js rename to browser/components/tabview/test/browser_tabview_bug587503.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug587990.js b/browser/components/tabview/test/browser_tabview_bug587990.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug587990.js rename to browser/components/tabview/test/browser_tabview_bug587990.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug588265.js b/browser/components/tabview/test/browser_tabview_bug588265.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug588265.js rename to browser/components/tabview/test/browser_tabview_bug588265.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug589324.js b/browser/components/tabview/test/browser_tabview_bug589324.js similarity index 96% rename from browser/base/content/test/tabview/browser_tabview_bug589324.js rename to browser/components/tabview/test/browser_tabview_bug589324.js index a70dffdbc0f..43d590bb612 100644 --- a/browser/base/content/test/tabview/browser_tabview_bug589324.js +++ b/browser/components/tabview/test/browser_tabview_bug589324.js @@ -1,7 +1,7 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -const DUMMY_PAGE_URL = "http://mochi.test:8888/browser/browser/base/content/test/tabview/dummy_page.html"; +const DUMMY_PAGE_URL = "http://mochi.test:8888/browser/browser/components/tabview/test/dummy_page.html"; const DUMMY_PAGE_URL_2 = "http://mochi.test:8888/"; let state = { diff --git a/browser/base/content/test/tabview/browser_tabview_bug590606.js b/browser/components/tabview/test/browser_tabview_bug590606.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug590606.js rename to browser/components/tabview/test/browser_tabview_bug590606.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug591706.js b/browser/components/tabview/test/browser_tabview_bug591706.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug591706.js rename to browser/components/tabview/test/browser_tabview_bug591706.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug593283.js b/browser/components/tabview/test/browser_tabview_bug593283.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug593283.js rename to browser/components/tabview/test/browser_tabview_bug593283.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug594958.js b/browser/components/tabview/test/browser_tabview_bug594958.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug594958.js rename to browser/components/tabview/test/browser_tabview_bug594958.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595020.js b/browser/components/tabview/test/browser_tabview_bug595020.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595020.js rename to browser/components/tabview/test/browser_tabview_bug595020.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595191.js b/browser/components/tabview/test/browser_tabview_bug595191.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595191.js rename to browser/components/tabview/test/browser_tabview_bug595191.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595436.js b/browser/components/tabview/test/browser_tabview_bug595436.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595436.js rename to browser/components/tabview/test/browser_tabview_bug595436.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595518.js b/browser/components/tabview/test/browser_tabview_bug595518.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595518.js rename to browser/components/tabview/test/browser_tabview_bug595518.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595521.js b/browser/components/tabview/test/browser_tabview_bug595521.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595521.js rename to browser/components/tabview/test/browser_tabview_bug595521.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595560.js b/browser/components/tabview/test/browser_tabview_bug595560.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595560.js rename to browser/components/tabview/test/browser_tabview_bug595560.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595601.js b/browser/components/tabview/test/browser_tabview_bug595601.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595601.js rename to browser/components/tabview/test/browser_tabview_bug595601.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595804.js b/browser/components/tabview/test/browser_tabview_bug595804.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595804.js rename to browser/components/tabview/test/browser_tabview_bug595804.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595930.js b/browser/components/tabview/test/browser_tabview_bug595930.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595930.js rename to browser/components/tabview/test/browser_tabview_bug595930.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595943.js b/browser/components/tabview/test/browser_tabview_bug595943.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595943.js rename to browser/components/tabview/test/browser_tabview_bug595943.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug595965.js b/browser/components/tabview/test/browser_tabview_bug595965.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug595965.js rename to browser/components/tabview/test/browser_tabview_bug595965.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug596781.js b/browser/components/tabview/test/browser_tabview_bug596781.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug596781.js rename to browser/components/tabview/test/browser_tabview_bug596781.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug597248.js b/browser/components/tabview/test/browser_tabview_bug597248.js similarity index 95% rename from browser/base/content/test/tabview/browser_tabview_bug597248.js rename to browser/components/tabview/test/browser_tabview_bug597248.js index eeb8dfe0f55..98490c1b29f 100644 --- a/browser/base/content/test/tabview/browser_tabview_bug597248.js +++ b/browser/components/tabview/test/browser_tabview_bug597248.js @@ -16,8 +16,8 @@ function test() { function setupOne(win) { win.TabView.firstUseExperienced = true; - win.gBrowser.addTab("http://mochi.test:8888/browser/browser/base/content/test/tabview/search1.html"); - win.gBrowser.addTab("http://mochi.test:8888/browser/browser/base/content/test/tabview/dummy_page.html"); + win.gBrowser.addTab("http://mochi.test:8888/browser/browser/components/tabview/test/search1.html"); + win.gBrowser.addTab("http://mochi.test:8888/browser/browser/components/tabview/test/dummy_page.html"); afterAllTabsLoaded(function () setupTwo(win), win); } diff --git a/browser/base/content/test/tabview/browser_tabview_bug597360.js b/browser/components/tabview/test/browser_tabview_bug597360.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug597360.js rename to browser/components/tabview/test/browser_tabview_bug597360.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug597399.js b/browser/components/tabview/test/browser_tabview_bug597399.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug597399.js rename to browser/components/tabview/test/browser_tabview_bug597399.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug597980.js b/browser/components/tabview/test/browser_tabview_bug597980.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug597980.js rename to browser/components/tabview/test/browser_tabview_bug597980.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug598375.js b/browser/components/tabview/test/browser_tabview_bug598375.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug598375.js rename to browser/components/tabview/test/browser_tabview_bug598375.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug598600.js b/browser/components/tabview/test/browser_tabview_bug598600.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug598600.js rename to browser/components/tabview/test/browser_tabview_bug598600.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug599626.js b/browser/components/tabview/test/browser_tabview_bug599626.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug599626.js rename to browser/components/tabview/test/browser_tabview_bug599626.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug600645.js b/browser/components/tabview/test/browser_tabview_bug600645.js similarity index 96% rename from browser/base/content/test/tabview/browser_tabview_bug600645.js rename to browser/components/tabview/test/browser_tabview_bug600645.js index 8ee342e38ce..f079af74463 100644 --- a/browser/base/content/test/tabview/browser_tabview_bug600645.js +++ b/browser/components/tabview/test/browser_tabview_bug600645.js @@ -68,5 +68,5 @@ function onTabViewWindowLoaded() { newTab.addEventListener("error", errorHandler, false); newTab.linkedBrowser.loadURI( - "http://mochi.test:8888/browser/browser/base/content/test/tabview/test_bug600645.html"); + "http://mochi.test:8888/browser/browser/components/tabview/test/test_bug600645.html"); } diff --git a/browser/base/content/test/tabview/browser_tabview_bug600812.js b/browser/components/tabview/test/browser_tabview_bug600812.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug600812.js rename to browser/components/tabview/test/browser_tabview_bug600812.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug602432.js b/browser/components/tabview/test/browser_tabview_bug602432.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug602432.js rename to browser/components/tabview/test/browser_tabview_bug602432.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug604098.js b/browser/components/tabview/test/browser_tabview_bug604098.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug604098.js rename to browser/components/tabview/test/browser_tabview_bug604098.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug606657.js b/browser/components/tabview/test/browser_tabview_bug606657.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug606657.js rename to browser/components/tabview/test/browser_tabview_bug606657.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug606905.js b/browser/components/tabview/test/browser_tabview_bug606905.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug606905.js rename to browser/components/tabview/test/browser_tabview_bug606905.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug607108.js b/browser/components/tabview/test/browser_tabview_bug607108.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug607108.js rename to browser/components/tabview/test/browser_tabview_bug607108.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug608037.js b/browser/components/tabview/test/browser_tabview_bug608037.js similarity index 96% rename from browser/base/content/test/tabview/browser_tabview_bug608037.js rename to browser/components/tabview/test/browser_tabview_bug608037.js index 37b2f5f9691..8e02d611fed 100644 --- a/browser/base/content/test/tabview/browser_tabview_bug608037.js +++ b/browser/components/tabview/test/browser_tabview_bug608037.js @@ -8,7 +8,7 @@ function test() { waitForExplicitFinish(); tabOne = gBrowser.addTab("http://mochi.test:8888/"); - tabTwo = gBrowser.addTab("http://mochi.test:8888/browser/browser/base/content/test/tabview/dummy_page.html"); + tabTwo = gBrowser.addTab("http://mochi.test:8888/browser/browser/components/tabview/test/dummy_page.html"); afterAllTabsLoaded(function () { // make sure the tab one is selected because undoCloseTab() would remove diff --git a/browser/base/content/test/tabview/browser_tabview_bug608158.js b/browser/components/tabview/test/browser_tabview_bug608158.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug608158.js rename to browser/components/tabview/test/browser_tabview_bug608158.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug608184.js b/browser/components/tabview/test/browser_tabview_bug608184.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug608184.js rename to browser/components/tabview/test/browser_tabview_bug608184.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug608405.js b/browser/components/tabview/test/browser_tabview_bug608405.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug608405.js rename to browser/components/tabview/test/browser_tabview_bug608405.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug610208.js b/browser/components/tabview/test/browser_tabview_bug610208.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug610208.js rename to browser/components/tabview/test/browser_tabview_bug610208.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug610242.js b/browser/components/tabview/test/browser_tabview_bug610242.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug610242.js rename to browser/components/tabview/test/browser_tabview_bug610242.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug612470.js b/browser/components/tabview/test/browser_tabview_bug612470.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug612470.js rename to browser/components/tabview/test/browser_tabview_bug612470.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug613541.js b/browser/components/tabview/test/browser_tabview_bug613541.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug613541.js rename to browser/components/tabview/test/browser_tabview_bug613541.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug616729.js b/browser/components/tabview/test/browser_tabview_bug616729.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug616729.js rename to browser/components/tabview/test/browser_tabview_bug616729.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug616967.js b/browser/components/tabview/test/browser_tabview_bug616967.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug616967.js rename to browser/components/tabview/test/browser_tabview_bug616967.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug618816.js b/browser/components/tabview/test/browser_tabview_bug618816.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug618816.js rename to browser/components/tabview/test/browser_tabview_bug618816.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug618828.js b/browser/components/tabview/test/browser_tabview_bug618828.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug618828.js rename to browser/components/tabview/test/browser_tabview_bug618828.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug619937.js b/browser/components/tabview/test/browser_tabview_bug619937.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug619937.js rename to browser/components/tabview/test/browser_tabview_bug619937.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug622835.js b/browser/components/tabview/test/browser_tabview_bug622835.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug622835.js rename to browser/components/tabview/test/browser_tabview_bug622835.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug623768.js b/browser/components/tabview/test/browser_tabview_bug623768.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug623768.js rename to browser/components/tabview/test/browser_tabview_bug623768.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug624265.js b/browser/components/tabview/test/browser_tabview_bug624265.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug624265.js rename to browser/components/tabview/test/browser_tabview_bug624265.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug624692.js b/browser/components/tabview/test/browser_tabview_bug624692.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug624692.js rename to browser/components/tabview/test/browser_tabview_bug624692.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug624727.js b/browser/components/tabview/test/browser_tabview_bug624727.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug624727.js rename to browser/components/tabview/test/browser_tabview_bug624727.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug624847.js b/browser/components/tabview/test/browser_tabview_bug624847.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug624847.js rename to browser/components/tabview/test/browser_tabview_bug624847.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug624931.js b/browser/components/tabview/test/browser_tabview_bug624931.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug624931.js rename to browser/components/tabview/test/browser_tabview_bug624931.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug624953.js b/browser/components/tabview/test/browser_tabview_bug624953.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug624953.js rename to browser/components/tabview/test/browser_tabview_bug624953.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug625195.js b/browser/components/tabview/test/browser_tabview_bug625195.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug625195.js rename to browser/components/tabview/test/browser_tabview_bug625195.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug625269.js b/browser/components/tabview/test/browser_tabview_bug625269.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug625269.js rename to browser/components/tabview/test/browser_tabview_bug625269.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug625424.js b/browser/components/tabview/test/browser_tabview_bug625424.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug625424.js rename to browser/components/tabview/test/browser_tabview_bug625424.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug625955.js b/browser/components/tabview/test/browser_tabview_bug625955.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug625955.js rename to browser/components/tabview/test/browser_tabview_bug625955.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug626368.js b/browser/components/tabview/test/browser_tabview_bug626368.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug626368.js rename to browser/components/tabview/test/browser_tabview_bug626368.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug626455.js b/browser/components/tabview/test/browser_tabview_bug626455.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug626455.js rename to browser/components/tabview/test/browser_tabview_bug626455.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug626525.js b/browser/components/tabview/test/browser_tabview_bug626525.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug626525.js rename to browser/components/tabview/test/browser_tabview_bug626525.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug626791.js b/browser/components/tabview/test/browser_tabview_bug626791.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug626791.js rename to browser/components/tabview/test/browser_tabview_bug626791.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug627288.js b/browser/components/tabview/test/browser_tabview_bug627288.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug627288.js rename to browser/components/tabview/test/browser_tabview_bug627288.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug627736.js b/browser/components/tabview/test/browser_tabview_bug627736.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug627736.js rename to browser/components/tabview/test/browser_tabview_bug627736.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug628061.js b/browser/components/tabview/test/browser_tabview_bug628061.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug628061.js rename to browser/components/tabview/test/browser_tabview_bug628061.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug628165.js b/browser/components/tabview/test/browser_tabview_bug628165.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug628165.js rename to browser/components/tabview/test/browser_tabview_bug628165.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug628270.js b/browser/components/tabview/test/browser_tabview_bug628270.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug628270.js rename to browser/components/tabview/test/browser_tabview_bug628270.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug628887.js b/browser/components/tabview/test/browser_tabview_bug628887.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug628887.js rename to browser/components/tabview/test/browser_tabview_bug628887.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug629189.js b/browser/components/tabview/test/browser_tabview_bug629189.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug629189.js rename to browser/components/tabview/test/browser_tabview_bug629189.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug629195.js b/browser/components/tabview/test/browser_tabview_bug629195.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug629195.js rename to browser/components/tabview/test/browser_tabview_bug629195.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug630102.js b/browser/components/tabview/test/browser_tabview_bug630102.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug630102.js rename to browser/components/tabview/test/browser_tabview_bug630102.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug630157.js b/browser/components/tabview/test/browser_tabview_bug630157.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug630157.js rename to browser/components/tabview/test/browser_tabview_bug630157.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug631662.js b/browser/components/tabview/test/browser_tabview_bug631662.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug631662.js rename to browser/components/tabview/test/browser_tabview_bug631662.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug631752.js b/browser/components/tabview/test/browser_tabview_bug631752.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug631752.js rename to browser/components/tabview/test/browser_tabview_bug631752.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug633190.js b/browser/components/tabview/test/browser_tabview_bug633190.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug633190.js rename to browser/components/tabview/test/browser_tabview_bug633190.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug633788.js b/browser/components/tabview/test/browser_tabview_bug633788.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug633788.js rename to browser/components/tabview/test/browser_tabview_bug633788.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug634077.js b/browser/components/tabview/test/browser_tabview_bug634077.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug634077.js rename to browser/components/tabview/test/browser_tabview_bug634077.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug634085.js b/browser/components/tabview/test/browser_tabview_bug634085.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug634085.js rename to browser/components/tabview/test/browser_tabview_bug634085.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug634672.js b/browser/components/tabview/test/browser_tabview_bug634672.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug634672.js rename to browser/components/tabview/test/browser_tabview_bug634672.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug635696.js b/browser/components/tabview/test/browser_tabview_bug635696.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug635696.js rename to browser/components/tabview/test/browser_tabview_bug635696.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug637840.js b/browser/components/tabview/test/browser_tabview_bug637840.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug637840.js rename to browser/components/tabview/test/browser_tabview_bug637840.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug640765.js b/browser/components/tabview/test/browser_tabview_bug640765.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug640765.js rename to browser/components/tabview/test/browser_tabview_bug640765.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug641802.js b/browser/components/tabview/test/browser_tabview_bug641802.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug641802.js rename to browser/components/tabview/test/browser_tabview_bug641802.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug642793.js b/browser/components/tabview/test/browser_tabview_bug642793.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug642793.js rename to browser/components/tabview/test/browser_tabview_bug642793.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug643392.js b/browser/components/tabview/test/browser_tabview_bug643392.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug643392.js rename to browser/components/tabview/test/browser_tabview_bug643392.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug644097.js b/browser/components/tabview/test/browser_tabview_bug644097.js similarity index 94% rename from browser/base/content/test/tabview/browser_tabview_bug644097.js rename to browser/components/tabview/test/browser_tabview_bug644097.js index 2d44da65ef3..3d8fabb475f 100644 --- a/browser/base/content/test/tabview/browser_tabview_bug644097.js +++ b/browser/components/tabview/test/browser_tabview_bug644097.js @@ -12,7 +12,7 @@ function test() { // create some tabs with favIcons for (let i = 0; i < 3; i++) - win.gBrowser.loadOneTab("http://mochi.test:8888/browser/browser/base/content/test/tabview/test_bug644097.html", {inBackground: true}); + win.gBrowser.loadOneTab("http://mochi.test:8888/browser/browser/components/tabview/test/test_bug644097.html", {inBackground: true}); win.gBrowser.removeTab(win.gBrowser.tabs[0]); diff --git a/browser/base/content/test/tabview/browser_tabview_bug648882.js b/browser/components/tabview/test/browser_tabview_bug648882.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug648882.js rename to browser/components/tabview/test/browser_tabview_bug648882.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug649006.js b/browser/components/tabview/test/browser_tabview_bug649006.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug649006.js rename to browser/components/tabview/test/browser_tabview_bug649006.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug649307.js b/browser/components/tabview/test/browser_tabview_bug649307.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug649307.js rename to browser/components/tabview/test/browser_tabview_bug649307.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug649319.js b/browser/components/tabview/test/browser_tabview_bug649319.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug649319.js rename to browser/components/tabview/test/browser_tabview_bug649319.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug650280.js b/browser/components/tabview/test/browser_tabview_bug650280.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug650280.js rename to browser/components/tabview/test/browser_tabview_bug650280.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug650573.js b/browser/components/tabview/test/browser_tabview_bug650573.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug650573.js rename to browser/components/tabview/test/browser_tabview_bug650573.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug651311.js b/browser/components/tabview/test/browser_tabview_bug651311.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug651311.js rename to browser/components/tabview/test/browser_tabview_bug651311.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug654721.js b/browser/components/tabview/test/browser_tabview_bug654721.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug654721.js rename to browser/components/tabview/test/browser_tabview_bug654721.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug654941.js b/browser/components/tabview/test/browser_tabview_bug654941.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug654941.js rename to browser/components/tabview/test/browser_tabview_bug654941.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug655269.js b/browser/components/tabview/test/browser_tabview_bug655269.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug655269.js rename to browser/components/tabview/test/browser_tabview_bug655269.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug656778.js b/browser/components/tabview/test/browser_tabview_bug656778.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug656778.js rename to browser/components/tabview/test/browser_tabview_bug656778.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug656913.js b/browser/components/tabview/test/browser_tabview_bug656913.js similarity index 93% rename from browser/base/content/test/tabview/browser_tabview_bug656913.js rename to browser/components/tabview/test/browser_tabview_bug656913.js index e45a3c64fc4..e20e4ae3821 100644 --- a/browser/base/content/test/tabview/browser_tabview_bug656913.js +++ b/browser/components/tabview/test/browser_tabview_bug656913.js @@ -5,7 +5,7 @@ function test() { waitForExplicitFinish(); - let urlBase = "http://mochi.test:8888/browser/browser/base/content/test/tabview/"; + let urlBase = "http://mochi.test:8888/browser/browser/components/tabview/test/"; let newTab = gBrowser.addTab(urlBase + "search1.html"); registerCleanupFunction(function() { diff --git a/browser/base/content/test/tabview/browser_tabview_bug662266.js b/browser/components/tabview/test/browser_tabview_bug662266.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug662266.js rename to browser/components/tabview/test/browser_tabview_bug662266.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug663421.js b/browser/components/tabview/test/browser_tabview_bug663421.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug663421.js rename to browser/components/tabview/test/browser_tabview_bug663421.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug665502.js b/browser/components/tabview/test/browser_tabview_bug665502.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug665502.js rename to browser/components/tabview/test/browser_tabview_bug665502.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug669694.js b/browser/components/tabview/test/browser_tabview_bug669694.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug669694.js rename to browser/components/tabview/test/browser_tabview_bug669694.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug673196.js b/browser/components/tabview/test/browser_tabview_bug673196.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug673196.js rename to browser/components/tabview/test/browser_tabview_bug673196.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug673729.js b/browser/components/tabview/test/browser_tabview_bug673729.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug673729.js rename to browser/components/tabview/test/browser_tabview_bug673729.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug677310.js b/browser/components/tabview/test/browser_tabview_bug677310.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug677310.js rename to browser/components/tabview/test/browser_tabview_bug677310.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug679853.js b/browser/components/tabview/test/browser_tabview_bug679853.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug679853.js rename to browser/components/tabview/test/browser_tabview_bug679853.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug681599.js b/browser/components/tabview/test/browser_tabview_bug681599.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug681599.js rename to browser/components/tabview/test/browser_tabview_bug681599.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug685476.js b/browser/components/tabview/test/browser_tabview_bug685476.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug685476.js rename to browser/components/tabview/test/browser_tabview_bug685476.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug685692.js b/browser/components/tabview/test/browser_tabview_bug685692.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug685692.js rename to browser/components/tabview/test/browser_tabview_bug685692.js diff --git a/browser/base/content/test/tabview/browser_tabview_bug686654.js b/browser/components/tabview/test/browser_tabview_bug686654.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_bug686654.js rename to browser/components/tabview/test/browser_tabview_bug686654.js diff --git a/browser/base/content/test/tabview/browser_tabview_click_group.js b/browser/components/tabview/test/browser_tabview_click_group.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_click_group.js rename to browser/components/tabview/test/browser_tabview_click_group.js diff --git a/browser/base/content/test/tabview/browser_tabview_dragdrop.js b/browser/components/tabview/test/browser_tabview_dragdrop.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_dragdrop.js rename to browser/components/tabview/test/browser_tabview_dragdrop.js diff --git a/browser/base/content/test/tabview/browser_tabview_exit_button.js b/browser/components/tabview/test/browser_tabview_exit_button.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_exit_button.js rename to browser/components/tabview/test/browser_tabview_exit_button.js diff --git a/browser/base/content/test/tabview/browser_tabview_expander.js b/browser/components/tabview/test/browser_tabview_expander.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_expander.js rename to browser/components/tabview/test/browser_tabview_expander.js diff --git a/browser/base/content/test/tabview/browser_tabview_firstrun_pref.js b/browser/components/tabview/test/browser_tabview_firstrun_pref.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_firstrun_pref.js rename to browser/components/tabview/test/browser_tabview_firstrun_pref.js diff --git a/browser/base/content/test/tabview/browser_tabview_group.js b/browser/components/tabview/test/browser_tabview_group.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_group.js rename to browser/components/tabview/test/browser_tabview_group.js diff --git a/browser/base/content/test/tabview/browser_tabview_launch.js b/browser/components/tabview/test/browser_tabview_launch.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_launch.js rename to browser/components/tabview/test/browser_tabview_launch.js diff --git a/browser/base/content/test/tabview/browser_tabview_layout.js b/browser/components/tabview/test/browser_tabview_layout.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_layout.js rename to browser/components/tabview/test/browser_tabview_layout.js diff --git a/browser/base/content/test/tabview/browser_tabview_multiwindow_search.js b/browser/components/tabview/test/browser_tabview_multiwindow_search.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_multiwindow_search.js rename to browser/components/tabview/test/browser_tabview_multiwindow_search.js diff --git a/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js b/browser/components/tabview/test/browser_tabview_privatebrowsing.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_privatebrowsing.js rename to browser/components/tabview/test/browser_tabview_privatebrowsing.js diff --git a/browser/base/content/test/tabview/browser_tabview_rtl.js b/browser/components/tabview/test/browser_tabview_rtl.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_rtl.js rename to browser/components/tabview/test/browser_tabview_rtl.js diff --git a/browser/base/content/test/tabview/browser_tabview_search.js b/browser/components/tabview/test/browser_tabview_search.js similarity index 98% rename from browser/base/content/test/tabview/browser_tabview_search.js rename to browser/components/tabview/test/browser_tabview_search.js index 4096a14b2e5..29c8243670b 100644 --- a/browser/base/content/test/tabview/browser_tabview_search.js +++ b/browser/components/tabview/test/browser_tabview_search.js @@ -8,7 +8,7 @@ function test() { waitForExplicitFinish(); // set up our tabs - let urlBase = "http://mochi.test:8888/browser/browser/base/content/test/tabview/"; + let urlBase = "http://mochi.test:8888/browser/browser/components/tabview/test/"; let tabOne = gBrowser.addTab(urlBase + "search1.html"); let tabTwo = gBrowser.addTab(urlBase + "search2.html"); newTabs = [ tabOne, tabTwo ]; diff --git a/browser/base/content/test/tabview/browser_tabview_snapping.js b/browser/components/tabview/test/browser_tabview_snapping.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_snapping.js rename to browser/components/tabview/test/browser_tabview_snapping.js diff --git a/browser/base/content/test/tabview/browser_tabview_startup_transitions.js b/browser/components/tabview/test/browser_tabview_startup_transitions.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_startup_transitions.js rename to browser/components/tabview/test/browser_tabview_startup_transitions.js diff --git a/browser/base/content/test/tabview/browser_tabview_storage_policy.js b/browser/components/tabview/test/browser_tabview_storage_policy.js similarity index 97% rename from browser/base/content/test/tabview/browser_tabview_storage_policy.js rename to browser/components/tabview/test/browser_tabview_storage_policy.js index 0d5347f3bdb..df14a77f7bc 100644 --- a/browser/base/content/test/tabview/browser_tabview_storage_policy.js +++ b/browser/components/tabview/test/browser_tabview_storage_policy.js @@ -48,7 +48,7 @@ function test1() { HttpRequestObserver.cacheControlValue = null; }); - newTab.linkedBrowser.loadURI("http://www.example.com/browser/browser/base/content/test/tabview/dummy_page.html"); + newTab.linkedBrowser.loadURI("http://www.example.com/browser/browser/components/tabview/test/dummy_page.html"); } function test2() { @@ -73,7 +73,7 @@ function test3() { Services.prefs.setBoolPref(PREF_DISK_CACHE_SSL, true); - newTab.linkedBrowser.loadURI("https://example.com/browser/browser/base/content/test/tabview/dummy_page.html"); + newTab.linkedBrowser.loadURI("https://example.com/browser/browser/components/tabview/test/dummy_page.html"); afterAllTabsLoaded(function() { let tabItem = newTab._tabViewTabItem; @@ -91,7 +91,7 @@ function test4() { Services.prefs.setBoolPref(PREF_DISK_CACHE_SSL, false); - newTab.linkedBrowser.loadURI("https://example.com/browser/browser/base/content/test/tabview/"); + newTab.linkedBrowser.loadURI("https://example.com/browser/browser/components/tabview/test/"); afterAllTabsLoaded(function() { let tabItem = newTab._tabViewTabItem; diff --git a/browser/base/content/test/tabview/browser_tabview_thumbnail_storage.js b/browser/components/tabview/test/browser_tabview_thumbnail_storage.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_thumbnail_storage.js rename to browser/components/tabview/test/browser_tabview_thumbnail_storage.js diff --git a/browser/base/content/test/tabview/browser_tabview_undo_group.js b/browser/components/tabview/test/browser_tabview_undo_group.js similarity index 100% rename from browser/base/content/test/tabview/browser_tabview_undo_group.js rename to browser/components/tabview/test/browser_tabview_undo_group.js diff --git a/browser/base/content/test/tabview/dummy_page.html b/browser/components/tabview/test/dummy_page.html similarity index 100% rename from browser/base/content/test/tabview/dummy_page.html rename to browser/components/tabview/test/dummy_page.html diff --git a/browser/base/content/test/tabview/head.js b/browser/components/tabview/test/head.js similarity index 100% rename from browser/base/content/test/tabview/head.js rename to browser/components/tabview/test/head.js diff --git a/browser/base/content/test/tabview/search1.html b/browser/components/tabview/test/search1.html similarity index 100% rename from browser/base/content/test/tabview/search1.html rename to browser/components/tabview/test/search1.html diff --git a/browser/base/content/test/tabview/search2.html b/browser/components/tabview/test/search2.html similarity index 100% rename from browser/base/content/test/tabview/search2.html rename to browser/components/tabview/test/search2.html diff --git a/browser/base/content/test/tabview/test_bug600645.html b/browser/components/tabview/test/test_bug600645.html similarity index 100% rename from browser/base/content/test/tabview/test_bug600645.html rename to browser/components/tabview/test/test_bug600645.html diff --git a/browser/base/content/test/tabview/test_bug644097.html b/browser/components/tabview/test/test_bug644097.html similarity index 100% rename from browser/base/content/test/tabview/test_bug644097.html rename to browser/components/tabview/test/test_bug644097.html diff --git a/browser/base/content/tabview/thumbnailStorage.js b/browser/components/tabview/thumbnailStorage.js similarity index 100% rename from browser/base/content/tabview/thumbnailStorage.js rename to browser/components/tabview/thumbnailStorage.js diff --git a/browser/base/content/tabview/trench.js b/browser/components/tabview/trench.js similarity index 100% rename from browser/base/content/tabview/trench.js rename to browser/components/tabview/trench.js diff --git a/browser/base/content/tabview/ui.js b/browser/components/tabview/ui.js similarity index 100% rename from browser/base/content/tabview/ui.js rename to browser/components/tabview/ui.js From 961e7aa21e177412cd43b0aa1f9d24049ef045a0 Mon Sep 17 00:00:00 2001 From: Gavin Sharp Date: Thu, 6 Oct 2011 14:43:10 -0700 Subject: [PATCH 40/57] Backed out changeset bdd575bda8ab, since it accidentally also landed on mozilla-inbound with minor changes --- browser/base/Makefile.in | 3 ++ .../content}/tabview/content.js | 0 .../content}/tabview/drag.js | 0 .../content}/tabview/groupitems.js | 0 .../content}/tabview/iq.js | 0 .../content}/tabview/items.js | 0 .../content}/tabview/modules/utils.jsm | 0 .../content}/tabview/search.js | 0 .../content}/tabview/storage.js | 0 .../content}/tabview/storagePolicy.js | 0 .../content}/tabview/tabitems.js | 0 .../content}/tabview/tabview.css | 0 .../content}/tabview/tabview.html | 0 .../content}/tabview/tabview.js | 0 .../content}/tabview/thumbnailStorage.js | 0 .../content}/tabview/trench.js | 0 .../content}/tabview/ui.js | 0 browser/base/content/test/Makefile.in | 4 ++ .../content/test/tabview}/Makefile.in | 4 +- .../test/tabview}/browser_tabview_alltabs.js | 0 .../test/tabview}/browser_tabview_apptabs.js | 0 .../tabview}/browser_tabview_bug580412.js | 0 .../tabview}/browser_tabview_bug586553.js | 0 .../tabview}/browser_tabview_bug587043.js | 0 .../tabview}/browser_tabview_bug587231.js | 0 .../tabview}/browser_tabview_bug587276.js | 0 .../tabview}/browser_tabview_bug587351.js | 0 .../tabview}/browser_tabview_bug587503.js | 0 .../tabview}/browser_tabview_bug587990.js | 0 .../tabview}/browser_tabview_bug588265.js | 0 .../tabview}/browser_tabview_bug589324.js | 2 +- .../tabview}/browser_tabview_bug590606.js | 0 .../tabview}/browser_tabview_bug591706.js | 0 .../tabview}/browser_tabview_bug593283.js | 0 .../tabview}/browser_tabview_bug594958.js | 0 .../tabview}/browser_tabview_bug595020.js | 0 .../tabview}/browser_tabview_bug595191.js | 0 .../tabview}/browser_tabview_bug595436.js | 0 .../tabview}/browser_tabview_bug595518.js | 0 .../tabview}/browser_tabview_bug595521.js | 0 .../tabview}/browser_tabview_bug595560.js | 0 .../tabview}/browser_tabview_bug595601.js | 0 .../tabview}/browser_tabview_bug595804.js | 0 .../tabview}/browser_tabview_bug595930.js | 0 .../tabview}/browser_tabview_bug595943.js | 0 .../tabview}/browser_tabview_bug595965.js | 0 .../tabview}/browser_tabview_bug596781.js | 0 .../tabview}/browser_tabview_bug597248.js | 4 +- .../tabview}/browser_tabview_bug597360.js | 0 .../tabview}/browser_tabview_bug597399.js | 0 .../tabview}/browser_tabview_bug597980.js | 0 .../tabview}/browser_tabview_bug598375.js | 0 .../tabview}/browser_tabview_bug598600.js | 0 .../tabview}/browser_tabview_bug599626.js | 0 .../tabview}/browser_tabview_bug600645.js | 2 +- .../tabview}/browser_tabview_bug600812.js | 0 .../tabview}/browser_tabview_bug602432.js | 0 .../tabview}/browser_tabview_bug604098.js | 0 .../tabview}/browser_tabview_bug606657.js | 0 .../tabview}/browser_tabview_bug606905.js | 0 .../tabview}/browser_tabview_bug607108.js | 0 .../tabview}/browser_tabview_bug608037.js | 2 +- .../tabview}/browser_tabview_bug608158.js | 0 .../tabview}/browser_tabview_bug608184.js | 0 .../tabview}/browser_tabview_bug608405.js | 0 .../tabview}/browser_tabview_bug610208.js | 0 .../tabview}/browser_tabview_bug610242.js | 0 .../tabview}/browser_tabview_bug612470.js | 0 .../tabview}/browser_tabview_bug613541.js | 0 .../tabview}/browser_tabview_bug616729.js | 0 .../tabview}/browser_tabview_bug616967.js | 0 .../tabview}/browser_tabview_bug618816.js | 0 .../tabview}/browser_tabview_bug618828.js | 0 .../tabview}/browser_tabview_bug619937.js | 0 .../tabview}/browser_tabview_bug622835.js | 0 .../tabview}/browser_tabview_bug623768.js | 0 .../tabview}/browser_tabview_bug624265.js | 0 .../tabview}/browser_tabview_bug624692.js | 0 .../tabview}/browser_tabview_bug624727.js | 0 .../tabview}/browser_tabview_bug624847.js | 0 .../tabview}/browser_tabview_bug624931.js | 0 .../tabview}/browser_tabview_bug624953.js | 0 .../tabview}/browser_tabview_bug625195.js | 0 .../tabview}/browser_tabview_bug625269.js | 0 .../tabview}/browser_tabview_bug625424.js | 0 .../tabview}/browser_tabview_bug625955.js | 0 .../tabview}/browser_tabview_bug626368.js | 0 .../tabview}/browser_tabview_bug626455.js | 0 .../tabview}/browser_tabview_bug626525.js | 0 .../tabview}/browser_tabview_bug626791.js | 0 .../tabview}/browser_tabview_bug627288.js | 0 .../tabview}/browser_tabview_bug627736.js | 0 .../tabview}/browser_tabview_bug628061.js | 0 .../tabview}/browser_tabview_bug628165.js | 0 .../tabview}/browser_tabview_bug628270.js | 0 .../tabview}/browser_tabview_bug628887.js | 0 .../tabview}/browser_tabview_bug629189.js | 0 .../tabview}/browser_tabview_bug629195.js | 0 .../tabview}/browser_tabview_bug630102.js | 0 .../tabview}/browser_tabview_bug630157.js | 0 .../tabview}/browser_tabview_bug631662.js | 0 .../tabview}/browser_tabview_bug631752.js | 0 .../tabview}/browser_tabview_bug633190.js | 0 .../tabview}/browser_tabview_bug633788.js | 0 .../tabview}/browser_tabview_bug634077.js | 0 .../tabview}/browser_tabview_bug634085.js | 0 .../tabview}/browser_tabview_bug634672.js | 0 .../tabview}/browser_tabview_bug635696.js | 0 .../tabview}/browser_tabview_bug637840.js | 0 .../tabview}/browser_tabview_bug640765.js | 0 .../tabview}/browser_tabview_bug641802.js | 0 .../tabview}/browser_tabview_bug642793.js | 0 .../tabview}/browser_tabview_bug643392.js | 0 .../tabview}/browser_tabview_bug644097.js | 2 +- .../tabview}/browser_tabview_bug648882.js | 0 .../tabview}/browser_tabview_bug649006.js | 0 .../tabview}/browser_tabview_bug649307.js | 0 .../tabview}/browser_tabview_bug649319.js | 0 .../tabview}/browser_tabview_bug650280.js | 0 .../tabview}/browser_tabview_bug650573.js | 0 .../tabview}/browser_tabview_bug651311.js | 0 .../tabview}/browser_tabview_bug654721.js | 0 .../tabview}/browser_tabview_bug654941.js | 0 .../tabview}/browser_tabview_bug655269.js | 0 .../tabview}/browser_tabview_bug656778.js | 0 .../tabview}/browser_tabview_bug656913.js | 2 +- .../tabview}/browser_tabview_bug662266.js | 0 .../tabview}/browser_tabview_bug663421.js | 0 .../tabview}/browser_tabview_bug665502.js | 0 .../tabview}/browser_tabview_bug669694.js | 0 .../tabview}/browser_tabview_bug673196.js | 0 .../tabview}/browser_tabview_bug673729.js | 0 .../tabview}/browser_tabview_bug677310.js | 0 .../tabview}/browser_tabview_bug679853.js | 0 .../tabview}/browser_tabview_bug681599.js | 0 .../tabview}/browser_tabview_bug685476.js | 0 .../tabview}/browser_tabview_bug685692.js | 0 .../tabview}/browser_tabview_bug686654.js | 0 .../tabview}/browser_tabview_click_group.js | 0 .../test/tabview}/browser_tabview_dragdrop.js | 0 .../tabview}/browser_tabview_exit_button.js | 0 .../test/tabview}/browser_tabview_expander.js | 0 .../tabview}/browser_tabview_firstrun_pref.js | 0 .../test/tabview}/browser_tabview_group.js | 0 .../test/tabview}/browser_tabview_launch.js | 0 .../test/tabview}/browser_tabview_layout.js | 0 .../browser_tabview_multiwindow_search.js | 0 .../browser_tabview_privatebrowsing.js | 0 .../test/tabview}/browser_tabview_rtl.js | 0 .../test/tabview}/browser_tabview_search.js | 2 +- .../test/tabview}/browser_tabview_snapping.js | 0 .../browser_tabview_startup_transitions.js | 0 .../browser_tabview_storage_policy.js | 6 +-- .../browser_tabview_thumbnail_storage.js | 0 .../tabview}/browser_tabview_undo_group.js | 0 .../content/test/tabview}/dummy_page.html | 0 .../content/test/tabview}/head.js | 0 .../content/test/tabview}/search1.html | 0 .../content/test/tabview}/search2.html | 0 .../content/test/tabview}/test_bug600645.html | 0 .../content/test/tabview}/test_bug644097.html | 0 browser/base/jar.mn | 4 ++ browser/components/Makefile.in | 1 - browser/components/tabview/Makefile.in | 53 ------------------- browser/components/tabview/jar.mn | 5 -- 165 files changed, 24 insertions(+), 72 deletions(-) rename browser/{components => base/content}/tabview/content.js (100%) rename browser/{components => base/content}/tabview/drag.js (100%) rename browser/{components => base/content}/tabview/groupitems.js (100%) rename browser/{components => base/content}/tabview/iq.js (100%) rename browser/{components => base/content}/tabview/items.js (100%) rename browser/{components => base/content}/tabview/modules/utils.jsm (100%) rename browser/{components => base/content}/tabview/search.js (100%) rename browser/{components => base/content}/tabview/storage.js (100%) rename browser/{components => base/content}/tabview/storagePolicy.js (100%) rename browser/{components => base/content}/tabview/tabitems.js (100%) rename browser/{components => base/content}/tabview/tabview.css (100%) rename browser/{components => base/content}/tabview/tabview.html (100%) rename browser/{components => base/content}/tabview/tabview.js (100%) rename browser/{components => base/content}/tabview/thumbnailStorage.js (100%) rename browser/{components => base/content}/tabview/trench.js (100%) rename browser/{components => base/content}/tabview/ui.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/Makefile.in (99%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_alltabs.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_apptabs.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug580412.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug586553.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug587043.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug587231.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug587276.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug587351.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug587503.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug587990.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug588265.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug589324.js (96%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug590606.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug591706.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug593283.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug594958.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595020.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595191.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595436.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595518.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595521.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595560.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595601.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595804.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595930.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595943.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug595965.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug596781.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug597248.js (95%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug597360.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug597399.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug597980.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug598375.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug598600.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug599626.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug600645.js (96%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug600812.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug602432.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug604098.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug606657.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug606905.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug607108.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug608037.js (96%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug608158.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug608184.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug608405.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug610208.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug610242.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug612470.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug613541.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug616729.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug616967.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug618816.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug618828.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug619937.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug622835.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug623768.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug624265.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug624692.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug624727.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug624847.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug624931.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug624953.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug625195.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug625269.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug625424.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug625955.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug626368.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug626455.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug626525.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug626791.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug627288.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug627736.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug628061.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug628165.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug628270.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug628887.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug629189.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug629195.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug630102.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug630157.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug631662.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug631752.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug633190.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug633788.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug634077.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug634085.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug634672.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug635696.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug637840.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug640765.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug641802.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug642793.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug643392.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug644097.js (94%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug648882.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug649006.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug649307.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug649319.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug650280.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug650573.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug651311.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug654721.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug654941.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug655269.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug656778.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug656913.js (93%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug662266.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug663421.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug665502.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug669694.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug673196.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug673729.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug677310.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug679853.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug681599.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug685476.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug685692.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_bug686654.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_click_group.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_dragdrop.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_exit_button.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_expander.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_firstrun_pref.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_group.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_launch.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_layout.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_multiwindow_search.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_privatebrowsing.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_rtl.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_search.js (98%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_snapping.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_startup_transitions.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_storage_policy.js (97%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_thumbnail_storage.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/browser_tabview_undo_group.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/dummy_page.html (100%) rename browser/{components/tabview/test => base/content/test/tabview}/head.js (100%) rename browser/{components/tabview/test => base/content/test/tabview}/search1.html (100%) rename browser/{components/tabview/test => base/content/test/tabview}/search2.html (100%) rename browser/{components/tabview/test => base/content/test/tabview}/test_bug600645.html (100%) rename browser/{components/tabview/test => base/content/test/tabview}/test_bug644097.html (100%) delete mode 100644 browser/components/tabview/Makefile.in delete mode 100644 browser/components/tabview/jar.mn diff --git a/browser/base/Makefile.in b/browser/base/Makefile.in index 3523ab62895..df14dfeddfa 100644 --- a/browser/base/Makefile.in +++ b/browser/base/Makefile.in @@ -83,3 +83,6 @@ endif ifneq (,$(filter windows gtk2, $(MOZ_WIDGET_TOOLKIT))) DEFINES += -DMENUBAR_CAN_AUTOHIDE=1 endif + +libs:: + $(NSINSTALL) $(srcdir)/content/tabview/modules/* $(FINAL_TARGET)/modules/tabview diff --git a/browser/components/tabview/content.js b/browser/base/content/tabview/content.js similarity index 100% rename from browser/components/tabview/content.js rename to browser/base/content/tabview/content.js diff --git a/browser/components/tabview/drag.js b/browser/base/content/tabview/drag.js similarity index 100% rename from browser/components/tabview/drag.js rename to browser/base/content/tabview/drag.js diff --git a/browser/components/tabview/groupitems.js b/browser/base/content/tabview/groupitems.js similarity index 100% rename from browser/components/tabview/groupitems.js rename to browser/base/content/tabview/groupitems.js diff --git a/browser/components/tabview/iq.js b/browser/base/content/tabview/iq.js similarity index 100% rename from browser/components/tabview/iq.js rename to browser/base/content/tabview/iq.js diff --git a/browser/components/tabview/items.js b/browser/base/content/tabview/items.js similarity index 100% rename from browser/components/tabview/items.js rename to browser/base/content/tabview/items.js diff --git a/browser/components/tabview/modules/utils.jsm b/browser/base/content/tabview/modules/utils.jsm similarity index 100% rename from browser/components/tabview/modules/utils.jsm rename to browser/base/content/tabview/modules/utils.jsm diff --git a/browser/components/tabview/search.js b/browser/base/content/tabview/search.js similarity index 100% rename from browser/components/tabview/search.js rename to browser/base/content/tabview/search.js diff --git a/browser/components/tabview/storage.js b/browser/base/content/tabview/storage.js similarity index 100% rename from browser/components/tabview/storage.js rename to browser/base/content/tabview/storage.js diff --git a/browser/components/tabview/storagePolicy.js b/browser/base/content/tabview/storagePolicy.js similarity index 100% rename from browser/components/tabview/storagePolicy.js rename to browser/base/content/tabview/storagePolicy.js diff --git a/browser/components/tabview/tabitems.js b/browser/base/content/tabview/tabitems.js similarity index 100% rename from browser/components/tabview/tabitems.js rename to browser/base/content/tabview/tabitems.js diff --git a/browser/components/tabview/tabview.css b/browser/base/content/tabview/tabview.css similarity index 100% rename from browser/components/tabview/tabview.css rename to browser/base/content/tabview/tabview.css diff --git a/browser/components/tabview/tabview.html b/browser/base/content/tabview/tabview.html similarity index 100% rename from browser/components/tabview/tabview.html rename to browser/base/content/tabview/tabview.html diff --git a/browser/components/tabview/tabview.js b/browser/base/content/tabview/tabview.js similarity index 100% rename from browser/components/tabview/tabview.js rename to browser/base/content/tabview/tabview.js diff --git a/browser/components/tabview/thumbnailStorage.js b/browser/base/content/tabview/thumbnailStorage.js similarity index 100% rename from browser/components/tabview/thumbnailStorage.js rename to browser/base/content/tabview/thumbnailStorage.js diff --git a/browser/components/tabview/trench.js b/browser/base/content/tabview/trench.js similarity index 100% rename from browser/components/tabview/trench.js rename to browser/base/content/tabview/trench.js diff --git a/browser/components/tabview/ui.js b/browser/base/content/tabview/ui.js similarity index 100% rename from browser/components/tabview/ui.js rename to browser/base/content/tabview/ui.js diff --git a/browser/base/content/test/Makefile.in b/browser/base/content/test/Makefile.in index 59a0c58e6cf..d4dcd04986a 100644 --- a/browser/base/content/test/Makefile.in +++ b/browser/base/content/test/Makefile.in @@ -40,6 +40,10 @@ srcdir = @srcdir@ VPATH = @srcdir@ relativesrcdir = browser/base/content/test +DIRS += \ + tabview \ + $(NULL) + include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk diff --git a/browser/components/tabview/test/Makefile.in b/browser/base/content/test/tabview/Makefile.in similarity index 99% rename from browser/components/tabview/test/Makefile.in rename to browser/base/content/test/tabview/Makefile.in index 81807e1cce1..785606e0cbc 100644 --- a/browser/components/tabview/test/Makefile.in +++ b/browser/base/content/test/tabview/Makefile.in @@ -34,11 +34,11 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../../.. +DEPTH = ../../../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ -relativesrcdir = browser/components/tabview/test +relativesrcdir = browser/base/content/test/tabview include $(DEPTH)/config/autoconf.mk include $(topsrcdir)/config/rules.mk diff --git a/browser/components/tabview/test/browser_tabview_alltabs.js b/browser/base/content/test/tabview/browser_tabview_alltabs.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_alltabs.js rename to browser/base/content/test/tabview/browser_tabview_alltabs.js diff --git a/browser/components/tabview/test/browser_tabview_apptabs.js b/browser/base/content/test/tabview/browser_tabview_apptabs.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_apptabs.js rename to browser/base/content/test/tabview/browser_tabview_apptabs.js diff --git a/browser/components/tabview/test/browser_tabview_bug580412.js b/browser/base/content/test/tabview/browser_tabview_bug580412.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug580412.js rename to browser/base/content/test/tabview/browser_tabview_bug580412.js diff --git a/browser/components/tabview/test/browser_tabview_bug586553.js b/browser/base/content/test/tabview/browser_tabview_bug586553.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug586553.js rename to browser/base/content/test/tabview/browser_tabview_bug586553.js diff --git a/browser/components/tabview/test/browser_tabview_bug587043.js b/browser/base/content/test/tabview/browser_tabview_bug587043.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug587043.js rename to browser/base/content/test/tabview/browser_tabview_bug587043.js diff --git a/browser/components/tabview/test/browser_tabview_bug587231.js b/browser/base/content/test/tabview/browser_tabview_bug587231.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug587231.js rename to browser/base/content/test/tabview/browser_tabview_bug587231.js diff --git a/browser/components/tabview/test/browser_tabview_bug587276.js b/browser/base/content/test/tabview/browser_tabview_bug587276.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug587276.js rename to browser/base/content/test/tabview/browser_tabview_bug587276.js diff --git a/browser/components/tabview/test/browser_tabview_bug587351.js b/browser/base/content/test/tabview/browser_tabview_bug587351.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug587351.js rename to browser/base/content/test/tabview/browser_tabview_bug587351.js diff --git a/browser/components/tabview/test/browser_tabview_bug587503.js b/browser/base/content/test/tabview/browser_tabview_bug587503.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug587503.js rename to browser/base/content/test/tabview/browser_tabview_bug587503.js diff --git a/browser/components/tabview/test/browser_tabview_bug587990.js b/browser/base/content/test/tabview/browser_tabview_bug587990.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug587990.js rename to browser/base/content/test/tabview/browser_tabview_bug587990.js diff --git a/browser/components/tabview/test/browser_tabview_bug588265.js b/browser/base/content/test/tabview/browser_tabview_bug588265.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug588265.js rename to browser/base/content/test/tabview/browser_tabview_bug588265.js diff --git a/browser/components/tabview/test/browser_tabview_bug589324.js b/browser/base/content/test/tabview/browser_tabview_bug589324.js similarity index 96% rename from browser/components/tabview/test/browser_tabview_bug589324.js rename to browser/base/content/test/tabview/browser_tabview_bug589324.js index 43d590bb612..a70dffdbc0f 100644 --- a/browser/components/tabview/test/browser_tabview_bug589324.js +++ b/browser/base/content/test/tabview/browser_tabview_bug589324.js @@ -1,7 +1,7 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -const DUMMY_PAGE_URL = "http://mochi.test:8888/browser/browser/components/tabview/test/dummy_page.html"; +const DUMMY_PAGE_URL = "http://mochi.test:8888/browser/browser/base/content/test/tabview/dummy_page.html"; const DUMMY_PAGE_URL_2 = "http://mochi.test:8888/"; let state = { diff --git a/browser/components/tabview/test/browser_tabview_bug590606.js b/browser/base/content/test/tabview/browser_tabview_bug590606.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug590606.js rename to browser/base/content/test/tabview/browser_tabview_bug590606.js diff --git a/browser/components/tabview/test/browser_tabview_bug591706.js b/browser/base/content/test/tabview/browser_tabview_bug591706.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug591706.js rename to browser/base/content/test/tabview/browser_tabview_bug591706.js diff --git a/browser/components/tabview/test/browser_tabview_bug593283.js b/browser/base/content/test/tabview/browser_tabview_bug593283.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug593283.js rename to browser/base/content/test/tabview/browser_tabview_bug593283.js diff --git a/browser/components/tabview/test/browser_tabview_bug594958.js b/browser/base/content/test/tabview/browser_tabview_bug594958.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug594958.js rename to browser/base/content/test/tabview/browser_tabview_bug594958.js diff --git a/browser/components/tabview/test/browser_tabview_bug595020.js b/browser/base/content/test/tabview/browser_tabview_bug595020.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595020.js rename to browser/base/content/test/tabview/browser_tabview_bug595020.js diff --git a/browser/components/tabview/test/browser_tabview_bug595191.js b/browser/base/content/test/tabview/browser_tabview_bug595191.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595191.js rename to browser/base/content/test/tabview/browser_tabview_bug595191.js diff --git a/browser/components/tabview/test/browser_tabview_bug595436.js b/browser/base/content/test/tabview/browser_tabview_bug595436.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595436.js rename to browser/base/content/test/tabview/browser_tabview_bug595436.js diff --git a/browser/components/tabview/test/browser_tabview_bug595518.js b/browser/base/content/test/tabview/browser_tabview_bug595518.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595518.js rename to browser/base/content/test/tabview/browser_tabview_bug595518.js diff --git a/browser/components/tabview/test/browser_tabview_bug595521.js b/browser/base/content/test/tabview/browser_tabview_bug595521.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595521.js rename to browser/base/content/test/tabview/browser_tabview_bug595521.js diff --git a/browser/components/tabview/test/browser_tabview_bug595560.js b/browser/base/content/test/tabview/browser_tabview_bug595560.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595560.js rename to browser/base/content/test/tabview/browser_tabview_bug595560.js diff --git a/browser/components/tabview/test/browser_tabview_bug595601.js b/browser/base/content/test/tabview/browser_tabview_bug595601.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595601.js rename to browser/base/content/test/tabview/browser_tabview_bug595601.js diff --git a/browser/components/tabview/test/browser_tabview_bug595804.js b/browser/base/content/test/tabview/browser_tabview_bug595804.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595804.js rename to browser/base/content/test/tabview/browser_tabview_bug595804.js diff --git a/browser/components/tabview/test/browser_tabview_bug595930.js b/browser/base/content/test/tabview/browser_tabview_bug595930.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595930.js rename to browser/base/content/test/tabview/browser_tabview_bug595930.js diff --git a/browser/components/tabview/test/browser_tabview_bug595943.js b/browser/base/content/test/tabview/browser_tabview_bug595943.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595943.js rename to browser/base/content/test/tabview/browser_tabview_bug595943.js diff --git a/browser/components/tabview/test/browser_tabview_bug595965.js b/browser/base/content/test/tabview/browser_tabview_bug595965.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug595965.js rename to browser/base/content/test/tabview/browser_tabview_bug595965.js diff --git a/browser/components/tabview/test/browser_tabview_bug596781.js b/browser/base/content/test/tabview/browser_tabview_bug596781.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug596781.js rename to browser/base/content/test/tabview/browser_tabview_bug596781.js diff --git a/browser/components/tabview/test/browser_tabview_bug597248.js b/browser/base/content/test/tabview/browser_tabview_bug597248.js similarity index 95% rename from browser/components/tabview/test/browser_tabview_bug597248.js rename to browser/base/content/test/tabview/browser_tabview_bug597248.js index 98490c1b29f..eeb8dfe0f55 100644 --- a/browser/components/tabview/test/browser_tabview_bug597248.js +++ b/browser/base/content/test/tabview/browser_tabview_bug597248.js @@ -16,8 +16,8 @@ function test() { function setupOne(win) { win.TabView.firstUseExperienced = true; - win.gBrowser.addTab("http://mochi.test:8888/browser/browser/components/tabview/test/search1.html"); - win.gBrowser.addTab("http://mochi.test:8888/browser/browser/components/tabview/test/dummy_page.html"); + win.gBrowser.addTab("http://mochi.test:8888/browser/browser/base/content/test/tabview/search1.html"); + win.gBrowser.addTab("http://mochi.test:8888/browser/browser/base/content/test/tabview/dummy_page.html"); afterAllTabsLoaded(function () setupTwo(win), win); } diff --git a/browser/components/tabview/test/browser_tabview_bug597360.js b/browser/base/content/test/tabview/browser_tabview_bug597360.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug597360.js rename to browser/base/content/test/tabview/browser_tabview_bug597360.js diff --git a/browser/components/tabview/test/browser_tabview_bug597399.js b/browser/base/content/test/tabview/browser_tabview_bug597399.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug597399.js rename to browser/base/content/test/tabview/browser_tabview_bug597399.js diff --git a/browser/components/tabview/test/browser_tabview_bug597980.js b/browser/base/content/test/tabview/browser_tabview_bug597980.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug597980.js rename to browser/base/content/test/tabview/browser_tabview_bug597980.js diff --git a/browser/components/tabview/test/browser_tabview_bug598375.js b/browser/base/content/test/tabview/browser_tabview_bug598375.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug598375.js rename to browser/base/content/test/tabview/browser_tabview_bug598375.js diff --git a/browser/components/tabview/test/browser_tabview_bug598600.js b/browser/base/content/test/tabview/browser_tabview_bug598600.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug598600.js rename to browser/base/content/test/tabview/browser_tabview_bug598600.js diff --git a/browser/components/tabview/test/browser_tabview_bug599626.js b/browser/base/content/test/tabview/browser_tabview_bug599626.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug599626.js rename to browser/base/content/test/tabview/browser_tabview_bug599626.js diff --git a/browser/components/tabview/test/browser_tabview_bug600645.js b/browser/base/content/test/tabview/browser_tabview_bug600645.js similarity index 96% rename from browser/components/tabview/test/browser_tabview_bug600645.js rename to browser/base/content/test/tabview/browser_tabview_bug600645.js index f079af74463..8ee342e38ce 100644 --- a/browser/components/tabview/test/browser_tabview_bug600645.js +++ b/browser/base/content/test/tabview/browser_tabview_bug600645.js @@ -68,5 +68,5 @@ function onTabViewWindowLoaded() { newTab.addEventListener("error", errorHandler, false); newTab.linkedBrowser.loadURI( - "http://mochi.test:8888/browser/browser/components/tabview/test/test_bug600645.html"); + "http://mochi.test:8888/browser/browser/base/content/test/tabview/test_bug600645.html"); } diff --git a/browser/components/tabview/test/browser_tabview_bug600812.js b/browser/base/content/test/tabview/browser_tabview_bug600812.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug600812.js rename to browser/base/content/test/tabview/browser_tabview_bug600812.js diff --git a/browser/components/tabview/test/browser_tabview_bug602432.js b/browser/base/content/test/tabview/browser_tabview_bug602432.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug602432.js rename to browser/base/content/test/tabview/browser_tabview_bug602432.js diff --git a/browser/components/tabview/test/browser_tabview_bug604098.js b/browser/base/content/test/tabview/browser_tabview_bug604098.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug604098.js rename to browser/base/content/test/tabview/browser_tabview_bug604098.js diff --git a/browser/components/tabview/test/browser_tabview_bug606657.js b/browser/base/content/test/tabview/browser_tabview_bug606657.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug606657.js rename to browser/base/content/test/tabview/browser_tabview_bug606657.js diff --git a/browser/components/tabview/test/browser_tabview_bug606905.js b/browser/base/content/test/tabview/browser_tabview_bug606905.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug606905.js rename to browser/base/content/test/tabview/browser_tabview_bug606905.js diff --git a/browser/components/tabview/test/browser_tabview_bug607108.js b/browser/base/content/test/tabview/browser_tabview_bug607108.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug607108.js rename to browser/base/content/test/tabview/browser_tabview_bug607108.js diff --git a/browser/components/tabview/test/browser_tabview_bug608037.js b/browser/base/content/test/tabview/browser_tabview_bug608037.js similarity index 96% rename from browser/components/tabview/test/browser_tabview_bug608037.js rename to browser/base/content/test/tabview/browser_tabview_bug608037.js index 8e02d611fed..37b2f5f9691 100644 --- a/browser/components/tabview/test/browser_tabview_bug608037.js +++ b/browser/base/content/test/tabview/browser_tabview_bug608037.js @@ -8,7 +8,7 @@ function test() { waitForExplicitFinish(); tabOne = gBrowser.addTab("http://mochi.test:8888/"); - tabTwo = gBrowser.addTab("http://mochi.test:8888/browser/browser/components/tabview/test/dummy_page.html"); + tabTwo = gBrowser.addTab("http://mochi.test:8888/browser/browser/base/content/test/tabview/dummy_page.html"); afterAllTabsLoaded(function () { // make sure the tab one is selected because undoCloseTab() would remove diff --git a/browser/components/tabview/test/browser_tabview_bug608158.js b/browser/base/content/test/tabview/browser_tabview_bug608158.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug608158.js rename to browser/base/content/test/tabview/browser_tabview_bug608158.js diff --git a/browser/components/tabview/test/browser_tabview_bug608184.js b/browser/base/content/test/tabview/browser_tabview_bug608184.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug608184.js rename to browser/base/content/test/tabview/browser_tabview_bug608184.js diff --git a/browser/components/tabview/test/browser_tabview_bug608405.js b/browser/base/content/test/tabview/browser_tabview_bug608405.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug608405.js rename to browser/base/content/test/tabview/browser_tabview_bug608405.js diff --git a/browser/components/tabview/test/browser_tabview_bug610208.js b/browser/base/content/test/tabview/browser_tabview_bug610208.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug610208.js rename to browser/base/content/test/tabview/browser_tabview_bug610208.js diff --git a/browser/components/tabview/test/browser_tabview_bug610242.js b/browser/base/content/test/tabview/browser_tabview_bug610242.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug610242.js rename to browser/base/content/test/tabview/browser_tabview_bug610242.js diff --git a/browser/components/tabview/test/browser_tabview_bug612470.js b/browser/base/content/test/tabview/browser_tabview_bug612470.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug612470.js rename to browser/base/content/test/tabview/browser_tabview_bug612470.js diff --git a/browser/components/tabview/test/browser_tabview_bug613541.js b/browser/base/content/test/tabview/browser_tabview_bug613541.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug613541.js rename to browser/base/content/test/tabview/browser_tabview_bug613541.js diff --git a/browser/components/tabview/test/browser_tabview_bug616729.js b/browser/base/content/test/tabview/browser_tabview_bug616729.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug616729.js rename to browser/base/content/test/tabview/browser_tabview_bug616729.js diff --git a/browser/components/tabview/test/browser_tabview_bug616967.js b/browser/base/content/test/tabview/browser_tabview_bug616967.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug616967.js rename to browser/base/content/test/tabview/browser_tabview_bug616967.js diff --git a/browser/components/tabview/test/browser_tabview_bug618816.js b/browser/base/content/test/tabview/browser_tabview_bug618816.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug618816.js rename to browser/base/content/test/tabview/browser_tabview_bug618816.js diff --git a/browser/components/tabview/test/browser_tabview_bug618828.js b/browser/base/content/test/tabview/browser_tabview_bug618828.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug618828.js rename to browser/base/content/test/tabview/browser_tabview_bug618828.js diff --git a/browser/components/tabview/test/browser_tabview_bug619937.js b/browser/base/content/test/tabview/browser_tabview_bug619937.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug619937.js rename to browser/base/content/test/tabview/browser_tabview_bug619937.js diff --git a/browser/components/tabview/test/browser_tabview_bug622835.js b/browser/base/content/test/tabview/browser_tabview_bug622835.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug622835.js rename to browser/base/content/test/tabview/browser_tabview_bug622835.js diff --git a/browser/components/tabview/test/browser_tabview_bug623768.js b/browser/base/content/test/tabview/browser_tabview_bug623768.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug623768.js rename to browser/base/content/test/tabview/browser_tabview_bug623768.js diff --git a/browser/components/tabview/test/browser_tabview_bug624265.js b/browser/base/content/test/tabview/browser_tabview_bug624265.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug624265.js rename to browser/base/content/test/tabview/browser_tabview_bug624265.js diff --git a/browser/components/tabview/test/browser_tabview_bug624692.js b/browser/base/content/test/tabview/browser_tabview_bug624692.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug624692.js rename to browser/base/content/test/tabview/browser_tabview_bug624692.js diff --git a/browser/components/tabview/test/browser_tabview_bug624727.js b/browser/base/content/test/tabview/browser_tabview_bug624727.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug624727.js rename to browser/base/content/test/tabview/browser_tabview_bug624727.js diff --git a/browser/components/tabview/test/browser_tabview_bug624847.js b/browser/base/content/test/tabview/browser_tabview_bug624847.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug624847.js rename to browser/base/content/test/tabview/browser_tabview_bug624847.js diff --git a/browser/components/tabview/test/browser_tabview_bug624931.js b/browser/base/content/test/tabview/browser_tabview_bug624931.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug624931.js rename to browser/base/content/test/tabview/browser_tabview_bug624931.js diff --git a/browser/components/tabview/test/browser_tabview_bug624953.js b/browser/base/content/test/tabview/browser_tabview_bug624953.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug624953.js rename to browser/base/content/test/tabview/browser_tabview_bug624953.js diff --git a/browser/components/tabview/test/browser_tabview_bug625195.js b/browser/base/content/test/tabview/browser_tabview_bug625195.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug625195.js rename to browser/base/content/test/tabview/browser_tabview_bug625195.js diff --git a/browser/components/tabview/test/browser_tabview_bug625269.js b/browser/base/content/test/tabview/browser_tabview_bug625269.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug625269.js rename to browser/base/content/test/tabview/browser_tabview_bug625269.js diff --git a/browser/components/tabview/test/browser_tabview_bug625424.js b/browser/base/content/test/tabview/browser_tabview_bug625424.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug625424.js rename to browser/base/content/test/tabview/browser_tabview_bug625424.js diff --git a/browser/components/tabview/test/browser_tabview_bug625955.js b/browser/base/content/test/tabview/browser_tabview_bug625955.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug625955.js rename to browser/base/content/test/tabview/browser_tabview_bug625955.js diff --git a/browser/components/tabview/test/browser_tabview_bug626368.js b/browser/base/content/test/tabview/browser_tabview_bug626368.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug626368.js rename to browser/base/content/test/tabview/browser_tabview_bug626368.js diff --git a/browser/components/tabview/test/browser_tabview_bug626455.js b/browser/base/content/test/tabview/browser_tabview_bug626455.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug626455.js rename to browser/base/content/test/tabview/browser_tabview_bug626455.js diff --git a/browser/components/tabview/test/browser_tabview_bug626525.js b/browser/base/content/test/tabview/browser_tabview_bug626525.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug626525.js rename to browser/base/content/test/tabview/browser_tabview_bug626525.js diff --git a/browser/components/tabview/test/browser_tabview_bug626791.js b/browser/base/content/test/tabview/browser_tabview_bug626791.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug626791.js rename to browser/base/content/test/tabview/browser_tabview_bug626791.js diff --git a/browser/components/tabview/test/browser_tabview_bug627288.js b/browser/base/content/test/tabview/browser_tabview_bug627288.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug627288.js rename to browser/base/content/test/tabview/browser_tabview_bug627288.js diff --git a/browser/components/tabview/test/browser_tabview_bug627736.js b/browser/base/content/test/tabview/browser_tabview_bug627736.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug627736.js rename to browser/base/content/test/tabview/browser_tabview_bug627736.js diff --git a/browser/components/tabview/test/browser_tabview_bug628061.js b/browser/base/content/test/tabview/browser_tabview_bug628061.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug628061.js rename to browser/base/content/test/tabview/browser_tabview_bug628061.js diff --git a/browser/components/tabview/test/browser_tabview_bug628165.js b/browser/base/content/test/tabview/browser_tabview_bug628165.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug628165.js rename to browser/base/content/test/tabview/browser_tabview_bug628165.js diff --git a/browser/components/tabview/test/browser_tabview_bug628270.js b/browser/base/content/test/tabview/browser_tabview_bug628270.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug628270.js rename to browser/base/content/test/tabview/browser_tabview_bug628270.js diff --git a/browser/components/tabview/test/browser_tabview_bug628887.js b/browser/base/content/test/tabview/browser_tabview_bug628887.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug628887.js rename to browser/base/content/test/tabview/browser_tabview_bug628887.js diff --git a/browser/components/tabview/test/browser_tabview_bug629189.js b/browser/base/content/test/tabview/browser_tabview_bug629189.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug629189.js rename to browser/base/content/test/tabview/browser_tabview_bug629189.js diff --git a/browser/components/tabview/test/browser_tabview_bug629195.js b/browser/base/content/test/tabview/browser_tabview_bug629195.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug629195.js rename to browser/base/content/test/tabview/browser_tabview_bug629195.js diff --git a/browser/components/tabview/test/browser_tabview_bug630102.js b/browser/base/content/test/tabview/browser_tabview_bug630102.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug630102.js rename to browser/base/content/test/tabview/browser_tabview_bug630102.js diff --git a/browser/components/tabview/test/browser_tabview_bug630157.js b/browser/base/content/test/tabview/browser_tabview_bug630157.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug630157.js rename to browser/base/content/test/tabview/browser_tabview_bug630157.js diff --git a/browser/components/tabview/test/browser_tabview_bug631662.js b/browser/base/content/test/tabview/browser_tabview_bug631662.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug631662.js rename to browser/base/content/test/tabview/browser_tabview_bug631662.js diff --git a/browser/components/tabview/test/browser_tabview_bug631752.js b/browser/base/content/test/tabview/browser_tabview_bug631752.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug631752.js rename to browser/base/content/test/tabview/browser_tabview_bug631752.js diff --git a/browser/components/tabview/test/browser_tabview_bug633190.js b/browser/base/content/test/tabview/browser_tabview_bug633190.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug633190.js rename to browser/base/content/test/tabview/browser_tabview_bug633190.js diff --git a/browser/components/tabview/test/browser_tabview_bug633788.js b/browser/base/content/test/tabview/browser_tabview_bug633788.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug633788.js rename to browser/base/content/test/tabview/browser_tabview_bug633788.js diff --git a/browser/components/tabview/test/browser_tabview_bug634077.js b/browser/base/content/test/tabview/browser_tabview_bug634077.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug634077.js rename to browser/base/content/test/tabview/browser_tabview_bug634077.js diff --git a/browser/components/tabview/test/browser_tabview_bug634085.js b/browser/base/content/test/tabview/browser_tabview_bug634085.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug634085.js rename to browser/base/content/test/tabview/browser_tabview_bug634085.js diff --git a/browser/components/tabview/test/browser_tabview_bug634672.js b/browser/base/content/test/tabview/browser_tabview_bug634672.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug634672.js rename to browser/base/content/test/tabview/browser_tabview_bug634672.js diff --git a/browser/components/tabview/test/browser_tabview_bug635696.js b/browser/base/content/test/tabview/browser_tabview_bug635696.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug635696.js rename to browser/base/content/test/tabview/browser_tabview_bug635696.js diff --git a/browser/components/tabview/test/browser_tabview_bug637840.js b/browser/base/content/test/tabview/browser_tabview_bug637840.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug637840.js rename to browser/base/content/test/tabview/browser_tabview_bug637840.js diff --git a/browser/components/tabview/test/browser_tabview_bug640765.js b/browser/base/content/test/tabview/browser_tabview_bug640765.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug640765.js rename to browser/base/content/test/tabview/browser_tabview_bug640765.js diff --git a/browser/components/tabview/test/browser_tabview_bug641802.js b/browser/base/content/test/tabview/browser_tabview_bug641802.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug641802.js rename to browser/base/content/test/tabview/browser_tabview_bug641802.js diff --git a/browser/components/tabview/test/browser_tabview_bug642793.js b/browser/base/content/test/tabview/browser_tabview_bug642793.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug642793.js rename to browser/base/content/test/tabview/browser_tabview_bug642793.js diff --git a/browser/components/tabview/test/browser_tabview_bug643392.js b/browser/base/content/test/tabview/browser_tabview_bug643392.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug643392.js rename to browser/base/content/test/tabview/browser_tabview_bug643392.js diff --git a/browser/components/tabview/test/browser_tabview_bug644097.js b/browser/base/content/test/tabview/browser_tabview_bug644097.js similarity index 94% rename from browser/components/tabview/test/browser_tabview_bug644097.js rename to browser/base/content/test/tabview/browser_tabview_bug644097.js index 3d8fabb475f..2d44da65ef3 100644 --- a/browser/components/tabview/test/browser_tabview_bug644097.js +++ b/browser/base/content/test/tabview/browser_tabview_bug644097.js @@ -12,7 +12,7 @@ function test() { // create some tabs with favIcons for (let i = 0; i < 3; i++) - win.gBrowser.loadOneTab("http://mochi.test:8888/browser/browser/components/tabview/test/test_bug644097.html", {inBackground: true}); + win.gBrowser.loadOneTab("http://mochi.test:8888/browser/browser/base/content/test/tabview/test_bug644097.html", {inBackground: true}); win.gBrowser.removeTab(win.gBrowser.tabs[0]); diff --git a/browser/components/tabview/test/browser_tabview_bug648882.js b/browser/base/content/test/tabview/browser_tabview_bug648882.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug648882.js rename to browser/base/content/test/tabview/browser_tabview_bug648882.js diff --git a/browser/components/tabview/test/browser_tabview_bug649006.js b/browser/base/content/test/tabview/browser_tabview_bug649006.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug649006.js rename to browser/base/content/test/tabview/browser_tabview_bug649006.js diff --git a/browser/components/tabview/test/browser_tabview_bug649307.js b/browser/base/content/test/tabview/browser_tabview_bug649307.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug649307.js rename to browser/base/content/test/tabview/browser_tabview_bug649307.js diff --git a/browser/components/tabview/test/browser_tabview_bug649319.js b/browser/base/content/test/tabview/browser_tabview_bug649319.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug649319.js rename to browser/base/content/test/tabview/browser_tabview_bug649319.js diff --git a/browser/components/tabview/test/browser_tabview_bug650280.js b/browser/base/content/test/tabview/browser_tabview_bug650280.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug650280.js rename to browser/base/content/test/tabview/browser_tabview_bug650280.js diff --git a/browser/components/tabview/test/browser_tabview_bug650573.js b/browser/base/content/test/tabview/browser_tabview_bug650573.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug650573.js rename to browser/base/content/test/tabview/browser_tabview_bug650573.js diff --git a/browser/components/tabview/test/browser_tabview_bug651311.js b/browser/base/content/test/tabview/browser_tabview_bug651311.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug651311.js rename to browser/base/content/test/tabview/browser_tabview_bug651311.js diff --git a/browser/components/tabview/test/browser_tabview_bug654721.js b/browser/base/content/test/tabview/browser_tabview_bug654721.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug654721.js rename to browser/base/content/test/tabview/browser_tabview_bug654721.js diff --git a/browser/components/tabview/test/browser_tabview_bug654941.js b/browser/base/content/test/tabview/browser_tabview_bug654941.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug654941.js rename to browser/base/content/test/tabview/browser_tabview_bug654941.js diff --git a/browser/components/tabview/test/browser_tabview_bug655269.js b/browser/base/content/test/tabview/browser_tabview_bug655269.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug655269.js rename to browser/base/content/test/tabview/browser_tabview_bug655269.js diff --git a/browser/components/tabview/test/browser_tabview_bug656778.js b/browser/base/content/test/tabview/browser_tabview_bug656778.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug656778.js rename to browser/base/content/test/tabview/browser_tabview_bug656778.js diff --git a/browser/components/tabview/test/browser_tabview_bug656913.js b/browser/base/content/test/tabview/browser_tabview_bug656913.js similarity index 93% rename from browser/components/tabview/test/browser_tabview_bug656913.js rename to browser/base/content/test/tabview/browser_tabview_bug656913.js index e20e4ae3821..e45a3c64fc4 100644 --- a/browser/components/tabview/test/browser_tabview_bug656913.js +++ b/browser/base/content/test/tabview/browser_tabview_bug656913.js @@ -5,7 +5,7 @@ function test() { waitForExplicitFinish(); - let urlBase = "http://mochi.test:8888/browser/browser/components/tabview/test/"; + let urlBase = "http://mochi.test:8888/browser/browser/base/content/test/tabview/"; let newTab = gBrowser.addTab(urlBase + "search1.html"); registerCleanupFunction(function() { diff --git a/browser/components/tabview/test/browser_tabview_bug662266.js b/browser/base/content/test/tabview/browser_tabview_bug662266.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug662266.js rename to browser/base/content/test/tabview/browser_tabview_bug662266.js diff --git a/browser/components/tabview/test/browser_tabview_bug663421.js b/browser/base/content/test/tabview/browser_tabview_bug663421.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug663421.js rename to browser/base/content/test/tabview/browser_tabview_bug663421.js diff --git a/browser/components/tabview/test/browser_tabview_bug665502.js b/browser/base/content/test/tabview/browser_tabview_bug665502.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug665502.js rename to browser/base/content/test/tabview/browser_tabview_bug665502.js diff --git a/browser/components/tabview/test/browser_tabview_bug669694.js b/browser/base/content/test/tabview/browser_tabview_bug669694.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug669694.js rename to browser/base/content/test/tabview/browser_tabview_bug669694.js diff --git a/browser/components/tabview/test/browser_tabview_bug673196.js b/browser/base/content/test/tabview/browser_tabview_bug673196.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug673196.js rename to browser/base/content/test/tabview/browser_tabview_bug673196.js diff --git a/browser/components/tabview/test/browser_tabview_bug673729.js b/browser/base/content/test/tabview/browser_tabview_bug673729.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug673729.js rename to browser/base/content/test/tabview/browser_tabview_bug673729.js diff --git a/browser/components/tabview/test/browser_tabview_bug677310.js b/browser/base/content/test/tabview/browser_tabview_bug677310.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug677310.js rename to browser/base/content/test/tabview/browser_tabview_bug677310.js diff --git a/browser/components/tabview/test/browser_tabview_bug679853.js b/browser/base/content/test/tabview/browser_tabview_bug679853.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug679853.js rename to browser/base/content/test/tabview/browser_tabview_bug679853.js diff --git a/browser/components/tabview/test/browser_tabview_bug681599.js b/browser/base/content/test/tabview/browser_tabview_bug681599.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug681599.js rename to browser/base/content/test/tabview/browser_tabview_bug681599.js diff --git a/browser/components/tabview/test/browser_tabview_bug685476.js b/browser/base/content/test/tabview/browser_tabview_bug685476.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug685476.js rename to browser/base/content/test/tabview/browser_tabview_bug685476.js diff --git a/browser/components/tabview/test/browser_tabview_bug685692.js b/browser/base/content/test/tabview/browser_tabview_bug685692.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug685692.js rename to browser/base/content/test/tabview/browser_tabview_bug685692.js diff --git a/browser/components/tabview/test/browser_tabview_bug686654.js b/browser/base/content/test/tabview/browser_tabview_bug686654.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_bug686654.js rename to browser/base/content/test/tabview/browser_tabview_bug686654.js diff --git a/browser/components/tabview/test/browser_tabview_click_group.js b/browser/base/content/test/tabview/browser_tabview_click_group.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_click_group.js rename to browser/base/content/test/tabview/browser_tabview_click_group.js diff --git a/browser/components/tabview/test/browser_tabview_dragdrop.js b/browser/base/content/test/tabview/browser_tabview_dragdrop.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_dragdrop.js rename to browser/base/content/test/tabview/browser_tabview_dragdrop.js diff --git a/browser/components/tabview/test/browser_tabview_exit_button.js b/browser/base/content/test/tabview/browser_tabview_exit_button.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_exit_button.js rename to browser/base/content/test/tabview/browser_tabview_exit_button.js diff --git a/browser/components/tabview/test/browser_tabview_expander.js b/browser/base/content/test/tabview/browser_tabview_expander.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_expander.js rename to browser/base/content/test/tabview/browser_tabview_expander.js diff --git a/browser/components/tabview/test/browser_tabview_firstrun_pref.js b/browser/base/content/test/tabview/browser_tabview_firstrun_pref.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_firstrun_pref.js rename to browser/base/content/test/tabview/browser_tabview_firstrun_pref.js diff --git a/browser/components/tabview/test/browser_tabview_group.js b/browser/base/content/test/tabview/browser_tabview_group.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_group.js rename to browser/base/content/test/tabview/browser_tabview_group.js diff --git a/browser/components/tabview/test/browser_tabview_launch.js b/browser/base/content/test/tabview/browser_tabview_launch.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_launch.js rename to browser/base/content/test/tabview/browser_tabview_launch.js diff --git a/browser/components/tabview/test/browser_tabview_layout.js b/browser/base/content/test/tabview/browser_tabview_layout.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_layout.js rename to browser/base/content/test/tabview/browser_tabview_layout.js diff --git a/browser/components/tabview/test/browser_tabview_multiwindow_search.js b/browser/base/content/test/tabview/browser_tabview_multiwindow_search.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_multiwindow_search.js rename to browser/base/content/test/tabview/browser_tabview_multiwindow_search.js diff --git a/browser/components/tabview/test/browser_tabview_privatebrowsing.js b/browser/base/content/test/tabview/browser_tabview_privatebrowsing.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_privatebrowsing.js rename to browser/base/content/test/tabview/browser_tabview_privatebrowsing.js diff --git a/browser/components/tabview/test/browser_tabview_rtl.js b/browser/base/content/test/tabview/browser_tabview_rtl.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_rtl.js rename to browser/base/content/test/tabview/browser_tabview_rtl.js diff --git a/browser/components/tabview/test/browser_tabview_search.js b/browser/base/content/test/tabview/browser_tabview_search.js similarity index 98% rename from browser/components/tabview/test/browser_tabview_search.js rename to browser/base/content/test/tabview/browser_tabview_search.js index 29c8243670b..4096a14b2e5 100644 --- a/browser/components/tabview/test/browser_tabview_search.js +++ b/browser/base/content/test/tabview/browser_tabview_search.js @@ -8,7 +8,7 @@ function test() { waitForExplicitFinish(); // set up our tabs - let urlBase = "http://mochi.test:8888/browser/browser/components/tabview/test/"; + let urlBase = "http://mochi.test:8888/browser/browser/base/content/test/tabview/"; let tabOne = gBrowser.addTab(urlBase + "search1.html"); let tabTwo = gBrowser.addTab(urlBase + "search2.html"); newTabs = [ tabOne, tabTwo ]; diff --git a/browser/components/tabview/test/browser_tabview_snapping.js b/browser/base/content/test/tabview/browser_tabview_snapping.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_snapping.js rename to browser/base/content/test/tabview/browser_tabview_snapping.js diff --git a/browser/components/tabview/test/browser_tabview_startup_transitions.js b/browser/base/content/test/tabview/browser_tabview_startup_transitions.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_startup_transitions.js rename to browser/base/content/test/tabview/browser_tabview_startup_transitions.js diff --git a/browser/components/tabview/test/browser_tabview_storage_policy.js b/browser/base/content/test/tabview/browser_tabview_storage_policy.js similarity index 97% rename from browser/components/tabview/test/browser_tabview_storage_policy.js rename to browser/base/content/test/tabview/browser_tabview_storage_policy.js index df14a77f7bc..0d5347f3bdb 100644 --- a/browser/components/tabview/test/browser_tabview_storage_policy.js +++ b/browser/base/content/test/tabview/browser_tabview_storage_policy.js @@ -48,7 +48,7 @@ function test1() { HttpRequestObserver.cacheControlValue = null; }); - newTab.linkedBrowser.loadURI("http://www.example.com/browser/browser/components/tabview/test/dummy_page.html"); + newTab.linkedBrowser.loadURI("http://www.example.com/browser/browser/base/content/test/tabview/dummy_page.html"); } function test2() { @@ -73,7 +73,7 @@ function test3() { Services.prefs.setBoolPref(PREF_DISK_CACHE_SSL, true); - newTab.linkedBrowser.loadURI("https://example.com/browser/browser/components/tabview/test/dummy_page.html"); + newTab.linkedBrowser.loadURI("https://example.com/browser/browser/base/content/test/tabview/dummy_page.html"); afterAllTabsLoaded(function() { let tabItem = newTab._tabViewTabItem; @@ -91,7 +91,7 @@ function test4() { Services.prefs.setBoolPref(PREF_DISK_CACHE_SSL, false); - newTab.linkedBrowser.loadURI("https://example.com/browser/browser/components/tabview/test/"); + newTab.linkedBrowser.loadURI("https://example.com/browser/browser/base/content/test/tabview/"); afterAllTabsLoaded(function() { let tabItem = newTab._tabViewTabItem; diff --git a/browser/components/tabview/test/browser_tabview_thumbnail_storage.js b/browser/base/content/test/tabview/browser_tabview_thumbnail_storage.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_thumbnail_storage.js rename to browser/base/content/test/tabview/browser_tabview_thumbnail_storage.js diff --git a/browser/components/tabview/test/browser_tabview_undo_group.js b/browser/base/content/test/tabview/browser_tabview_undo_group.js similarity index 100% rename from browser/components/tabview/test/browser_tabview_undo_group.js rename to browser/base/content/test/tabview/browser_tabview_undo_group.js diff --git a/browser/components/tabview/test/dummy_page.html b/browser/base/content/test/tabview/dummy_page.html similarity index 100% rename from browser/components/tabview/test/dummy_page.html rename to browser/base/content/test/tabview/dummy_page.html diff --git a/browser/components/tabview/test/head.js b/browser/base/content/test/tabview/head.js similarity index 100% rename from browser/components/tabview/test/head.js rename to browser/base/content/test/tabview/head.js diff --git a/browser/components/tabview/test/search1.html b/browser/base/content/test/tabview/search1.html similarity index 100% rename from browser/components/tabview/test/search1.html rename to browser/base/content/test/tabview/search1.html diff --git a/browser/components/tabview/test/search2.html b/browser/base/content/test/tabview/search2.html similarity index 100% rename from browser/components/tabview/test/search2.html rename to browser/base/content/test/tabview/search2.html diff --git a/browser/components/tabview/test/test_bug600645.html b/browser/base/content/test/tabview/test_bug600645.html similarity index 100% rename from browser/components/tabview/test/test_bug600645.html rename to browser/base/content/test/tabview/test_bug600645.html diff --git a/browser/components/tabview/test/test_bug644097.html b/browser/base/content/test/tabview/test_bug644097.html similarity index 100% rename from browser/components/tabview/test/test_bug644097.html rename to browser/base/content/test/tabview/test_bug644097.html diff --git a/browser/base/jar.mn b/browser/base/jar.mn index e492eed48f6..8f7cc13010a 100644 --- a/browser/base/jar.mn +++ b/browser/base/jar.mn @@ -49,6 +49,10 @@ browser.jar: content/browser/sanitizeDialog.css (content/sanitizeDialog.css) * content/browser/tabbrowser.css (content/tabbrowser.css) * content/browser/tabbrowser.xml (content/tabbrowser.xml) + content/browser/tabview.css (content/tabview/tabview.css) +* content/browser/tabview.js (content/tabview/tabview.js) + content/browser/tabview.html (content/tabview/tabview.html) + content/browser/tabview-content.js (content/tabview/content.js) * content/browser/urlbarBindings.xml (content/urlbarBindings.xml) * content/browser/utilityOverlay.js (content/utilityOverlay.js) * content/browser/web-panels.js (content/web-panels.js) diff --git a/browser/components/Makefile.in b/browser/components/Makefile.in index 1780ced292a..f1b9d587fb5 100644 --- a/browser/components/Makefile.in +++ b/browser/components/Makefile.in @@ -70,7 +70,6 @@ PARALLEL_DIRS = \ sessionstore \ shell \ sidebar \ - tabview \ migration \ $(NULL) diff --git a/browser/components/tabview/Makefile.in b/browser/components/tabview/Makefile.in deleted file mode 100644 index c86fb752212..00000000000 --- a/browser/components/tabview/Makefile.in +++ /dev/null @@ -1,53 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Places code -# -# The Initial Developer of the Original Code is -# Google Inc. -# Portions created by the Initial Developer are Copyright (C) 2005 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Brett Wilson -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -ifdef ENABLE_TESTS - DIRS += test -endif - -include $(topsrcdir)/config/rules.mk - -libs:: - $(NSINSTALL) $(srcdir)/modules/* $(FINAL_TARGET)/modules/tabview diff --git a/browser/components/tabview/jar.mn b/browser/components/tabview/jar.mn deleted file mode 100644 index 7b54b18afd9..00000000000 --- a/browser/components/tabview/jar.mn +++ /dev/null @@ -1,5 +0,0 @@ -browser.jar: - content/browser/tabview.css (tabview.css) -* content/browser/tabview.js (tabview.js) - content/browser/tabview.html (tabview.html) - content/browser/tabview-content.js (content.js) From a46dd8e0f8e4bfb5083a85864029fcf6c1424c1f Mon Sep 17 00:00:00 2001 From: David Chan Date: Fri, 7 Oct 2011 09:29:33 -0300 Subject: [PATCH 41/57] Bug 692550 - console.log("%s", null); should log "null"; r=msucan --- dom/base/ConsoleAPI.js | 2 +- dom/tests/browser/browser_ConsoleAPITests.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/dom/base/ConsoleAPI.js b/dom/base/ConsoleAPI.js index 146c6733d2a..6ae372668d2 100644 --- a/dom/base/ConsoleAPI.js +++ b/dom/base/ConsoleAPI.js @@ -207,7 +207,7 @@ ConsoleAPI.prototype = { switch (spec[spec.length-1]) { case "o": case "s": - return args.shift().toString(); + return String(args.shift()); case "d": case "i": return parseInt(args.shift()); diff --git a/dom/tests/browser/browser_ConsoleAPITests.js b/dom/tests/browser/browser_ConsoleAPITests.js index a77ea6fbe42..0729aa72004 100644 --- a/dom/tests/browser/browser_ConsoleAPITests.js +++ b/dom/tests/browser/browser_ConsoleAPITests.js @@ -220,6 +220,10 @@ function observeConsoleTest() { expect("log", "2, a, %l", 3); win.console.log("%d, %s, %l", 2, "a", 3); + // bug #692550 handle null and undefined + expect("log", "null, undefined"); + win.console.log("%s, %s", null, undefined); + expect("dir", win.toString()); win.console.dir(win); From 77d2780844a30e9e3f7794d92e06bcd9f42f4a29 Mon Sep 17 00:00:00 2001 From: Rob Campbell Date: Fri, 7 Oct 2011 12:38:35 -0300 Subject: [PATCH 42/57] Bug 689160 - Investigate and Fix leaked csshtmltree.xhtml windows in Highlighter+Style Inspector; r=msucan --- browser/devtools/highlighter/inspector.jsm | 3 +- .../test/browser_inspector_initialization.js | 26 +++++++++++++---- .../devtools/styleinspector/CssHtmlTree.jsm | 28 ++++++++++++++++++ .../styleinspector/StyleInspector.jsm | 29 +++++++++++-------- 4 files changed, 67 insertions(+), 19 deletions(-) diff --git a/browser/devtools/highlighter/inspector.jsm b/browser/devtools/highlighter/inspector.jsm index 087014fb54e..5071e42bc6e 100644 --- a/browser/devtools/highlighter/inspector.jsm +++ b/browser/devtools/highlighter/inspector.jsm @@ -887,8 +887,7 @@ InspectorUI.prototype = { initTools: function IUI_initTools() { // Style inspector - // XXX bug 689164, remove /false &&/ from below when bug 689160 fixed. - if (false && Services.prefs.getBoolPref("devtools.styleinspector.enabled") && + if (Services.prefs.getBoolPref("devtools.styleinspector.enabled") && !this.toolRegistered("styleinspector")) { let stylePanel = StyleInspector.createPanel(true); this.registerTool({ diff --git a/browser/devtools/highlighter/test/browser_inspector_initialization.js b/browser/devtools/highlighter/test/browser_inspector_initialization.js index 63e77f09ef8..d75c7d6c562 100644 --- a/browser/devtools/highlighter/test/browser_inspector_initialization.js +++ b/browser/devtools/highlighter/test/browser_inspector_initialization.js @@ -77,6 +77,8 @@ function runInspectorTests() ok(InspectorUI.inspecting, "Inspector is inspecting"); ok(!InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is not open"); ok(InspectorUI.highlighter, "Highlighter is up"); + InspectorUI.inspectNode(doc.body); + InspectorUI.stopInspecting(); InspectorUI.treePanel.open(); } @@ -85,14 +87,29 @@ function treePanelTests() { Services.obs.removeObserver(treePanelTests, InspectorUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY); - Services.obs.addObserver(runContextMenuTest, - InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false); + Services.obs.addObserver(stylePanelTests, + "StyleInspector-opened", false); ok(InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is open"); + executeSoon(function() { + InspectorUI.stylePanel.showTool(doc.body); + }); +} + +function stylePanelTests() +{ + Services.obs.removeObserver(stylePanelTests, "StyleInspector-opened"); + Services.obs.addObserver(runContextMenuTest, + InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false); + + ok(InspectorUI.stylePanel.isOpen(), "Style Panel is Open"); + ok(InspectorUI.stylePanel.cssHtmlTree, "Style Panel has a cssHtmlTree"); + executeSoon(function() { InspectorUI.closeInspectorUI(); }); + } function runContextMenuTest() @@ -121,9 +138,8 @@ function inspectNodesFromContextTest() Services.obs.addObserver(openInspectorForContextTest, InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false); ok(!InspectorUI.inspecting, "Inspector is not actively highlighting"); is(InspectorUI.selection, salutation, "Inspector is highlighting salutation"); - ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is closed"); - // TODO: These tests depend on the style inspector patches. - todo(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open"); + ok(!InspectorUI.treePanel.isOpen(), "Inspector Tree Panel is closed"); + ok(!InspectorUI.stylePanel.isOpen(), "Inspector Style Panel is closed"); executeSoon(function() { InspectorUI.closeInspectorUI(true); }); diff --git a/browser/devtools/styleinspector/CssHtmlTree.jsm b/browser/devtools/styleinspector/CssHtmlTree.jsm index 7cf71d4c24f..fb08ae27965 100644 --- a/browser/devtools/styleinspector/CssHtmlTree.jsm +++ b/browser/devtools/styleinspector/CssHtmlTree.jsm @@ -328,6 +328,34 @@ CssHtmlTree.prototype = { CssHtmlTree.propertyNames.push.apply(CssHtmlTree.propertyNames, mozProps.sort()); }, + + /** + * Destructor for CssHtmlTree. + */ + destroy: function CssHtmlTree_destroy() + { + delete this.viewedElement; + + // Nodes used in templating + delete this.root; + delete this.path; + delete this.templateRoot; + delete this.templatePath; + delete this.propertyContainer; + delete this.templateProperty; + delete this.panel; + + // The document in which we display the results (csshtmltree.xhtml). + delete this.styleDocument; + + // The element that we're inspecting, and the document that it comes from. + delete this.propertyViews; + delete this.getRTLAttr; + delete this.styleWin; + delete this.cssLogic; + delete this.doc; + delete this.win; + }, }; /** diff --git a/browser/devtools/styleinspector/StyleInspector.jsm b/browser/devtools/styleinspector/StyleInspector.jsm index 230a13253d6..2f76bbd8361 100644 --- a/browser/devtools/styleinspector/StyleInspector.jsm +++ b/browser/devtools/styleinspector/StyleInspector.jsm @@ -66,8 +66,7 @@ var StyleInspector = { { let win = Services.wm.getMostRecentWindow("navigator:browser"); let popupSet = win.document.getElementById("mainPopupSet"); - let ns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - let panel = win.document.createElementNS(ns, "panel"); + let panel = win.document.createElement("panel"); panel.setAttribute("class", "styleInspector"); panel.setAttribute("orient", "vertical"); @@ -84,7 +83,7 @@ var StyleInspector = { vbox.setAttribute("flex", "1"); panel.appendChild(vbox); - let iframe = win.document.createElementNS(ns, "iframe"); + let iframe = win.document.createElement("iframe"); iframe.setAttribute("flex", "1"); iframe.setAttribute("tooltip", "aHTMLTooltip"); iframe.setAttribute("src", "chrome://browser/content/csshtmltree.xhtml"); @@ -145,8 +144,8 @@ var StyleInspector = { } } - panel.addEventListener("popupshown", SI_popupShown); - panel.addEventListener("popuphidden", SI_popupHidden); + panel.addEventListener("popupshown", SI_popupShown, false); + panel.addEventListener("popuphidden", SI_popupHidden, false); panel.preserveOnHide = !!aPreserveOnHide; /** @@ -176,15 +175,21 @@ var StyleInspector = { */ panel.destroy = function SI_destroy() { - if (!this.cssLogic) - return; if (this.isOpen()) this.hideTool(); - this.cssLogic = null; - this.cssHtmlTree = null; - this.removeEventListener("popupshown", SI_popupShown); - this.removeEventListener("popuphidden", SI_popupHidden); - this.parentNode.removeChild(this); + if (panel.cssHtmlTree) + panel.cssHtmlTree.destroy(); + if (iframe) { + iframe.parentNode.removeChild(iframe); + iframe = null; + } + + delete panel.cssLogic; + delete panel.cssHtmlTree; + panel.removeEventListener("popupshown", SI_popupShown, false); + panel.removeEventListener("popuphidden", SI_popupHidden, false); + panel.parentNode.removeChild(panel); + panel = null; Services.obs.notifyObservers(null, "StyleInspector-closed", null); }; From 44ade8668ec07718aed9a18d7fd813e1e723e0b2 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Sat, 8 Oct 2011 17:19:32 +0200 Subject: [PATCH 43/57] Bug 657472 - 'Tune' the time to wait before displaying the update been downloaded / restart notification and provide ability to override in the update xml; r=rstrong --- browser/app/profile/firefox.js | 3 +-- browser/branding/aurora/pref/firefox-branding.js | 2 ++ browser/branding/nightly/pref/firefox-branding.js | 2 ++ browser/branding/official/pref/firefox-branding.js | 2 ++ browser/branding/unofficial/pref/firefox-branding.js | 2 ++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index a8ab2a8c8e3..148255ec09a 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -170,9 +170,8 @@ pref("app.update.url", "https://aus3.mozilla.org/update/3/%PRODUCT%/%VERSION%/%B //pref("app.update.url.override", ""); // app.update.interval is in branding section +// app.update.promptWaitTime is in branding section -// Give the user x seconds to react before showing the big UI. default=12 hours -pref("app.update.promptWaitTime", 43200); // Show the Update Checking/Ready UI when the user was idle for x seconds pref("app.update.idletime", 60); diff --git a/browser/branding/aurora/pref/firefox-branding.js b/browser/branding/aurora/pref/firefox-branding.js index 81cb025bad3..1615d8c44f6 100644 --- a/browser/branding/aurora/pref/firefox-branding.js +++ b/browser/branding/aurora/pref/firefox-branding.js @@ -7,6 +7,8 @@ pref("app.update.interval", 28800); // The time interval between the downloading of mar file chunks in the // background (in seconds) pref("app.update.download.backgroundInterval", 60); +// Give the user x seconds to react before showing the big UI. default=24 hours +pref("app.update.promptWaitTime", 86400); // URL user can browse to manually if for some reason all update installation // attempts fail. pref("app.update.url.manual", "http://www.mozilla.com/firefox/channel/"); diff --git a/browser/branding/nightly/pref/firefox-branding.js b/browser/branding/nightly/pref/firefox-branding.js index ddcafbd00e9..fb422731b42 100644 --- a/browser/branding/nightly/pref/firefox-branding.js +++ b/browser/branding/nightly/pref/firefox-branding.js @@ -5,6 +5,8 @@ pref("app.update.interval", 7200); // 2 hours // The time interval between the downloading of mar file chunks in the // background (in seconds) pref("app.update.download.backgroundInterval", 60); +// Give the user x seconds to react before showing the big UI. default=12 hours +pref("app.update.promptWaitTime", 43200); // URL user can browse to manually if for some reason all update installation // attempts fail. pref("app.update.url.manual", "http://nightly.mozilla.org/"); diff --git a/browser/branding/official/pref/firefox-branding.js b/browser/branding/official/pref/firefox-branding.js index 0e985e33ac0..194ccc337e8 100644 --- a/browser/branding/official/pref/firefox-branding.js +++ b/browser/branding/official/pref/firefox-branding.js @@ -7,6 +7,8 @@ pref("app.update.interval", 86400); // The time interval between the downloading of mar file chunks in the // background (in seconds) pref("app.update.download.backgroundInterval", 600); +// Give the user x seconds to react before showing the big UI. default=24 hours +pref("app.update.promptWaitTime", 86400); // URL user can browse to manually if for some reason all update installation // attempts fail. pref("app.update.url.manual", "http://www.firefox.com"); diff --git a/browser/branding/unofficial/pref/firefox-branding.js b/browser/branding/unofficial/pref/firefox-branding.js index b3e8634aa00..fda6c370fce 100644 --- a/browser/branding/unofficial/pref/firefox-branding.js +++ b/browser/branding/unofficial/pref/firefox-branding.js @@ -5,6 +5,8 @@ pref("app.update.interval", 86400); // 24 hours // The time interval between the downloading of mar file chunks in the // background (in seconds) pref("app.update.download.backgroundInterval", 60); +// Give the user x seconds to react before showing the big UI. default=24 hours +pref("app.update.promptWaitTime", 86400); // URL user can browse to manually if for some reason all update installation // attempts fail. pref("app.update.url.manual", "http://www.mozilla.org/products/%APP%/"); From 867756f0ccd3953c77cd2062c4d0abf175ac3f79 Mon Sep 17 00:00:00 2001 From: Michael Ratcliffe Date: Tue, 4 Oct 2011 13:26:22 +0200 Subject: [PATCH 44/57] Bug 691721 - Potential memory leak in DevTools test, r=msucan --- .../devtools/styleinspector/test/browser/browser_bug683672.js | 1 + 1 file changed, 1 insertion(+) diff --git a/browser/devtools/styleinspector/test/browser/browser_bug683672.js b/browser/devtools/styleinspector/test/browser/browser_bug683672.js index 5d90a6d6a50..6bd20449905 100644 --- a/browser/devtools/styleinspector/test/browser/browser_bug683672.js +++ b/browser/devtools/styleinspector/test/browser/browser_bug683672.js @@ -20,6 +20,7 @@ function test() function tabLoaded() { + browser.removeEventListener("load", tabLoaded, true); ok(window.StyleInspector, "StyleInspector exists"); ok(StyleInspector.isEnabled, "style inspector preference is enabled"); stylePanel = StyleInspector.createPanel(); From 1da87bde8fb2c4b1355fa1b3a28efd8458d26d81 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Tue, 11 Oct 2011 10:10:13 -0300 Subject: [PATCH 45/57] Bug 689934 - Transition on infobar during webpage scrolling in highlighter, r=msucan --- browser/base/content/highlighter.css | 3 +++ browser/devtools/highlighter/inspector.jsm | 2 ++ 2 files changed, 5 insertions(+) diff --git a/browser/base/content/highlighter.css b/browser/base/content/highlighter.css index 17ac2bd27a6..d2558235e4e 100644 --- a/browser/base/content/highlighter.css +++ b/browser/base/content/highlighter.css @@ -42,6 +42,9 @@ #highlighter-nodeinfobar-container { position: absolute; +} + +#highlighter-nodeinfobar-container:not([locked]) { -moz-transition-property: top, left; -moz-transition-duration: 0.1s; -moz-transition-timing-function: linear; diff --git a/browser/devtools/highlighter/inspector.jsm b/browser/devtools/highlighter/inspector.jsm index 5071e42bc6e..edd74ea575d 100644 --- a/browser/devtools/highlighter/inspector.jsm +++ b/browser/devtools/highlighter/inspector.jsm @@ -1030,6 +1030,7 @@ InspectorUI.prototype = { this.inspecting = true; this.toolsDim(true); this.highlighter.veilContainer.removeAttribute("locked"); + this.highlighter.nodeInfo.container.removeAttribute("locked"); }, /** @@ -1054,6 +1055,7 @@ InspectorUI.prototype = { this.select(null, true, true); } this.highlighter.veilContainer.setAttribute("locked", true); + this.highlighter.nodeInfo.container.setAttribute("locked", true); }, /** From 3cfd632d15db80ff424a63e79c8625b3a62042b2 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Tue, 11 Oct 2011 10:11:10 -0300 Subject: [PATCH 46/57] Bug 690713 - [highlighter] move DOM related methods from TreePanel.jsm to a new jsm, r=msucan,rcampbell --- browser/devtools/highlighter/TreePanel.jsm | 209 +++++++++++++-------- 1 file changed, 132 insertions(+), 77 deletions(-) diff --git a/browser/devtools/highlighter/TreePanel.jsm b/browser/devtools/highlighter/TreePanel.jsm index 3c1ad949f79..ae8c904194e 100644 --- a/browser/devtools/highlighter/TreePanel.jsm +++ b/browser/devtools/highlighter/TreePanel.jsm @@ -47,7 +47,7 @@ Cu.import("resource:///modules/domplate.jsm"); Cu.import("resource:///modules/InsideOutBox.jsm"); Cu.import("resource:///modules/Services.jsm"); -var EXPORTED_SYMBOLS = ["TreePanel"]; +var EXPORTED_SYMBOLS = ["TreePanel", "DOMHelpers"]; const INSPECTOR_URI = "chrome://browser/content/inspector.html"; @@ -96,6 +96,8 @@ TreePanel.prototype = { domplateUtils.setDOM(this.window); + this.DOMHelpers = new DOMHelpers(this.window); + let isOpen = this.isOpen.bind(this); this.registrationObject = { @@ -315,93 +317,23 @@ TreePanel.prototype = { getParentObject: function TP_getParentObject(node) { - let parentNode = node ? node.parentNode : null; - - if (!parentNode) { - // Documents have no parentNode; Attr, Document, DocumentFragment, Entity, - // and Notation. top level windows have no parentNode - if (node && node == this.window.Node.DOCUMENT_NODE) { - // document type - if (node.defaultView) { - let embeddingFrame = node.defaultView.frameElement; - if (embeddingFrame) - return embeddingFrame.parentNode; - } - } - // a Document object without a parentNode or window - return null; // top level has no parent - } - - if (parentNode.nodeType == this.window.Node.DOCUMENT_NODE) { - if (parentNode.defaultView) { - return parentNode.defaultView.frameElement; - } - // parent is document element, but no window at defaultView. - return null; - } - - if (!parentNode.localName) - return null; - - return parentNode; + return this.DOMHelpers.getParentObject(node); }, getChildObject: function TP_getChildObject(node, index, previousSibling) { - if (!node) - return null; - - if (node.contentDocument) { - // then the node is a frame - if (index == 0) { - return node.contentDocument.documentElement; // the node's HTMLElement - } - return null; - } - - if (node instanceof this.window.GetSVGDocument) { - let svgDocument = node.getSVGDocument(); - if (svgDocument) { - // then the node is a frame - if (index == 0) { - return svgDocument.documentElement; // the node's SVGElement - } - return null; - } - } - - let child = null; - if (previousSibling) // then we are walking - child = this.getNextSibling(previousSibling); - else - child = this.getFirstChild(node); - - if (this.showTextNodesWithWhitespace) - return child; - - for (; child; child = this.getNextSibling(child)) { - if (!domplateUtils.isWhitespaceText(child)) - return child; - } - - return null; // we have no children worth showing. + return this.DOMHelpers.getChildObject(node, index, previousSibling, + this.showTextNodesWithWhitespace); }, getFirstChild: function TP_getFirstChild(node) { - this.treeWalker = node.ownerDocument.createTreeWalker(node, - this.window.NodeFilter.SHOW_ALL, null, false); - return this.treeWalker.firstChild(); + return this.DOMHelpers.getFirstChild(node); }, getNextSibling: function TP_getNextSibling(node) { - let next = this.treeWalker.nextSibling(); - - if (!next) - delete this.treeWalker; - - return next; + return this.DOMHelpers.getNextSibling(node); }, ///////////////////////////////////////////////////////////////////// @@ -747,7 +679,11 @@ TreePanel.prototype = { domplateUtils.setDOM(null); delete this.resizer; - delete this.treeWalker; + + if (this.DOMHelpers) { + this.DOMHelpers.destroy(); + delete this.DOMHelpers; + } if (this.treePanelDiv) { this.treePanelDiv.ownerPanel = null; @@ -777,3 +713,122 @@ TreePanel.prototype = { } }; + +/** + * DOMHelpers + * Makes DOM traversal easier. Goes through iframes. + * + * @constructor + * @param nsIDOMWindow aWindow + * The content window, owning the document to traverse. + */ +function DOMHelpers(aWindow) { + this.window = aWindow; +}; + +DOMHelpers.prototype = { + getParentObject: function Helpers_getParentObject(node) + { + let parentNode = node ? node.parentNode : null; + + if (!parentNode) { + // Documents have no parentNode; Attr, Document, DocumentFragment, Entity, + // and Notation. top level windows have no parentNode + if (node && node == this.window.Node.DOCUMENT_NODE) { + // document type + if (node.defaultView) { + let embeddingFrame = node.defaultView.frameElement; + if (embeddingFrame) + return embeddingFrame.parentNode; + } + } + // a Document object without a parentNode or window + return null; // top level has no parent + } + + if (parentNode.nodeType == this.window.Node.DOCUMENT_NODE) { + if (parentNode.defaultView) { + return parentNode.defaultView.frameElement; + } + // parent is document element, but no window at defaultView. + return null; + } + + if (!parentNode.localName) + return null; + + return parentNode; + }, + + getChildObject: function Helpers_getChildObject(node, index, previousSibling, + showTextNodesWithWhitespace) + { + if (!node) + return null; + + if (node.contentDocument) { + // then the node is a frame + if (index == 0) { + return node.contentDocument.documentElement; // the node's HTMLElement + } + return null; + } + + if (node instanceof this.window.GetSVGDocument) { + let svgDocument = node.getSVGDocument(); + if (svgDocument) { + // then the node is a frame + if (index == 0) { + return svgDocument.documentElement; // the node's SVGElement + } + return null; + } + } + + let child = null; + if (previousSibling) // then we are walking + child = this.getNextSibling(previousSibling); + else + child = this.getFirstChild(node); + + if (showTextNodesWithWhitespace) + return child; + + for (; child; child = this.getNextSibling(child)) { + if (!this.isWhitespaceText(child)) + return child; + } + + return null; // we have no children worth showing. + }, + + getFirstChild: function Helpers_getFirstChild(node) + { + let SHOW_ALL = Components.interfaces.nsIDOMNodeFilter.SHOW_ALL; + this.treeWalker = node.ownerDocument.createTreeWalker(node, + SHOW_ALL, null, false); + return this.treeWalker.firstChild(); + }, + + getNextSibling: function Helpers_getNextSibling(node) + { + let next = this.treeWalker.nextSibling(); + + if (!next) + delete this.treeWalker; + + return next; + }, + + isWhitespaceText: function Helpers_isWhitespaceText(node) + { + return node.nodeType == this.window.Node.TEXT_NODE && + !/[^\s]/.exec(node.nodeValue); + }, + + destroy: function Helpers_destroy() + { + delete this.window; + delete this.treeWalker; + } +}; From 8c22481872b8ea218288f24c2f88200a0866f853 Mon Sep 17 00:00:00 2001 From: Panos Astithas Date: Tue, 11 Oct 2011 10:11:20 -0300 Subject: [PATCH 47/57] Bug 669658 - [highlighter] Improve the keybindings, r=rcampbell --- browser/devtools/highlighter/TreePanel.jsm | 4 +- browser/devtools/highlighter/inspector.jsm | 46 +++++------ browser/devtools/highlighter/test/Makefile.in | 1 + .../test/browser_inspector_keybindings.js | 81 +++++++++++++++++++ 4 files changed, 104 insertions(+), 28 deletions(-) create mode 100644 browser/devtools/highlighter/test/browser_inspector_keybindings.js diff --git a/browser/devtools/highlighter/TreePanel.jsm b/browser/devtools/highlighter/TreePanel.jsm index ae8c904194e..cd75fdab251 100644 --- a/browser/devtools/highlighter/TreePanel.jsm +++ b/browser/devtools/highlighter/TreePanel.jsm @@ -1,5 +1,5 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * @@ -141,6 +141,7 @@ TreePanel.prototype = { this.treeLoaded = true; this.treeIFrame.addEventListener("click", this.onTreeClick.bind(this), false); this.treeIFrame.addEventListener("dblclick", this.onTreeDblClick.bind(this), false); + this.treeIFrame.addEventListener("keypress", this.IUI, false); delete this.initializingTreePanel; Services.obs.notifyObservers(null, this.IUI.INSPECTOR_NOTIFICATIONS.TREEPANELREADY, null); @@ -694,6 +695,7 @@ TreePanel.prototype = { } if (this.treeIFrame) { + this.treeIFrame.removeEventListener("keypress", this.IUI, false); this.treeIFrame.removeEventListener("dblclick", this.onTreeDblClick, false); this.treeIFrame.removeEventListener("click", this.onTreeClick, false); let parent = this.treeIFrame.parentNode; diff --git a/browser/devtools/highlighter/inspector.jsm b/browser/devtools/highlighter/inspector.jsm index edd74ea575d..9dc18f7c299 100644 --- a/browser/devtools/highlighter/inspector.jsm +++ b/browser/devtools/highlighter/inspector.jsm @@ -989,6 +989,7 @@ InspectorUI.prototype = { } this.stopInspecting(); + this.browser.removeEventListener("keypress", this, true); this.saveToolState(this.winID); this.toolsDo(function IUI_toolsHide(aTool) { @@ -996,6 +997,9 @@ InspectorUI.prototype = { }.bind(this)); if (this.highlighter) { + this.highlighter.highlighterContainer.removeEventListener("keypress", + this, + true); this.highlighter.destroy(); this.highlighter = null; } @@ -1026,7 +1030,12 @@ InspectorUI.prototype = { this.treePanel.closeEditor(); this.inspectToolbutton.checked = true; - this.attachPageListeners(); + // Attach event listeners to content window and child windows to enable + // highlighting and click to stop inspection. + this.browser.addEventListener("keypress", this, true); + this.highlighter.highlighterContainer.addEventListener("keypress", this, true); + this.highlighter.attachInspectListeners(); + this.inspecting = true; this.toolsDim(true); this.highlighter.veilContainer.removeAttribute("locked"); @@ -1046,7 +1055,12 @@ InspectorUI.prototype = { } this.inspectToolbutton.checked = false; - this.detachPageListeners(); + // Detach event listeners from content window and child windows to disable + // highlighting. We still want to be notified if the user presses "ESCAPE" + // to unlock the node, so we don't remove the "keypress" event until + // the highlighter is removed. + this.highlighter.detachInspectListeners(); + this.inspecting = false; this.toolsDim(false); if (this.highlighter.node) { @@ -1166,11 +1180,9 @@ InspectorUI.prototype = { switch (event.keyCode) { case this.chromeWin.KeyEvent.DOM_VK_RETURN: case this.chromeWin.KeyEvent.DOM_VK_ESCAPE: - if (this.inspecting) { - this.stopInspecting(); - event.preventDefault(); - event.stopPropagation(); - } + this.toggleInspection(); + event.preventDefault(); + event.stopPropagation(); break; case this.chromeWin.KeyEvent.DOM_VK_LEFT: let node; @@ -1240,26 +1252,6 @@ InspectorUI.prototype = { } }, - /** - * Attach event listeners to content window and child windows to enable - * highlighting and click to stop inspection. - */ - attachPageListeners: function IUI_attachPageListeners() - { - this.browser.addEventListener("keypress", this, true); - this.highlighter.attachInspectListeners(); - }, - - /** - * Detach event listeners from content window and child windows - * to disable highlighting. - */ - detachPageListeners: function IUI_detachPageListeners() - { - this.browser.removeEventListener("keypress", this, true); - this.highlighter.detachInspectListeners(); - }, - ///////////////////////////////////////////////////////////////////////// //// Utility Methods diff --git a/browser/devtools/highlighter/test/Makefile.in b/browser/devtools/highlighter/test/Makefile.in index 9cec036b51b..6c8e6423188 100644 --- a/browser/devtools/highlighter/test/Makefile.in +++ b/browser/devtools/highlighter/test/Makefile.in @@ -62,6 +62,7 @@ _BROWSER_FILES = \ browser_inspector_infobar.js \ browser_inspector_bug_690361.js \ browser_inspector_bug_672902_keyboard_shortcuts.js \ + browser_inspector_keybindings.js \ $(NULL) # Disabled due to constant failures diff --git a/browser/devtools/highlighter/test/browser_inspector_keybindings.js b/browser/devtools/highlighter/test/browser_inspector_keybindings.js new file mode 100644 index 00000000000..c5fa00c869e --- /dev/null +++ b/browser/devtools/highlighter/test/browser_inspector_keybindings.js @@ -0,0 +1,81 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + + +function test() +{ + waitForExplicitFinish(); + + let doc; + let node; + + gBrowser.selectedTab = gBrowser.addTab(); + gBrowser.selectedBrowser.addEventListener("load", function onload() { + gBrowser.selectedBrowser.removeEventListener("load", onload, true); + doc = content.document; + waitForFocus(setupKeyBindingsTest, content); + }, true); + + content.location = "data:text/html,

foobar

"; + + function setupKeyBindingsTest() + { + node = doc.querySelector("h1"); + Services.obs.addObserver(highlightNode, + InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false); + InspectorUI.toggleInspectorUI(); + } + + function highlightNode() + { + Services.obs.removeObserver(highlightNode, + InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED); + + executeSoon(function() { + Services.obs.addObserver(lockNode, + InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING, false); + + InspectorUI.inspectNode(node); + }); + } + + function lockNode() + { + Services.obs.removeObserver(lockNode, + InspectorUI.INSPECTOR_NOTIFICATIONS.HIGHLIGHTING); + + EventUtils.synthesizeKey("VK_ESCAPE", { }); + + executeSoon(isTheNodeLocked); + } + + function isTheNodeLocked() + { + is(InspectorUI.selection, node, "selection matches node"); + ok(!InspectorUI.inspecting, "the node is locked"); + unlockNode(); + } + + function unlockNode() { + EventUtils.synthesizeKey("VK_ESCAPE", { }); + + executeSoon(isTheNodeUnlocked); + } + + function isTheNodeUnlocked() + { + ok(InspectorUI.inspecting, "the node is unlocked"); + + Services.obs.addObserver(finishUp, + InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED, false); + InspectorUI.closeInspectorUI(); + } + + function finishUp() { + Services.obs.removeObserver(finishUp, + InspectorUI.INSPECTOR_NOTIFICATIONS.CLOSED); + doc = node = null; + gBrowser.removeCurrentTab(); + finish(); + } +} From 64cb9e0ec6bf4e5ffe515e3f8920ab35a36a4f4a Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Tue, 11 Oct 2011 10:38:26 -0700 Subject: [PATCH 48/57] Bug 677411 - Add telemetry counters for JS GC (r=luke) --- js/src/gc/Statistics.cpp | 10 +++++++ js/src/jsapi.cpp | 1 + js/src/jscntxt.h | 4 +++ js/src/jsfriendapi.cpp | 6 +++++ js/src/jsfriendapi.h | 15 +++++++++++ js/src/xpconnect/src/xpcjsruntime.cpp | 27 +++++++++++++++++++ .../telemetry/TelemetryHistograms.h | 14 ++++++++++ 7 files changed, 77 insertions(+) diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index c09711e7130..c3c54fb454c 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -163,6 +163,16 @@ Statistics::endGC() endPhase(PHASE_GC); crash::SnapshotGCStack(); + if (JSAccumulateTelemetryDataCallback cb = runtime->telemetryCallback) { + (*cb)(JS_TELEMETRY_GC_REASON, triggerReason); + (*cb)(JS_TELEMETRY_GC_IS_COMPARTMENTAL, compartment ? 1 : 0); + (*cb)(JS_TELEMETRY_GC_IS_SHAPE_REGEN, + runtime->shapeGen & SHAPE_OVERFLOW_BIT ? 1 : 0); + (*cb)(JS_TELEMETRY_GC_MS, t(PHASE_GC)); + (*cb)(JS_TELEMETRY_GC_MARK_MS, t(PHASE_MARK)); + (*cb)(JS_TELEMETRY_GC_SWEEP_MS, t(PHASE_SWEEP)); + } + if (fp) printStats(); diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 204c0d08639..72a98c762d5 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -705,6 +705,7 @@ JSRuntime::JSRuntime() debuggerMutations(0), securityCallbacks(NULL), structuredCloneCallbacks(NULL), + telemetryCallback(NULL), propertyRemovals(0), scriptFilenameTable(NULL), #ifdef JS_THREADSAFE diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 3e79b87deb2..27855d49235 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -45,6 +45,7 @@ */ #include +#include "jsfriendapi.h" #include "jsprvtd.h" #include "jsatom.h" #include "jsclist.h" @@ -604,6 +605,9 @@ struct JSRuntime { /* Structured data callbacks are runtime-wide. */ const JSStructuredCloneCallbacks *structuredCloneCallbacks; + /* Call this to accumulate telemetry data. */ + JSAccumulateTelemetryDataCallback telemetryCallback; + /* * The propertyRemovals counter is incremented for every JSObject::clear, * and for each JSObject::remove method call that frees a slot in the given diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index cf98f722aaa..c2335b28427 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -222,3 +222,9 @@ JS_GetCustomIteratorCount(JSContext *cx) { return sCustomIteratorCount; } + +JS_FRIEND_API(void) +JS_SetAccumulateTelemetryCallback(JSRuntime *rt, JSAccumulateTelemetryDataCallback callback) +{ + rt->telemetryCallback = callback; +} diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index fa4698626b2..9fb74804bc6 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -79,6 +79,21 @@ JS_SetProtoCalled(JSContext *cx); extern JS_FRIEND_API(size_t) JS_GetCustomIteratorCount(JSContext *cx); +enum { + JS_TELEMETRY_GC_REASON, + JS_TELEMETRY_GC_IS_COMPARTMENTAL, + JS_TELEMETRY_GC_IS_SHAPE_REGEN, + JS_TELEMETRY_GC_MS, + JS_TELEMETRY_GC_MARK_MS, + JS_TELEMETRY_GC_SWEEP_MS +}; + +typedef void +(* JSAccumulateTelemetryDataCallback)(int id, JSUint32 sample); + +extern JS_FRIEND_API(void) +JS_SetAccumulateTelemetryCallback(JSRuntime *rt, JSAccumulateTelemetryDataCallback callback); + /* Data for tracking analysis/inference memory usage. */ typedef struct TypeInferenceMemoryStats { diff --git a/js/src/xpconnect/src/xpcjsruntime.cpp b/js/src/xpconnect/src/xpcjsruntime.cpp index 611b753093d..8520d094266 100644 --- a/js/src/xpconnect/src/xpcjsruntime.cpp +++ b/js/src/xpconnect/src/xpcjsruntime.cpp @@ -53,6 +53,7 @@ #include "mozilla/FunctionTimer.h" #include "prsystem.h" #include "mozilla/Preferences.h" +#include "mozilla/Telemetry.h" #ifdef MOZ_CRASHREPORTER #include "nsExceptionHandler.h" @@ -2017,6 +2018,31 @@ DiagnosticMemoryCallback(void *ptr, size_t size) } #endif +static void +AccumulateTelemetryCallback(int id, JSUint32 sample) +{ + switch (id) { + case JS_TELEMETRY_GC_REASON: + Telemetry::Accumulate(Telemetry::GC_REASON, sample); + break; + case JS_TELEMETRY_GC_IS_COMPARTMENTAL: + Telemetry::Accumulate(Telemetry::GC_IS_COMPARTMENTAL, sample); + break; + case JS_TELEMETRY_GC_IS_SHAPE_REGEN: + Telemetry::Accumulate(Telemetry::GC_IS_SHAPE_REGEN, sample); + break; + case JS_TELEMETRY_GC_MS: + Telemetry::Accumulate(Telemetry::GC_MS, sample); + break; + case JS_TELEMETRY_GC_MARK_MS: + Telemetry::Accumulate(Telemetry::GC_MARK_MS, sample); + break; + case JS_TELEMETRY_GC_SWEEP_MS: + Telemetry::Accumulate(Telemetry::GC_SWEEP_MS, sample); + break; + } +} + bool XPCJSRuntime::gNewDOMBindingsEnabled; XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect) @@ -2084,6 +2110,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect) #ifdef MOZ_CRASHREPORTER JS_EnumerateDiagnosticMemoryRegions(DiagnosticMemoryCallback); #endif + JS_SetAccumulateTelemetryCallback(mJSRuntime, AccumulateTelemetryCallback); mWatchdogWakeup = JS_NEW_CONDVAR(mJSRuntime->gcLock); if (!mWatchdogWakeup) NS_RUNTIMEABORT("JS_NEW_CONDVAR failed."); diff --git a/toolkit/components/telemetry/TelemetryHistograms.h b/toolkit/components/telemetry/TelemetryHistograms.h index 375794c4879..3ab8e6e57fe 100644 --- a/toolkit/components/telemetry/TelemetryHistograms.h +++ b/toolkit/components/telemetry/TelemetryHistograms.h @@ -56,10 +56,24 @@ HISTOGRAM(A11Y_INSTANTIATED, 0, 1, 2, BOOLEAN, "has accessibility support been i HISTOGRAM(ISIMPLE_DOM_USAGE, 0, 1, 2, BOOLEAN, "have the ISimpleDOM* accessibility interfaces been used") HISTOGRAM(IACCESSIBLE_TABLE_USAGE, 0, 1, 2, BOOLEAN, "has the IAccessibleTable accessibility interface been used") +/** + * Cycle collector telemetry + */ HISTOGRAM(CYCLE_COLLECTOR, 1, 10000, 50, EXPONENTIAL, "Time spent on one cycle collection (ms)") HISTOGRAM(CYCLE_COLLECTOR_VISITED_REF_COUNTED, 1, 300000, 50, EXPONENTIAL, "Number of ref counted objects visited by the cycle collector") HISTOGRAM(CYCLE_COLLECTOR_VISITED_GCED, 1, 300000, 50, EXPONENTIAL, "Number of JS objects visited by the cycle collector") HISTOGRAM(CYCLE_COLLECTOR_COLLECTED, 1, 100000, 50, EXPONENTIAL, "Number of objects collected by the cycle collector") + +/** + * GC telemetry + */ +HISTOGRAM(GC_REASON, 0, 20, 20, LINEAR, "Reason (enum value) for initiating a GC") +HISTOGRAM(GC_IS_COMPARTMENTAL, 0, 1, 2, BOOLEAN, "Is it a compartmental GC?") +HISTOGRAM(GC_IS_SHAPE_REGEN, 0, 1, 2, BOOLEAN, "Is it a shape regenerating GC?") +HISTOGRAM(GC_MS, 1, 10000, 50, EXPONENTIAL, "Time spent running JS GC (ms)") +HISTOGRAM(GC_MARK_MS, 1, 10000, 50, EXPONENTIAL, "Time spent running JS GC mark phase (ms)") +HISTOGRAM(GC_SWEEP_MS, 1, 10000, 50, EXPONENTIAL, "Time spent running JS GC sweep phase (ms)") + HISTOGRAM(TELEMETRY_PING, 1, 3000, 10, EXPONENTIAL, "Time taken to submit telemetry info (ms)") HISTOGRAM(TELEMETRY_SUCCESS, 0, 1, 2, BOOLEAN, "Successful telemetry submission") HISTOGRAM(MEMORY_JS_COMPARTMENTS_SYSTEM, 1, 1000, 50, EXPONENTIAL, "Total JavaScript compartments used for add-ons and internals.") From fcf01a259a7cfb7075a682a4a66b5717410b2050 Mon Sep 17 00:00:00 2001 From: Chris Leary Date: Tue, 11 Oct 2011 09:42:26 -0700 Subject: [PATCH 49/57] Bug 690933: Guard on LifoAlloc overflow. (r=luke) --- js/src/ds/LifoAlloc.cpp | 42 ++++++++++++++++++++++++++++++++++++++--- js/src/ds/LifoAlloc.h | 34 +++++++++++++++------------------ 2 files changed, 54 insertions(+), 22 deletions(-) diff --git a/js/src/ds/LifoAlloc.cpp b/js/src/ds/LifoAlloc.cpp index 3f63bb78906..872c2172fb7 100644 --- a/js/src/ds/LifoAlloc.cpp +++ b/js/src/ds/LifoAlloc.cpp @@ -65,6 +65,30 @@ BumpChunk::new_(size_t chunkSize) return result; } +void +BumpChunk::delete_(BumpChunk *chunk) +{ +#ifdef DEBUG + memset(chunk, 0xcd, sizeof(*chunk) + chunk->bumpSpaceSize); +#endif + js_free(chunk); +} + +bool +BumpChunk::canAlloc(size_t n) +{ + char *aligned = AlignPtr(bump); + char *bumped = aligned + n; + return bumped <= limit && bumped > headerBase(); +} + +bool +BumpChunk::canAllocUnaligned(size_t n) +{ + char *bumped = bump + n; + return bumped <= limit && bumped > headerBase(); +} + void * BumpChunk::tryAllocUnaligned(size_t n) { @@ -73,6 +97,7 @@ BumpChunk::tryAllocUnaligned(size_t n) if (newBump > limit) return NULL; + JS_ASSERT(canAllocUnaligned(n)); setBump(newBump); return oldBump; } @@ -136,9 +161,20 @@ LifoAlloc::getOrCreateChunk(size_t n) } size_t defaultChunkFreeSpace = defaultChunkSize_ - sizeof(BumpChunk); - size_t chunkSize = n > defaultChunkFreeSpace - ? RoundUpPow2(n + sizeof(BumpChunk)) - : defaultChunkSize_; + size_t chunkSize; + if (n > defaultChunkFreeSpace) { + size_t allocSizeWithHeader = n + sizeof(BumpChunk); + + /* Guard for overflow. */ + if (allocSizeWithHeader < n || + (allocSizeWithHeader & (size_t(1) << (tl::BitSize::result - 1)))) { + return NULL; + } + + chunkSize = RoundUpPow2(allocSizeWithHeader); + } else { + chunkSize = defaultChunkSize_; + } /* If we get here, we couldn't find an existing BumpChunk to fill the request. */ BumpChunk *newChunk = BumpChunk::new_(chunkSize); diff --git a/js/src/ds/LifoAlloc.h b/js/src/ds/LifoAlloc.h index bff07bad37e..0fa9388a458 100644 --- a/js/src/ds/LifoAlloc.h +++ b/js/src/ds/LifoAlloc.h @@ -79,7 +79,8 @@ class BumpChunk BumpChunk *next_; size_t bumpSpaceSize; - char *base() const { return limit - bumpSpaceSize; } + char *headerBase() { return reinterpret_cast(this); } + char *bumpBase() const { return limit - bumpSpaceSize; } BumpChunk *thisDuringConstruction() { return this; } @@ -98,7 +99,7 @@ class BumpChunk } void setBump(void *ptr) { - JS_ASSERT(base() <= ptr); + JS_ASSERT(bumpBase() <= ptr); JS_ASSERT(ptr <= limit); DebugOnly prevBump = bump; bump = static_cast(ptr); @@ -110,10 +111,10 @@ class BumpChunk BumpChunk *next() const { return next_; } void setNext(BumpChunk *succ) { next_ = succ; } - size_t used() const { return bump - base(); } + size_t used() const { return bump - bumpBase(); } void resetBump() { - setBump(reinterpret_cast(this) + sizeof(BumpChunk)); + setBump(headerBase() + sizeof(BumpChunk)); } void *mark() const { return bump; } @@ -125,25 +126,26 @@ class BumpChunk } bool contains(void *mark) const { - return base() <= mark && mark <= limit; + return bumpBase() <= mark && mark <= limit; } - bool canAlloc(size_t n) { - return AlignPtr(bump) + n <= limit; - } - - bool canAllocUnaligned(size_t n) { - return bump + n <= limit; - } + bool canAlloc(size_t n); + bool canAllocUnaligned(size_t n); /* Try to perform an allocation of size |n|, return null if not possible. */ JS_ALWAYS_INLINE void *tryAlloc(size_t n) { char *aligned = AlignPtr(bump); char *newBump = aligned + n; + if (newBump > limit) return NULL; + /* Check for overflow. */ + if (JS_UNLIKELY(newBump < bump)) + return NULL; + + JS_ASSERT(canAlloc(n)); /* Ensure consistency between "can" and "try". */ setBump(newBump); return aligned; } @@ -157,13 +159,7 @@ class BumpChunk } static BumpChunk *new_(size_t chunkSize); - - static void delete_(BumpChunk *chunk) { -#ifdef DEBUG - memset(chunk, 0xcd, sizeof(*chunk) + chunk->bumpSpaceSize); -#endif - js_free(chunk); - } + static void delete_(BumpChunk *chunk); }; } /* namespace detail */ From 33b56cbbab0d0061d97593273d3df9fd0889217c Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Tue, 11 Oct 2011 11:06:00 -0700 Subject: [PATCH 50/57] Bug 677411 - Fix some red in SM builds --- js/src/gc/Statistics.h | 2 +- js/src/jsapi.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/src/gc/Statistics.h b/js/src/gc/Statistics.h index 5c60afeaaaf..05c681324c0 100644 --- a/js/src/gc/Statistics.h +++ b/js/src/gc/Statistics.h @@ -62,7 +62,7 @@ enum Reason { SHAPE, REFILL }; -static int NUM_REASONS = REFILL + 1; +static const int NUM_REASONS = REFILL + 1; static inline const char * ExplainReason(Reason r) diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 72a98c762d5..71c403ae4e5 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -695,7 +695,7 @@ JSRuntime::JSRuntime() requestDone(NULL), requestCount(0), gcThread(NULL), - gcHelperThread(this), + gcHelperThread(thisFromCtor()), rtLock(NULL), # ifdef DEBUG rtLockOwner(0), From 2a04c7b23445adce975b2f30916c48efe73551f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Desr=C3=A9?= Date: Tue, 11 Oct 2011 11:21:27 -0700 Subject: [PATCH 51/57] Bug 690635 - Issues with camera input on DroidX [r=wjohnston] --- embedding/android/GeckoApp.java | 10 ++++++++++ embedding/android/GeckoAppShell.java | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/embedding/android/GeckoApp.java b/embedding/android/GeckoApp.java index 9b77071373a..fed88714553 100644 --- a/embedding/android/GeckoApp.java +++ b/embedding/android/GeckoApp.java @@ -79,6 +79,7 @@ abstract public class GeckoApp public static AbsoluteLayout mainLayout; public static GeckoSurfaceView surfaceView; + public static SurfaceView cameraView; public static GeckoApp mAppContext; public static boolean mFullscreen = false; public static File sGREDir = null; @@ -377,6 +378,11 @@ abstract public class GeckoApp WindowManager.LayoutParams.FLAG_FULLSCREEN : 0, WindowManager.LayoutParams.FLAG_FULLSCREEN); + if (cameraView == null) { + cameraView = new SurfaceView(this); + cameraView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + } + if (surfaceView == null) surfaceView = new GeckoSurfaceView(this); else @@ -388,6 +394,10 @@ abstract public class GeckoApp AbsoluteLayout.LayoutParams.MATCH_PARENT, 0, 0)); + + // Some phones (eg. nexus S) need at least a 8x16 preview size + mainLayout.addView(cameraView, new AbsoluteLayout.LayoutParams(8, 16, 0, 0)); + setContentView(mainLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); diff --git a/embedding/android/GeckoAppShell.java b/embedding/android/GeckoAppShell.java index da7a2de2f22..dab15390c78 100644 --- a/embedding/android/GeckoAppShell.java +++ b/embedding/android/GeckoAppShell.java @@ -1531,7 +1531,7 @@ public class GeckoAppShell static int kPreferedFps = 25; static byte[] sCameraBuffer = null; - + static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) { Log.i("GeckoAppJava", "initCamera(" + aContentType + ", " + aWidth + "x" + aHeight + ") on thread " + Thread.currentThread().getId()); @@ -1585,6 +1585,14 @@ public class GeckoAppShell } } + try { + sCamera.setPreviewDisplay(GeckoApp.cameraView.getHolder()); + } catch(IOException e) { + Log.e("GeckoAppJava", "Error setPreviewDisplay:", e); + } catch(RuntimeException e) { + Log.e("GeckoAppJava", "Error setPreviewDisplay:", e); + } + sCamera.setParameters(params); sCameraBuffer = new byte[(bufferSize * 12) / 8]; sCamera.addCallbackBuffer(sCameraBuffer); From 3d71de9278f7adcb30aa83aa03df4191421573e9 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Wed, 12 Oct 2011 16:16:05 +1300 Subject: [PATCH 52/57] Bug 693519 - Don't call GetHitDepthAtPoint if we didn't hit anything. r=roc --- layout/base/nsDisplayList.cpp | 16 +++++++++------- layout/generic/nsFrame.cpp | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 810caa79b86..4481a352796 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -741,14 +741,16 @@ void nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, nsTArray *writeFrames = aOutFrames; if (item->GetType() == nsDisplayItem::TYPE_TRANSFORM && item->GetUnderlyingFrame()->Preserves3D()) { - nsDisplayTransform *transform = static_cast(item); - nsPoint point = aRect.TopLeft(); - // A 1x1 rect means a point, otherwise use the center of the rect - if (aRect.width != 1 || aRect.height != 1) { - point = aRect.Center(); + if (outFrames.Length()) { + nsDisplayTransform *transform = static_cast(item); + nsPoint point = aRect.TopLeft(); + // A 1x1 rect means a point, otherwise use the center of the rect + if (aRect.width != 1 || aRect.height != 1) { + point = aRect.Center(); + } + temp.AppendElement(FramesWithDepth(transform->GetHitDepthAtPoint(point))); + writeFrames = &temp[temp.Length() - 1].mFrames; } - temp.AppendElement(FramesWithDepth(transform->GetHitDepthAtPoint(point))); - writeFrames = &temp[temp.Length() - 1].mFrames; } else { // We may have just finished a run of consecutive preserve-3d transforms, // so flush these into the destination array before processing our frame list. diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index e024103d60a..477cc1859cb 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -6576,7 +6576,7 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas, if (!Preserves3DChildren()) { NS_FOR_FRAME_OVERFLOW_TYPES(otype) { nsRect& o = aOverflowAreas.Overflow(otype); - o = nsDisplayTransform::TransformRect(o, this, nsPoint(0, 0), &newBounds); + o = nsDisplayTransform::TransformRect(o, this, nsPoint(0, 0), &newBounds); } } else { ComputePreserve3DChildrenOverflow(aOverflowAreas, newBounds); From 953041ee8e675c6976d48302460cece4021f4c94 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Wed, 12 Oct 2011 16:16:06 +1300 Subject: [PATCH 53/57] Bug 693520 - Fix backface visibility calculations, and share can-hit checks. r=derf --- gfx/thebes/gfx3DMatrix.cpp | 29 ++++++++++++++++++++--------- gfx/thebes/gfx3DMatrix.h | 6 ++++++ layout/base/nsDisplayList.cpp | 28 +++++++++++++++++----------- 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/gfx/thebes/gfx3DMatrix.cpp b/gfx/thebes/gfx3DMatrix.cpp index c22a5a636f7..98fc8189a01 100644 --- a/gfx/thebes/gfx3DMatrix.cpp +++ b/gfx/thebes/gfx3DMatrix.cpp @@ -801,15 +801,26 @@ gfxRect gfx3DMatrix::ProjectRectBounds(const gfxRect& aRect) const gfxPoint3D gfx3DMatrix::GetNormalVector() const { - // Define a plane in transformed space as the transformations - // of 3 points on the z=0 screen plane. - gfxPoint3D a = Transform3D(gfxPoint3D(0, 0, 0)); - gfxPoint3D b = Transform3D(gfxPoint3D(0, 1, 0)); - gfxPoint3D c = Transform3D(gfxPoint3D(1, 0, 0)); + // Define a plane in transformed space as the transformations + // of 3 points on the z=0 screen plane. + gfxPoint3D a = Transform3D(gfxPoint3D(0, 0, 0)); + gfxPoint3D b = Transform3D(gfxPoint3D(0, 1, 0)); + gfxPoint3D c = Transform3D(gfxPoint3D(1, 0, 0)); - // Convert to two vectors on the surface of the plane. - gfxPoint3D ab = b - a; - gfxPoint3D ac = c - a; + // Convert to two vectors on the surface of the plane. + gfxPoint3D ab = b - a; + gfxPoint3D ac = c - a; - return ac.CrossProduct(ab); + return ac.CrossProduct(ab); } + +bool gfx3DMatrix::IsBackfaceVisible() const +{ + // Inverse()._33 < 0; + gfxFloat det = Determinant(); + float _33 = _12*_24*_41 - _14*_22*_41 + + _14*_21*_42 - _11*_24*_42 - + _12*_21*_44 + _11*_22*_44; + return (_33 * det) < 0; +} + diff --git a/gfx/thebes/gfx3DMatrix.h b/gfx/thebes/gfx3DMatrix.h index 4cb4dde501f..169328674f2 100644 --- a/gfx/thebes/gfx3DMatrix.h +++ b/gfx/thebes/gfx3DMatrix.h @@ -306,6 +306,12 @@ public: */ gfxPoint3D GetNormalVector() const; + /** + * Returns true if a plane transformed by this matrix will + * have it's back face visible. + */ + bool IsBackfaceVisible() const; + /** * Check if matrix is singular (no inverse exists). */ diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 4481a352796..09983ab2a88 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -2547,6 +2547,19 @@ nsDisplayTransform::GetResultingTransformMatrix(const nsIFrame* aFrame, (newOrigin + toMozOrigin, result); } +/* If the matrix is singular, or a hidden backface is shown, the frame won't be visible or hit. */ +static bool IsFrameVisible(nsIFrame* aFrame, const gfx3DMatrix& aMatrix) +{ + if (aMatrix.IsSingular()) { + return false; + } + if (aFrame->GetStyleDisplay()->mBackfaceVisibility == NS_STYLE_BACKFACE_VISIBILITY_HIDDEN && + aMatrix.IsBackfaceVisible()) { + return false; + } + return true; +} + const gfx3DMatrix& nsDisplayTransform::GetTransform(float aFactor) { @@ -2567,9 +2580,7 @@ already_AddRefed nsDisplayTransform::BuildLayer(nsDisplayListBuilder *aBu const gfx3DMatrix& newTransformMatrix = GetTransform(mFrame->PresContext()->AppUnitsPerDevPixel()); - if (newTransformMatrix.IsSingular() || - (mFrame->GetStyleDisplay()->mBackfaceVisibility == NS_STYLE_BACKFACE_VISIBILITY_HIDDEN && - newTransformMatrix.GetNormalVector().z <= 0.0)) { + if (!IsFrameVisible(mFrame, newTransformMatrix)) { return nsnull; } @@ -2646,11 +2657,8 @@ void nsDisplayTransform::HitTest(nsDisplayListBuilder *aBuilder, float factor = nsPresContext::AppUnitsPerCSSPixel(); gfx3DMatrix matrix = GetTransform(factor); - /* If the matrix is singular, or a hidden backface is shown, we didn't hit anything. */ - if (matrix.IsSingular() || - (mFrame->GetStyleDisplay()->mBackfaceVisibility == NS_STYLE_BACKFACE_VISIBILITY_HIDDEN && - matrix.GetNormalVector().z <= 0.0)) { - return; + if (!IsFrameVisible(mFrame, matrix)) { + return; } /* We want to go from transformed-space to regular space. @@ -2708,9 +2716,7 @@ nsDisplayTransform::GetHitDepthAtPoint(const nsPoint& aPoint) float factor = nsPresContext::AppUnitsPerCSSPixel(); gfx3DMatrix matrix = GetTransform(factor); - NS_ASSERTION(!matrix.IsSingular(), "We can't have hit a singular matrix!"); - NS_ASSERTION(mFrame->GetStyleDisplay()->mBackfaceVisibility != NS_STYLE_BACKFACE_VISIBILITY_HIDDEN || - matrix.GetNormalVector().z > 0.0, "We can't have hit the hidden backface of a layer!"); + NS_ASSERTION(IsFrameVisible(mFrame, matrix), "We can't have hit a frame that isn't visible!"); gfxPoint point = matrix.Inverse().ProjectPoint(gfxPoint(NSAppUnitsToFloatPixels(aPoint.x, factor), From 560e54035f162d439d8abdac8191cf7b4de4147d Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 11 Oct 2011 12:38:36 -0700 Subject: [PATCH 54/57] Bug 693712 - Followup to fix further SM-specific build breakage (r=billm) --HG-- extra : rebase_source : d9de95b4267d5aa0f6cdb53ce6bfbb0028fcdd3c --- js/src/jsprobes.cpp | 2 ++ js/src/jsprobes.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/js/src/jsprobes.cpp b/js/src/jsprobes.cpp index f85b8c33f01..b68c47479be 100644 --- a/js/src/jsprobes.cpp +++ b/js/src/jsprobes.cpp @@ -113,6 +113,7 @@ Probes::JITGranularityRequested() return want; } +#ifdef JS_METHODJIT void Probes::registerMJITCode(JSContext *cx, js::mjit::JITScript *jscr, JSScript *script, JSFunction *fun, @@ -142,6 +143,7 @@ Probes::registerICCode(JSContext *cx, for (JITWatcher **p = jitWatchers.begin(); p != jitWatchers.end(); ++p) (*p)->registerICCode(cx, jscr, script, pc, start, size); } +#endif /* ICs are unregistered in a batch */ void diff --git a/js/src/jsprobes.h b/js/src/jsprobes.h index d6b79a1fc69..e0ea4cf6a85 100644 --- a/js/src/jsprobes.h +++ b/js/src/jsprobes.h @@ -229,6 +229,7 @@ class JITWatcher { public: virtual JITReportGranularity granularityRequested() = 0; +#ifdef JS_METHODJIT virtual void registerMJITCode(JSContext *cx, js::mjit::JITScript *jscr, JSScript *script, JSFunction *fun, mjit::Compiler_ActiveFrame** inlineFrames, @@ -241,6 +242,7 @@ public: virtual void registerICCode(JSContext *cx, js::mjit::JITScript *jscr, JSScript *script, jsbytecode* pc, void *start, size_t size) = 0; +#endif virtual void discardExecutableRegion(void *start, size_t size) = 0; }; @@ -271,6 +273,7 @@ removeAllJITWatchers(JSRuntime *rt); JITReportGranularity JITGranularityRequested(); +#ifdef JS_METHODJIT /* * New method JIT code has been created */ @@ -294,6 +297,7 @@ void registerICCode(JSContext *cx, mjit::JITScript *jscr, JSScript *script, jsbytecode* pc, void *start, size_t size); +#endif /* JS_METHODJIT */ /* * A whole region of code has been deallocated, containing any number of ICs. From bfaddac1ae29e59c583c3c9e8034d475b23d1328 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 11 Oct 2011 21:51:37 -0700 Subject: [PATCH 55/57] Bug 693886 - non-threadsafe link error with JS_CallOnce (r=jwalden) --HG-- extra : rebase_source : dcdabb93321a669066fa8b3afd7900b02ff09079 --- js/src/jslock.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/jslock.cpp b/js/src/jslock.cpp index 449e7c790b6..6db587bdff8 100644 --- a/js/src/jslock.cpp +++ b/js/src/jslock.cpp @@ -37,8 +37,9 @@ * * ***** END LICENSE BLOCK ***** */ -#include "jstypes.h" +#include "jsapi.h" #include "jspubtd.h" +#include "jstypes.h" #ifdef JS_THREADSAFE From 69ac900ce99bf481eb6a2136a6c8161b57bdcf76 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Wed, 12 Oct 2011 11:50:31 -0500 Subject: [PATCH 56/57] Bug 693890 - Build fix for disable-accessibility link errors post the landing of bug 677883. r=davidb --- ipc/glue/WindowsMessageLoop.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ipc/glue/WindowsMessageLoop.cpp b/ipc/glue/WindowsMessageLoop.cpp index df9c4dd2355..7e993f2deb7 100644 --- a/ipc/glue/WindowsMessageLoop.cpp +++ b/ipc/glue/WindowsMessageLoop.cpp @@ -101,8 +101,10 @@ using namespace mozilla::ipc::windows; // pulled from widget's nsAppShell extern const PRUnichar* kAppShellEventId; +#if defined(ACCESSIBILITY) // pulled from accessibility's win utils extern const PRUnichar* kPropNameTabContent; +#endif namespace { @@ -381,11 +383,13 @@ WindowIsDeferredWindow(HWND hWnd) return false; } +#if defined(ACCESSIBILITY) // Tab content creates a window that responds to accessible WM_GETOBJECT // calls. This window can safely be ignored. if (::GetPropW(hWnd, kPropNameTabContent)) { return false; } +#endif // Common mozilla windows we must defer messages to. nsDependentString className(buffer, length); From a2b3604dc78b10c3c605e5d85e70f2b8bd26f72e Mon Sep 17 00:00:00 2001 From: Neil Rashbrook Date: Wed, 12 Oct 2011 18:31:47 +0100 Subject: [PATCH 57/57] Bug 451250 When navigating session history, use an error page instead of the POSTDATA prompt r=bz ui-r=faaborg --- .../chrome/overrides/appstrings.properties | 1 + .../en-US/chrome/overrides/netError.dtd | 3 + docshell/base/nsDocShell.cpp | 114 ++---------------- docshell/resources/content/netError.xhtml | 2 + .../en-US/chrome/appstrings.properties | 1 + dom/locales/en-US/chrome/netError.dtd | 3 + 6 files changed, 22 insertions(+), 102 deletions(-) diff --git a/browser/locales/en-US/chrome/overrides/appstrings.properties b/browser/locales/en-US/chrome/overrides/appstrings.properties index b87d1be476b..87e9538f7a6 100644 --- a/browser/locales/en-US/chrome/overrides/appstrings.properties +++ b/browser/locales/en-US/chrome/overrides/appstrings.properties @@ -47,6 +47,7 @@ confirmRepostPrompt=To display this page, %S must send information that will rep resendButton.label=Resend unknownSocketType=Firefox doesn't know how to communicate with the server. netReset=The connection to the server was reset while the page was loading. +notCached=This document is no longer available. netOffline=Firefox is currently in offline mode and can't browse the Web. isprinting=The document cannot change while Printing or in Print Preview. deniedPortAccess=This address uses a network port which is normally used for purposes other than Web browsing. Firefox has canceled the request for your protection. diff --git a/browser/locales/en-US/chrome/overrides/netError.dtd b/browser/locales/en-US/chrome/overrides/netError.dtd index c15db2fed0d..a45a1b809d1 100644 --- a/browser/locales/en-US/chrome/overrides/netError.dtd +++ b/browser/locales/en-US/chrome/overrides/netError.dtd @@ -52,6 +52,9 @@ + +The requested document is not available in Firefox's cache.

  • As a security precuation, Firefox does not automatically re-request sensitive documents.
  • Click Try Again to re-request the document from the website.
"> + diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index cc0be8c85d9..42a38b39529 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -3974,10 +3974,12 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI *aURI, error.AssignLiteral("netReset"); break; case NS_ERROR_DOCUMENT_NOT_CACHED: - // Doc failed to load because we are offline and the cache does not - // contain a copy of the document. + // Doc failed to load because the cache does not contain a copy of + // the document. + error.AssignLiteral("notCached"); + break; case NS_ERROR_OFFLINE: - // Doc failed to load because we are offline + // Doc failed to load because we are offline. error.AssignLiteral("netOffline"); break; case NS_ERROR_DOCUMENT_IS_PRINTMODE: @@ -6370,109 +6372,17 @@ nsDocShell::EndPageLoad(nsIWebProgress * aProgress, aStatus == NS_ERROR_PHISHING_URI || aStatus == NS_ERROR_UNSAFE_CONTENT_TYPE || aStatus == NS_ERROR_REMOTE_XUL || + aStatus == NS_ERROR_OFFLINE || NS_ERROR_GET_MODULE(aStatus) == NS_ERROR_MODULE_SECURITY) { DisplayLoadError(aStatus, url, nsnull, aChannel); } else if (aStatus == NS_ERROR_DOCUMENT_NOT_CACHED) { - /* A document that was requested to be fetched *only* from - * the cache is not in cache. May be this is one of those - * postdata results. Throw a dialog to the user, - * saying that the page has expired from cache and ask if - * they wish to refetch the page from the net. Do this only - * if the request is a form post. - */ - nsCAutoString method; - if (httpChannel) - httpChannel->GetRequestMethod(method); - if (method.Equals("POST") && !NS_IsOffline()) { - bool repost; - rv = ConfirmRepost(&repost); - if (NS_FAILED(rv)) return rv; - // If the user pressed cancel in the dialog, return. Don't try - // to load the page without the post data. - if (!repost) - return NS_OK; - - // The user wants to repost the data to the server. - // If the page was loaded due to a back/forward/go - // operation, update the session history index. - // This is similar to the updating done in - // nsDocShell::OnNewURI() for regular pages - nsCOMPtr rootSH=mSessionHistory; - if (!mSessionHistory) { - nsCOMPtr root; - //Get the root docshell - GetSameTypeRootTreeItem(getter_AddRefs(root)); - if (root) { - // QI root to nsIWebNavigation - nsCOMPtr rootAsWebnav = - do_QueryInterface(root); - if (rootAsWebnav) { - // Get the handle to SH from the root docshell - rootAsWebnav->GetSessionHistory(getter_AddRefs(rootSH)); - } - } - } // mSessionHistory - - if (rootSH && (mLoadType & LOAD_CMD_HISTORY)) { - nsCOMPtr shInternal = - do_QueryInterface(rootSH); - if (shInternal) { - rootSH->GetIndex(&mPreviousTransIndex); - shInternal->UpdateIndex(); - rootSH->GetIndex(&mLoadedTransIndex); -#ifdef DEBUG_PAGE_CACHE - printf("Previous index: %d, Loaded index: %d\n\n", - mPreviousTransIndex, mLoadedTransIndex); -#endif - } - } - - // Make it look like we really did honestly finish loading the - // history page we were loading, since the "reload" load we're - // about to kick off will reload our current history entry. - // This is a bit of a hack, and if the force-load fails I think - // we'll end up being confused about what page we're on... but - // we would anyway, since we've updated the session history - // index above. - SetHistoryEntry(&mOSHE, loadingSHE); - - // The user does want to repost the data to the server. - // Initiate a new load again. - - // Get the postdata if any from the channel. - nsCOMPtr inputStream; - nsCOMPtr referrer; - if (httpChannel) { - httpChannel->GetReferrer(getter_AddRefs(referrer)); - nsCOMPtr uploadChannel = - do_QueryInterface(aChannel); - if (uploadChannel) { - uploadChannel->GetUploadStream(getter_AddRefs(inputStream)); - } - } - nsCOMPtr postDataSeekable = - do_QueryInterface(inputStream); - if (postDataSeekable) { - postDataSeekable->Seek(nsISeekableStream::NS_SEEK_SET, 0); - } - InternalLoad(url, // URI - referrer, // Referring URI - nsnull, // Owner - INTERNAL_LOAD_FLAGS_INHERIT_OWNER, // Inherit owner - nsnull, // No window target - nsnull, // No type hint - inputStream, // Post data stream - nsnull, // No headers stream - LOAD_RELOAD_BYPASS_PROXY_AND_CACHE,// Load type - nsnull, // No SHEntry - PR_TRUE, // first party site - nsnull, // No nsIDocShell - nsnull); // No nsIRequest - } - else { - DisplayLoadError(aStatus, url, nsnull, aChannel); - } + // Non-caching channels will simply return NS_ERROR_OFFLINE. + // Caching channels would have to look at their flags to work + // out which error to return. Or we can fix up the error here. + if (!(mLoadType & LOAD_CMD_HISTORY)) + aStatus = NS_ERROR_OFFLINE; + DisplayLoadError(aStatus, url, nsnull, aChannel); } } // if we have a host diff --git a/docshell/resources/content/netError.xhtml b/docshell/resources/content/netError.xhtml index 459b709ddbc..51b8935de91 100644 --- a/docshell/resources/content/netError.xhtml +++ b/docshell/resources/content/netError.xhtml @@ -323,6 +323,7 @@

&redirectLoop.title;

&unknownSocketType.title;

&netReset.title;

+

¬Cached.title;

&netOffline.title;

&netInterrupt.title;

&deniedPortAccess.title;

@@ -348,6 +349,7 @@
&redirectLoop.longDesc;
&unknownSocketType.longDesc;
&netReset.longDesc;
+
¬Cached.longDesc;
&netOffline.longDesc2;
&netInterrupt.longDesc;
&deniedPortAccess.longDesc;
diff --git a/dom/locales/en-US/chrome/appstrings.properties b/dom/locales/en-US/chrome/appstrings.properties index af740b5e007..f55b82dfd3b 100644 --- a/dom/locales/en-US/chrome/appstrings.properties +++ b/dom/locales/en-US/chrome/appstrings.properties @@ -46,6 +46,7 @@ confirmRepostPrompt=To display this page, the application must send information resendButton.label=Resend unknownSocketType=This document cannot be displayed unless you install the Personal Security Manager (PSM). Download and install PSM and try again, or contact your system administrator. netReset=The document contains no data. +notCached=This document is no longer available. netOffline=This document cannot be displayed while offline. To go online, uncheck Work Offline from the File menu. isprinting=The document cannot change while Printing or in Print Preview. deniedPortAccess=Access to the port number given has been disabled for security reasons. diff --git a/dom/locales/en-US/chrome/netError.dtd b/dom/locales/en-US/chrome/netError.dtd index ea97efaea34..2c969c743a4 100644 --- a/dom/locales/en-US/chrome/netError.dtd +++ b/dom/locales/en-US/chrome/netError.dtd @@ -24,6 +24,9 @@ The browser connected successfully, but the connection was interrupted while transferring information. Please try again.

  • Are you unable to browse other sites? Check the computer's network connection.
  • Still having trouble? Consult your network administrator or Internet provider for assistance.
"> + +The requested document is not available in the browser's cache.

  • As a security precuation, the browser does not automatically re-request sensitive documents.
  • Click Try Again to re-request the document from the website.
"> + The browser is operating in its offline mode and cannot connect to the requested item.

  • Is the computer connected to an active network?
  • Press "Try Again" to switch to online mode and reload the page.
">