From 7e8f8dbf597a233ef4599089a05a6e7e858fe901 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 9 Jun 2014 12:13:21 +0100 Subject: [PATCH 01/21] Backed out changeset 6cc9ac1f57fa (bug 1022212) --- modules/libpref/src/init/all.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 04c1a9e8542c..b7dccbe16de1 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -250,7 +250,7 @@ pref("media.apple.mp3.enabled", true); #ifdef MOZ_WEBRTC pref("media.navigator.enabled", true); pref("media.navigator.video.enabled", true); -pref("media.navigator.load_adapt", true); +pref("media.navigator.load_adapt", false); pref("media.navigator.load_adapt.measure_interval",1000); pref("media.navigator.load_adapt.avg_seconds",3); pref("media.navigator.load_adapt.high_load","0.90"); From f9cec5e762e0057fcb51547ce1c5173cd15a1943 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 9 Jun 2014 12:14:27 +0100 Subject: [PATCH 02/21] Backed out changeset b5067fbd502e (bug 1022376) for Android crashes during 408431-1.html --- content/media/webrtc/LoadManager.cpp | 1 - content/media/webrtc/LoadMonitor.cpp | 36 +++++----------------------- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/content/media/webrtc/LoadManager.cpp b/content/media/webrtc/LoadManager.cpp index 494190c20900..b2d604c4f228 100644 --- a/content/media/webrtc/LoadManager.cpp +++ b/content/media/webrtc/LoadManager.cpp @@ -58,7 +58,6 @@ LoadManager::LoadManager(int aLoadMeasurementInterval, LoadManager::~LoadManager() { - LOG(("LoadManager: shutting down LoadMonitor")); mLoadMonitor->Shutdown(); } diff --git a/content/media/webrtc/LoadMonitor.cpp b/content/media/webrtc/LoadMonitor.cpp index 37733de14fa8..2a39ad88cce9 100644 --- a/content/media/webrtc/LoadMonitor.cpp +++ b/content/media/webrtc/LoadMonitor.cpp @@ -149,17 +149,11 @@ private: void LoadMonitor::Shutdown() { + MutexAutoLock lock(mLock); if (mLoadInfoThread) { - { - MutexAutoLock lock(mLock); - LOG(("LoadMonitor: shutting down")); - mShutdownPending = true; - mCondVar.Notify(); - } + mShutdownPending = true; + mCondVar.Notify(); - // Note: can't just call ->Shutdown() from here; that spins the event - // loop here, causing re-entrancy issues if we're invoked from cycle - // collection. Argh. mLoadInfoThread = nullptr; nsRefPtr remObsRunner = new LoadMonitorRemoveObserver(this); @@ -522,10 +516,8 @@ class LoadInfoCollectRunner : public nsRunnable { public: LoadInfoCollectRunner(nsRefPtr loadMonitor, - RefPtr loadInfo, - nsIThread *loadInfoThread) - : mThread(loadInfoThread), - mLoadUpdateInterval(loadMonitor->mLoadUpdateInterval), + RefPtr loadInfo) + : mLoadUpdateInterval(loadMonitor->mLoadUpdateInterval), mLoadNoiseCounter(0) { mLoadMonitor = loadMonitor; @@ -534,19 +526,6 @@ public: NS_IMETHOD Run() { - if (NS_IsMainThread()) { - if (mThread) { - // Don't leak threads! - mThread->Shutdown(); // can't Shutdown from the thread itself, darn - // Don't null out mThread! - // See bug 999104. We must hold a ref to the thread across Dispatch() - // since the internal mThread ref could be released while processing - // the Dispatch(), and Dispatch/PutEvent itself doesn't hold a ref; it - // assumes the caller does. - } - return NS_OK; - } - MutexAutoLock lock(mLoadMonitor->mLock); while (!mLoadMonitor->mShutdownPending) { mLoadInfo->UpdateSystemLoad(); @@ -564,13 +543,10 @@ public: mLoadMonitor->mCondVar.Wait(PR_MillisecondsToInterval(mLoadUpdateInterval)); } - // ok, we need to exit safely and can't shut ourselves down (DARN) - NS_DispatchToMainThread(this); return NS_OK; } private: - nsCOMPtr mThread; RefPtr mLoadInfo; nsRefPtr mLoadMonitor; int mLoadUpdateInterval; @@ -629,7 +605,7 @@ LoadMonitor::Init(nsRefPtr &self) NS_NewNamedThread("Sys Load Info", getter_AddRefs(mLoadInfoThread)); nsRefPtr runner = - new LoadInfoCollectRunner(self, load_info, mLoadInfoThread); + new LoadInfoCollectRunner(self, load_info); mLoadInfoThread->Dispatch(runner, NS_DISPATCH_NORMAL); return NS_OK; From 5478be066e5a9c2324d654e0cd7f4229f038e7d3 Mon Sep 17 00:00:00 2001 From: Hannes Verschore Date: Mon, 9 Jun 2014 13:42:33 +0200 Subject: [PATCH 03/21] Bug 1009603 - Tracelogger: Part 2: Fix throw statements, r=bbouvier --- js/src/jit/IonFrames.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/src/jit/IonFrames.cpp b/js/src/jit/IonFrames.cpp index f1ea645ea491..329d3a603254 100644 --- a/js/src/jit/IonFrames.cpp +++ b/js/src/jit/IonFrames.cpp @@ -583,6 +583,7 @@ void HandleException(ResumeFromException *rfe) { JSContext *cx = GetJSContextFromJitCode(); + TraceLogger *logger = TraceLoggerForMainThread(cx->runtime()); rfe->kind = ResumeFromException::RESUME_ENTRY_FRAME; @@ -633,10 +634,14 @@ HandleException(ResumeFromException *rfe) // When profiling, each frame popped needs a notification that // the function has exited, so invoke the probe that a function // is exiting. + JSScript *script = frames.script(); probes::ExitScript(cx, script, script->functionNonDelazifying(), popSPSFrame); - if (!frames.more()) + if (!frames.more()) { + TraceLogStopEvent(logger, TraceLogger::IonMonkey); + TraceLogStopEvent(logger); break; + } ++frames; } @@ -664,6 +669,9 @@ HandleException(ResumeFromException *rfe) if (rfe->kind != ResumeFromException::RESUME_ENTRY_FRAME) return; + TraceLogStopEvent(logger, TraceLogger::Baseline); + TraceLogStopEvent(logger); + // Unwind profiler pseudo-stack JSScript *script = iter.script(); probes::ExitScript(cx, script, script->functionNonDelazifying(), From 0105001fe8440cd87f41612aef4b1cf75d9990a7 Mon Sep 17 00:00:00 2001 From: Hannes Verschore Date: Mon, 9 Jun 2014 13:42:33 +0200 Subject: [PATCH 04/21] Bug 1009603 - Tracelogger: Part 3: Fix empty filenames, r=bbouvier --- js/src/vm/TraceLogging.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/src/vm/TraceLogging.cpp b/js/src/vm/TraceLogging.cpp index cc62ff0c4fe6..d28232ef8d36 100644 --- a/js/src/vm/TraceLogging.cpp +++ b/js/src/vm/TraceLogging.cpp @@ -378,6 +378,9 @@ TraceLogger::createTextId(const char *text) uint32_t TraceLogger::createTextId(JSScript *script) { + if (!script->filename()) + return createTextId(""); + assertNoQuotes(script->filename()); PointerHashMap::AddPtr p = pointerMap.lookupForAdd(script); @@ -406,6 +409,9 @@ TraceLogger::createTextId(JSScript *script) uint32_t TraceLogger::createTextId(const JS::ReadOnlyCompileOptions &compileOptions) { + if (!compileOptions.filename()) + return createTextId(""); + assertNoQuotes(compileOptions.filename()); PointerHashMap::AddPtr p = pointerMap.lookupForAdd(&compileOptions); From 58dc14962bb2bc0124189d57085574be998f180e Mon Sep 17 00:00:00 2001 From: Hannes Verschore Date: Mon, 9 Jun 2014 13:42:33 +0200 Subject: [PATCH 05/21] Bug 1009603 - Tracelogger: Part 4: Handle debugger resumption value in Baseline, r=jandem --- js/src/jit/BaselineCompiler.cpp | 6 +++--- js/src/jit/VMFunctions.cpp | 16 ++++++++++++++++ js/src/jit/VMFunctions.h | 1 + 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/js/src/jit/BaselineCompiler.cpp b/js/src/jit/BaselineCompiler.cpp index 0c5f5d14dd3b..062438e35281 100644 --- a/js/src/jit/BaselineCompiler.cpp +++ b/js/src/jit/BaselineCompiler.cpp @@ -2861,8 +2861,9 @@ BaselineCompiler::emit_JSOP_DEBUGGER() return true; } -typedef bool (*DebugEpilogueFn)(JSContext *, BaselineFrame *, jsbytecode *, bool); -static const VMFunction DebugEpilogueInfo = FunctionInfo(jit::DebugEpilogue); +typedef bool (*DebugEpilogueFn)(JSContext *, BaselineFrame *, jsbytecode *); +static const VMFunction DebugEpilogueInfo = + FunctionInfo(jit::DebugEpilogueOnBaselineReturn); bool BaselineCompiler::emitReturn() @@ -2877,7 +2878,6 @@ BaselineCompiler::emitReturn() masm.loadBaselineFramePtr(BaselineFrameReg, R0.scratchReg()); prepareVMCall(); - pushArg(Imm32(1)); pushArg(ImmPtr(pc)); pushArg(R0.scratchReg()); if (!callVM(DebugEpilogueInfo)) diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index 3b65d9530867..80f25ec9743b 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -16,6 +16,7 @@ #include "vm/ArrayObject.h" #include "vm/Debugger.h" #include "vm/Interpreter.h" +#include "vm/TraceLogging.h" #include "jsinferinlines.h" @@ -762,6 +763,21 @@ DebugPrologue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool *mustRet } } +bool +DebugEpilogueOnBaselineReturn(JSContext *cx, BaselineFrame *frame, jsbytecode *pc) +{ + if (!DebugEpilogue(cx, frame, pc, true)) { + // DebugEpilogue popped the frame by updating jitTop, so run the stop event + // here before we enter the exception handler. + TraceLogger *logger = TraceLoggerForMainThread(cx->runtime()); + TraceLogStopEvent(logger, TraceLogger::Baseline); + TraceLogStopEvent(logger); // Leave script. + return false; + } + + return true; +} + bool DebugEpilogue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool ok) { diff --git a/js/src/jit/VMFunctions.h b/js/src/jit/VMFunctions.h index 3d0bd4b1e741..a2199ff2925a 100644 --- a/js/src/jit/VMFunctions.h +++ b/js/src/jit/VMFunctions.h @@ -647,6 +647,7 @@ uint32_t GetIndexFromString(JSString *str); bool DebugPrologue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool *mustReturn); bool DebugEpilogue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool ok); +bool DebugEpilogueOnBaselineReturn(JSContext *cx, BaselineFrame *frame, jsbytecode *pc); bool StrictEvalPrologue(JSContext *cx, BaselineFrame *frame); bool HeavyweightFunPrologue(JSContext *cx, BaselineFrame *frame); From c171ccdd6c3c4c2dfb8fa990435630985d3f047a Mon Sep 17 00:00:00 2001 From: Hannes Verschore Date: Mon, 9 Jun 2014 13:42:34 +0200 Subject: [PATCH 06/21] Bug 1009603 - Tracelogger: Part 5: Handle stack mismatch gracefully (for release builds), r=bbouvier --- js/src/vm/TraceLogging.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/vm/TraceLogging.cpp b/js/src/vm/TraceLogging.cpp index d28232ef8d36..48b4f0497aaa 100644 --- a/js/src/vm/TraceLogging.cpp +++ b/js/src/vm/TraceLogging.cpp @@ -328,7 +328,7 @@ TraceLogger::~TraceLogger() // We temporary enable logging for this. Stop doesn't need any extra data, // so is safe to do, even when we encountered OOM. enabled = true; - while (stack.size() > 0) + while (stack.currentId() > 0) stopEvent(); enabled = false; } @@ -707,6 +707,7 @@ TraceLogger::stopEvent() return; } } + JS_ASSERT(stack.currentId() > 0); stack.pop(); } From 0db6ab210d8afe21809edfe97d8599f0a2e34255 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Mon, 9 Jun 2014 07:50:12 -0400 Subject: [PATCH 07/21] Bug 1022235: Disable crashtest until underlying cause is backed out (bug 1022509) rs=edmorely --- dom/src/offline/crashtests/crashtests.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/src/offline/crashtests/crashtests.list b/dom/src/offline/crashtests/crashtests.list index a185168c2634..39d23a72d734 100644 --- a/dom/src/offline/crashtests/crashtests.list +++ b/dom/src/offline/crashtests/crashtests.list @@ -1 +1 @@ -load 408431-1.html +skip load 408431-1.html # bug 1022509 - renable when the cause of that is backed out From dab181fc1f4b2e88cc02e0c1a9bd4721050bccb6 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 9 Jun 2014 07:57:10 -0400 Subject: [PATCH 08/21] Bug 1022420 - Disable NS_NO_VTABLE on clang-cl in order to avoid the compiler warning; r=froydnj --- xpcom/base/nscore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xpcom/base/nscore.h b/xpcom/base/nscore.h index 9e8b4c5b10c2..31c924ca0a7e 100644 --- a/xpcom/base/nscore.h +++ b/xpcom/base/nscore.h @@ -256,7 +256,7 @@ #ifdef NS_NO_VTABLE #undef NS_NO_VTABLE #endif -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__clang__) #define NS_NO_VTABLE __declspec(novtable) #else #define NS_NO_VTABLE From f07137fd9ad7695cc1ae67ca40357a26b8789605 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Sun, 8 Jun 2014 18:37:14 -0400 Subject: [PATCH 09/21] Bug 1022376: Properly shut down LoadMonitor threads r=jib --- content/media/webrtc/LoadManager.cpp | 1 + content/media/webrtc/LoadMonitor.cpp | 36 +++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/content/media/webrtc/LoadManager.cpp b/content/media/webrtc/LoadManager.cpp index b2d604c4f228..494190c20900 100644 --- a/content/media/webrtc/LoadManager.cpp +++ b/content/media/webrtc/LoadManager.cpp @@ -58,6 +58,7 @@ LoadManager::LoadManager(int aLoadMeasurementInterval, LoadManager::~LoadManager() { + LOG(("LoadManager: shutting down LoadMonitor")); mLoadMonitor->Shutdown(); } diff --git a/content/media/webrtc/LoadMonitor.cpp b/content/media/webrtc/LoadMonitor.cpp index 2a39ad88cce9..37733de14fa8 100644 --- a/content/media/webrtc/LoadMonitor.cpp +++ b/content/media/webrtc/LoadMonitor.cpp @@ -149,11 +149,17 @@ private: void LoadMonitor::Shutdown() { - MutexAutoLock lock(mLock); if (mLoadInfoThread) { - mShutdownPending = true; - mCondVar.Notify(); + { + MutexAutoLock lock(mLock); + LOG(("LoadMonitor: shutting down")); + mShutdownPending = true; + mCondVar.Notify(); + } + // Note: can't just call ->Shutdown() from here; that spins the event + // loop here, causing re-entrancy issues if we're invoked from cycle + // collection. Argh. mLoadInfoThread = nullptr; nsRefPtr remObsRunner = new LoadMonitorRemoveObserver(this); @@ -516,8 +522,10 @@ class LoadInfoCollectRunner : public nsRunnable { public: LoadInfoCollectRunner(nsRefPtr loadMonitor, - RefPtr loadInfo) - : mLoadUpdateInterval(loadMonitor->mLoadUpdateInterval), + RefPtr loadInfo, + nsIThread *loadInfoThread) + : mThread(loadInfoThread), + mLoadUpdateInterval(loadMonitor->mLoadUpdateInterval), mLoadNoiseCounter(0) { mLoadMonitor = loadMonitor; @@ -526,6 +534,19 @@ public: NS_IMETHOD Run() { + if (NS_IsMainThread()) { + if (mThread) { + // Don't leak threads! + mThread->Shutdown(); // can't Shutdown from the thread itself, darn + // Don't null out mThread! + // See bug 999104. We must hold a ref to the thread across Dispatch() + // since the internal mThread ref could be released while processing + // the Dispatch(), and Dispatch/PutEvent itself doesn't hold a ref; it + // assumes the caller does. + } + return NS_OK; + } + MutexAutoLock lock(mLoadMonitor->mLock); while (!mLoadMonitor->mShutdownPending) { mLoadInfo->UpdateSystemLoad(); @@ -543,10 +564,13 @@ public: mLoadMonitor->mCondVar.Wait(PR_MillisecondsToInterval(mLoadUpdateInterval)); } + // ok, we need to exit safely and can't shut ourselves down (DARN) + NS_DispatchToMainThread(this); return NS_OK; } private: + nsCOMPtr mThread; RefPtr mLoadInfo; nsRefPtr mLoadMonitor; int mLoadUpdateInterval; @@ -605,7 +629,7 @@ LoadMonitor::Init(nsRefPtr &self) NS_NewNamedThread("Sys Load Info", getter_AddRefs(mLoadInfoThread)); nsRefPtr runner = - new LoadInfoCollectRunner(self, load_info); + new LoadInfoCollectRunner(self, load_info, mLoadInfoThread); mLoadInfoThread->Dispatch(runner, NS_DISPATCH_NORMAL); return NS_OK; From d6dc3bf601ce4d6e0f8f428c713270908dfc9ae1 Mon Sep 17 00:00:00 2001 From: Randell Jesup Date: Sat, 7 Jun 2014 13:19:12 -0400 Subject: [PATCH 10/21] Bug 1022212: enable WebRTC load adaptation by default rs=jesup,gcp --- modules/libpref/src/init/all.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index b7dccbe16de1..04c1a9e8542c 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -250,7 +250,7 @@ pref("media.apple.mp3.enabled", true); #ifdef MOZ_WEBRTC pref("media.navigator.enabled", true); pref("media.navigator.video.enabled", true); -pref("media.navigator.load_adapt", false); +pref("media.navigator.load_adapt", true); pref("media.navigator.load_adapt.measure_interval",1000); pref("media.navigator.load_adapt.avg_seconds",3); pref("media.navigator.load_adapt.high_load","0.90"); From d1b4c8dc019bdbdfc22b794d000d1ffcce20f610 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 9 Jun 2014 13:17:46 +0100 Subject: [PATCH 11/21] Backed out changeset 182986e4ab10 (bug 1009603) --- js/src/vm/TraceLogging.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/src/vm/TraceLogging.cpp b/js/src/vm/TraceLogging.cpp index 48b4f0497aaa..d28232ef8d36 100644 --- a/js/src/vm/TraceLogging.cpp +++ b/js/src/vm/TraceLogging.cpp @@ -328,7 +328,7 @@ TraceLogger::~TraceLogger() // We temporary enable logging for this. Stop doesn't need any extra data, // so is safe to do, even when we encountered OOM. enabled = true; - while (stack.currentId() > 0) + while (stack.size() > 0) stopEvent(); enabled = false; } @@ -707,7 +707,6 @@ TraceLogger::stopEvent() return; } } - JS_ASSERT(stack.currentId() > 0); stack.pop(); } From f1c8b7711533c8e772abd7c87ca27e9030ceec3a Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 9 Jun 2014 13:17:50 +0100 Subject: [PATCH 12/21] Backed out changeset e1bc74560a8a (bug 1009603) --- js/src/jit/BaselineCompiler.cpp | 6 +++--- js/src/jit/VMFunctions.cpp | 16 ---------------- js/src/jit/VMFunctions.h | 1 - 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/js/src/jit/BaselineCompiler.cpp b/js/src/jit/BaselineCompiler.cpp index 062438e35281..0c5f5d14dd3b 100644 --- a/js/src/jit/BaselineCompiler.cpp +++ b/js/src/jit/BaselineCompiler.cpp @@ -2861,9 +2861,8 @@ BaselineCompiler::emit_JSOP_DEBUGGER() return true; } -typedef bool (*DebugEpilogueFn)(JSContext *, BaselineFrame *, jsbytecode *); -static const VMFunction DebugEpilogueInfo = - FunctionInfo(jit::DebugEpilogueOnBaselineReturn); +typedef bool (*DebugEpilogueFn)(JSContext *, BaselineFrame *, jsbytecode *, bool); +static const VMFunction DebugEpilogueInfo = FunctionInfo(jit::DebugEpilogue); bool BaselineCompiler::emitReturn() @@ -2878,6 +2877,7 @@ BaselineCompiler::emitReturn() masm.loadBaselineFramePtr(BaselineFrameReg, R0.scratchReg()); prepareVMCall(); + pushArg(Imm32(1)); pushArg(ImmPtr(pc)); pushArg(R0.scratchReg()); if (!callVM(DebugEpilogueInfo)) diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index 80f25ec9743b..3b65d9530867 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -16,7 +16,6 @@ #include "vm/ArrayObject.h" #include "vm/Debugger.h" #include "vm/Interpreter.h" -#include "vm/TraceLogging.h" #include "jsinferinlines.h" @@ -763,21 +762,6 @@ DebugPrologue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool *mustRet } } -bool -DebugEpilogueOnBaselineReturn(JSContext *cx, BaselineFrame *frame, jsbytecode *pc) -{ - if (!DebugEpilogue(cx, frame, pc, true)) { - // DebugEpilogue popped the frame by updating jitTop, so run the stop event - // here before we enter the exception handler. - TraceLogger *logger = TraceLoggerForMainThread(cx->runtime()); - TraceLogStopEvent(logger, TraceLogger::Baseline); - TraceLogStopEvent(logger); // Leave script. - return false; - } - - return true; -} - bool DebugEpilogue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool ok) { diff --git a/js/src/jit/VMFunctions.h b/js/src/jit/VMFunctions.h index a2199ff2925a..3d0bd4b1e741 100644 --- a/js/src/jit/VMFunctions.h +++ b/js/src/jit/VMFunctions.h @@ -647,7 +647,6 @@ uint32_t GetIndexFromString(JSString *str); bool DebugPrologue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool *mustReturn); bool DebugEpilogue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool ok); -bool DebugEpilogueOnBaselineReturn(JSContext *cx, BaselineFrame *frame, jsbytecode *pc); bool StrictEvalPrologue(JSContext *cx, BaselineFrame *frame); bool HeavyweightFunPrologue(JSContext *cx, BaselineFrame *frame); From 45409b6f2c00d6f5ebefc9609a14023165c17a9a Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 9 Jun 2014 13:17:53 +0100 Subject: [PATCH 13/21] Backed out changeset dcccbc732972 (bug 1009603) --- js/src/vm/TraceLogging.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/js/src/vm/TraceLogging.cpp b/js/src/vm/TraceLogging.cpp index d28232ef8d36..cc62ff0c4fe6 100644 --- a/js/src/vm/TraceLogging.cpp +++ b/js/src/vm/TraceLogging.cpp @@ -378,9 +378,6 @@ TraceLogger::createTextId(const char *text) uint32_t TraceLogger::createTextId(JSScript *script) { - if (!script->filename()) - return createTextId(""); - assertNoQuotes(script->filename()); PointerHashMap::AddPtr p = pointerMap.lookupForAdd(script); @@ -409,9 +406,6 @@ TraceLogger::createTextId(JSScript *script) uint32_t TraceLogger::createTextId(const JS::ReadOnlyCompileOptions &compileOptions) { - if (!compileOptions.filename()) - return createTextId(""); - assertNoQuotes(compileOptions.filename()); PointerHashMap::AddPtr p = pointerMap.lookupForAdd(&compileOptions); From e01863a58ffca28bb58b7b4106eae5104836e565 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Mon, 9 Jun 2014 13:18:43 +0100 Subject: [PATCH 14/21] Backed out changeset 008243793ef8 (bug 1009603) for compilation errors; CLOSED TREE --- js/src/jit/IonFrames.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/js/src/jit/IonFrames.cpp b/js/src/jit/IonFrames.cpp index 329d3a603254..f1ea645ea491 100644 --- a/js/src/jit/IonFrames.cpp +++ b/js/src/jit/IonFrames.cpp @@ -583,7 +583,6 @@ void HandleException(ResumeFromException *rfe) { JSContext *cx = GetJSContextFromJitCode(); - TraceLogger *logger = TraceLoggerForMainThread(cx->runtime()); rfe->kind = ResumeFromException::RESUME_ENTRY_FRAME; @@ -634,14 +633,10 @@ HandleException(ResumeFromException *rfe) // When profiling, each frame popped needs a notification that // the function has exited, so invoke the probe that a function // is exiting. - JSScript *script = frames.script(); probes::ExitScript(cx, script, script->functionNonDelazifying(), popSPSFrame); - if (!frames.more()) { - TraceLogStopEvent(logger, TraceLogger::IonMonkey); - TraceLogStopEvent(logger); + if (!frames.more()) break; - } ++frames; } @@ -669,9 +664,6 @@ HandleException(ResumeFromException *rfe) if (rfe->kind != ResumeFromException::RESUME_ENTRY_FRAME) return; - TraceLogStopEvent(logger, TraceLogger::Baseline); - TraceLogStopEvent(logger); - // Unwind profiler pseudo-stack JSScript *script = iter.script(); probes::ExitScript(cx, script, script->functionNonDelazifying(), From de1b12e91e3df694c632c7f79b1886910597f991 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Mon, 9 Jun 2014 22:42:02 +0900 Subject: [PATCH 15/21] Bug 1020832 tabbrowser's constructor shouldn't use Cc and Ci since using it sometimes causes undefined error r=enndeakin --- browser/base/content/tabbrowser.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index f7ce49aa2f26..1c9d2accf96a 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -3067,7 +3067,10 @@ this.mCurrentBrowser = document.getAnonymousElementByAttribute(this, "anonid", "initialBrowser"); this.mCurrentTab = this.tabContainer.firstChild; - let els = Cc["@mozilla.org/eventlistenerservice;1"].getService(Ci.nsIEventListenerService); + const nsIEventListenerService = + Components.interfaces.nsIEventListenerService; + let els = Components.classes["@mozilla.org/eventlistenerservice;1"] + .getService(nsIEventListenerService); els.addSystemEventListener(document, "keydown", this, false); els.addSystemEventListener(document, "keypress", this, false); window.addEventListener("sizemodechange", this, false); @@ -3147,7 +3150,10 @@ this.mTabListeners[i].destroy(); this.mTabListeners[i] = null; } - let els = Cc["@mozilla.org/eventlistenerservice;1"].getService(Ci.nsIEventListenerService); + const nsIEventListenerService = + Components.interfaces.nsIEventListenerService; + let els = Components.classes["@mozilla.org/eventlistenerservice;1"] + .getService(nsIEventListenerService); els.removeSystemEventListener(document, "keydown", this, false); els.removeSystemEventListener(document, "keypress", this, false); window.removeEventListener("sizemodechange", this, false); From fe6adc9f5762a4de6035a4dcb40ebfcc4946729c Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Mon, 9 Jun 2014 10:57:30 -0400 Subject: [PATCH 16/21] Bug 1008211 - Don't use BufferTextureClient with 2D canvases with D3D11 OMTC. r=bas --- gfx/layers/client/CanvasClient.cpp | 34 ++++++++++++++++++++---------- gfx/layers/client/CanvasClient.h | 4 ++++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index 16861d2f6b2e..c26538364ee2 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -74,17 +74,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) } gfx::SurfaceFormat surfaceFormat = gfx::ImageFormatToSurfaceFormat(format); - if (aLayer->IsGLLayer()) { - // We want a cairo backend here as we don't want to be copying into - // an accelerated backend and we like LockBits to work. This is currently - // the most effective way to make this work. - mBuffer = CreateBufferTextureClient(surfaceFormat, flags, BackendType::CAIRO); - } else { - // XXX - We should use CreateTextureClientForDrawing, but we first need - // to use double buffering. - mBuffer = CreateBufferTextureClient(surfaceFormat, flags, - gfxPlatform::GetPlatform()->GetPreferredCanvasBackend()); - } + mBuffer = CreateTextureClientForCanvas(surfaceFormat, flags, aLayer); MOZ_ASSERT(mBuffer->CanExposeDrawTarget()); mBuffer->AllocateForSurface(aSize); @@ -119,6 +109,28 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) } } +TemporaryRef +CanvasClient2D::CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat, + TextureFlags aFlags, + ClientCanvasLayer* aLayer) +{ + if (aLayer->IsGLLayer()) { + // We want a cairo backend here as we don't want to be copying into + // an accelerated backend and we like LockBits to work. This is currently + // the most effective way to make this work. + return CreateBufferTextureClient(aFormat, aFlags, BackendType::CAIRO); + } + + gfx::BackendType backend = gfxPlatform::GetPlatform()->GetPreferredCanvasBackend(); +#ifdef XP_WIN + return CreateTextureClientForDrawing(aFormat, aFlags, backend, aSize); +#else + // XXX - We should use CreateTextureClientForDrawing, but we first need + // to use double buffering. + return CreateBufferTextureClient(aFormat, aFlags, backend); +#endif +} + CanvasClientSurfaceStream::CanvasClientSurfaceStream(CompositableForwarder* aLayerForwarder, TextureFlags aFlags) : CanvasClient(aLayerForwarder, aFlags) diff --git a/gfx/layers/client/CanvasClient.h b/gfx/layers/client/CanvasClient.h index b3e22bfc2574..58100eefd926 100644 --- a/gfx/layers/client/CanvasClient.h +++ b/gfx/layers/client/CanvasClient.h @@ -101,6 +101,10 @@ public: } private: + TemporaryRef CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat, + TextureFlags aFlags, + ClientCanvasLayer* aLayer); + RefPtr mBuffer; }; From d9c7b7c290e97275af55d91cdca566346871f224 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 9 Jun 2014 10:59:36 -0400 Subject: [PATCH 17/21] Bug 1021378 follow-up: take up my debugging stuff, and typos --- build/autoconf/toolchain.m4 | 3 --- 1 file changed, 3 deletions(-) diff --git a/build/autoconf/toolchain.m4 b/build/autoconf/toolchain.m4 index 0c122ce9b0e9..4aa8aded86d5 100644 --- a/build/autoconf/toolchain.m4 +++ b/build/autoconf/toolchain.m4 @@ -36,9 +36,6 @@ if test "$compiler" != "$cxxcompiler"; then fi CC_VERSION=`echo "$CC_VERSION" | sed 's/ //g'` CXX_VERSION=`echo "$CXX_VERSION" | sed 's/ //g'` -echo "$CC_VERSION" -echo "$CXX_VERSION" -ecit 1 if test "$compiler" = "gcc"; then GNU_CC=1 GNU_CXX=1 From 05944d30622adde32c76187117713786b5112fbf Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Mon, 9 Jun 2014 11:43:20 -0400 Subject: [PATCH 18/21] =?UTF-8?q?b711bc06d9ae=20Nicolas=20Silva=20?= =?UTF-8?q?=E2=80=93=20Bug=201008211=20-=20Backout=20changeset=20b711bc06d?= =?UTF-8?q?9ae=20for=20build=20bustage=20on=20a=20CLOSED=20TREE.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gfx/layers/client/CanvasClient.cpp | 34 ++++++++++-------------------- gfx/layers/client/CanvasClient.h | 4 ---- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/gfx/layers/client/CanvasClient.cpp b/gfx/layers/client/CanvasClient.cpp index c26538364ee2..16861d2f6b2e 100644 --- a/gfx/layers/client/CanvasClient.cpp +++ b/gfx/layers/client/CanvasClient.cpp @@ -74,7 +74,17 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) } gfx::SurfaceFormat surfaceFormat = gfx::ImageFormatToSurfaceFormat(format); - mBuffer = CreateTextureClientForCanvas(surfaceFormat, flags, aLayer); + if (aLayer->IsGLLayer()) { + // We want a cairo backend here as we don't want to be copying into + // an accelerated backend and we like LockBits to work. This is currently + // the most effective way to make this work. + mBuffer = CreateBufferTextureClient(surfaceFormat, flags, BackendType::CAIRO); + } else { + // XXX - We should use CreateTextureClientForDrawing, but we first need + // to use double buffering. + mBuffer = CreateBufferTextureClient(surfaceFormat, flags, + gfxPlatform::GetPlatform()->GetPreferredCanvasBackend()); + } MOZ_ASSERT(mBuffer->CanExposeDrawTarget()); mBuffer->AllocateForSurface(aSize); @@ -109,28 +119,6 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) } } -TemporaryRef -CanvasClient2D::CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat, - TextureFlags aFlags, - ClientCanvasLayer* aLayer) -{ - if (aLayer->IsGLLayer()) { - // We want a cairo backend here as we don't want to be copying into - // an accelerated backend and we like LockBits to work. This is currently - // the most effective way to make this work. - return CreateBufferTextureClient(aFormat, aFlags, BackendType::CAIRO); - } - - gfx::BackendType backend = gfxPlatform::GetPlatform()->GetPreferredCanvasBackend(); -#ifdef XP_WIN - return CreateTextureClientForDrawing(aFormat, aFlags, backend, aSize); -#else - // XXX - We should use CreateTextureClientForDrawing, but we first need - // to use double buffering. - return CreateBufferTextureClient(aFormat, aFlags, backend); -#endif -} - CanvasClientSurfaceStream::CanvasClientSurfaceStream(CompositableForwarder* aLayerForwarder, TextureFlags aFlags) : CanvasClient(aLayerForwarder, aFlags) diff --git a/gfx/layers/client/CanvasClient.h b/gfx/layers/client/CanvasClient.h index 58100eefd926..b3e22bfc2574 100644 --- a/gfx/layers/client/CanvasClient.h +++ b/gfx/layers/client/CanvasClient.h @@ -101,10 +101,6 @@ public: } private: - TemporaryRef CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat, - TextureFlags aFlags, - ClientCanvasLayer* aLayer); - RefPtr mBuffer; }; From 0c3504655df15b704002aa4b9f07841d0fe41051 Mon Sep 17 00:00:00 2001 From: Chris Lord Date: Mon, 9 Jun 2014 16:53:35 +0100 Subject: [PATCH 19/21] Bug 1017427 - Fix CompositorOGL RenderOffset not offsetting clipping rect. r=nical --- gfx/layers/opengl/CompositorOGL.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index e6ef98e59fd0..6eb693edfcd1 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -1008,6 +1008,9 @@ CompositorOGL::DrawQuad(const Rect& aRect, IntRect intClipRect; aClipRect.ToIntRect(&intClipRect); + if (!mTarget) { + intClipRect.MoveBy(mRenderOffset.x, mRenderOffset.y); + } gl()->fScissor(intClipRect.x, FlipY(intClipRect.y + intClipRect.height), intClipRect.width, intClipRect.height); From 2befea780dc784b21c7e2c49df534238fe3127f4 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Mon, 9 Jun 2014 17:20:19 +0100 Subject: [PATCH 20/21] Bug 1018682 - URL API - SetProtocol should serialize and reparse the URL, r=bz --- content/base/src/Link.cpp | 3 +++ dom/base/URL.cpp | 30 +++++++++++++++++++++++++- dom/base/test/mochitest.ini | 1 + dom/base/test/test_url_data.html | 37 ++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 dom/base/test/test_url_data.html diff --git a/content/base/src/Link.cpp b/content/base/src/Link.cpp index 9912d5f314a6..f5b7fdb38442 100644 --- a/content/base/src/Link.cpp +++ b/content/base/src/Link.cpp @@ -546,6 +546,9 @@ Link::SetHrefAttribute(nsIURI *aURI) { NS_ASSERTION(aURI, "Null URI is illegal!"); + // if we change this code to not reserialize we need to do something smarter + // in SetProtocol because changing the protocol of an URI can change the + // "nature" of the nsIURL/nsIURI implementation. nsAutoCString href; (void)aURI->GetSpec(href); (void)mElement->SetAttr(kNameSpaceID_None, nsGkAtoms::href, diff --git a/dom/base/URL.cpp b/dom/base/URL.cpp index cffd0ac1a04c..b086e2f16b0d 100644 --- a/dom/base/URL.cpp +++ b/dom/base/URL.cpp @@ -15,6 +15,7 @@ #include "nsIIOService.h" #include "nsEscape.h" #include "nsNetCID.h" +#include "nsNetUtil.h" #include "nsIURL.h" namespace mozilla { @@ -262,7 +263,34 @@ URL::SetProtocol(const nsAString& aProtocol) nsAString::const_iterator iter(start); FindCharInReadable(':', iter, end); - mURI->SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter))); + + // Changing the protocol of a URL, changes the "nature" of the URI + // implementation. In order to do this properly, we have to serialize the + // existing URL and reparse it in a new object. + nsCOMPtr clone; + nsresult rv = mURI->Clone(getter_AddRefs(clone)); + if (NS_WARN_IF(NS_FAILED(rv)) || !clone) { + return; + } + + rv = clone->SetScheme(NS_ConvertUTF16toUTF8(Substring(start, iter))); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; + } + + nsAutoCString href; + rv = clone->GetSpec(href); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; + } + + nsCOMPtr uri; + rv = NS_NewURI(getter_AddRefs(uri), href); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; + } + + mURI = uri; } #define URL_GETTER( value, func ) \ diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index 6b91fc6cc3a7..a30e7b08b401 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -60,6 +60,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Fails on b2g-desktop, track [test_setting_opener.html] skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage [test_url.html] +[test_url_data.html] [test_url_empty_port.html] [test_urlExceptions.html] [test_urlSearchParams.html] diff --git a/dom/base/test/test_url_data.html b/dom/base/test/test_url_data.html new file mode 100644 index 000000000000..082128f6d9fb --- /dev/null +++ b/dom/base/test/test_url_data.html @@ -0,0 +1,37 @@ + + + + + Test URL API - data:plain + + + + +Mozilla Bug 1018682 + + + + + From 160716596ef2e887c9d84eeb6cf9b6e15cb6b520 Mon Sep 17 00:00:00 2001 From: Malini Das Date: Mon, 9 Jun 2014 12:37:11 -0400 Subject: [PATCH 21/21] Bug 932804 - compensate for statusbar in APZ touch, r=dburns --- .../marionette/marionette-frame-manager.js | 4 ++ testing/marionette/marionette-listener.js | 58 +++++++++++-------- testing/marionette/marionette-server.js | 14 ++++- 3 files changed, 52 insertions(+), 24 deletions(-) diff --git a/testing/marionette/marionette-frame-manager.js b/testing/marionette/marionette-frame-manager.js index aacb86ed13c1..84b66b71b3cd 100644 --- a/testing/marionette/marionette-frame-manager.js +++ b/testing/marionette/marionette-frame-manager.js @@ -166,6 +166,8 @@ FrameManager.prototype = { messageManager.addWeakMessageListener("Marionette:emitTouchEvent", this.server); messageManager.addWeakMessageListener("Marionette:log", this.server); messageManager.addWeakMessageListener("Marionette:register", this.server); + messageManager.addWeakMessageListener("Marionette:setStatusbarHeight", this.server); + messageManager.addWeakMessageListener("Marionette:getStatusbarHeight", this.server); messageManager.addWeakMessageListener("Marionette:runEmulatorCmd", this.server); messageManager.addWeakMessageListener("Marionette:runEmulatorShell", this.server); messageManager.addWeakMessageListener("Marionette:shareData", this.server); @@ -196,6 +198,8 @@ FrameManager.prototype = { messageManager.removeWeakMessageListener("Marionette:log", this.server); messageManager.removeWeakMessageListener("Marionette:shareData", this.server); messageManager.removeWeakMessageListener("Marionette:register", this.server); + messageManager.removeWeakMessageListener("Marionette:setStatusbarHeight", this.server); + messageManager.removeWeakMessageListener("Marionette:getStatusbarHeight", this.server); messageManager.removeWeakMessageListener("Marionette:runEmulatorCmd", this.server); messageManager.removeWeakMessageListener("Marionette:runEmulatorShell", this.server); messageManager.removeWeakMessageListener("Marionette:switchToFrame", this.server); diff --git a/testing/marionette/marionette-listener.js b/testing/marionette/marionette-listener.js index 8aef2d8d0468..6a3f0e68ba86 100644 --- a/testing/marionette/marionette-listener.js +++ b/testing/marionette/marionette-listener.js @@ -72,7 +72,6 @@ let touchIds = {}; let multiLast = {}; let lastCoordinates = null; let isTap = false; -let scrolling = false; // whether to send mouse event let mouseEventsOnly = false; @@ -105,6 +104,10 @@ function registerSelf() { // check if we're the main process if (register[0][1] == true) { addMessageListener("MarionetteMainListener:emitTouchEvent", emitTouchEventForIFrame); + let height = getStatusbarHeight(); + if (height) { + sendSyncMessage("Marionette:setStatusbarHeight", { height: height }); + } } importedScripts = FileUtils.getDir('TmpD', [], false); importedScripts.append('marionetteContentScripts'); @@ -125,6 +128,14 @@ function emitTouchEventForIFrame(message) { 1, 0); } +function getStatusbarHeight(message) { + let statusbar = curFrame.document.getElementById("statusbar"); + if (statusbar) { + //Yes, clientHeight. This statusbar affects screens where it isn't even visible, like FTU + return statusbar.clientHeight; + } +} + /** * Add a message listener that's tied to our listenerId. */ @@ -679,24 +690,31 @@ function executeWithCallback(msg, useFinish) { /** * This function creates a touch event given a touch type and a touch */ -function emitTouchEvent(type, touch) { +function emitTouchEvent(type, target, x, y, touchId) { if (!wasInterrupted()) { - let loggingInfo = "emitting Touch event of type " + type + " to element with id: " + touch.target.id + " and tag name: " + touch.target.tagName + " at coordinates (" + touch.clientX + ", " + touch.clientY + ") relative to the viewport"; - dumpLog(loggingInfo); var docShell = curFrame.document.defaultView. QueryInterface(Components.interfaces.nsIInterfaceRequestor). getInterface(Components.interfaces.nsIWebNavigation). QueryInterface(Components.interfaces.nsIDocShell); - if (docShell.asyncPanZoomEnabled && scrolling) { + if (docShell.asyncPanZoomEnabled) { // if we're in APZ and we're scrolling, we must use injectTouchEvent to dispatch our touchmove events + // NOTE: This is an internal frame, below the statusbar. The coordinates we get here must be offset by + // the coordinates of the statusbar + let statusbarHeight = sendSyncMessage("Marionette:getStatusbarHeight"); + if (statusbarHeight) { + y += parseInt(statusbarHeight, 10); + } + let touch = createATouch(target, x, y, touchId); let index = sendSyncMessage("MarionetteFrame:getCurrentFrameId"); // only call emitTouchEventForIFrame if we're inside an iframe. if (index != null) { + let loggingInfo = "emitting Touch event of type " + type + " to element with id: " + touch.target.id + " and tag name: " + touch.target.tagName + " at coordinates (" + touch.clientX + ", " + touch.clientY + ") relative to the viewport"; + dumpLog(loggingInfo); sendSyncMessage("Marionette:emitTouchEvent", {index: index, type: type, id: touch.identifier, clientX: touch.clientX, clientY: touch.clientY, radiusX: touch.radiusX, radiusY: touch.radiusY, rotation: touch.rotationAngle, force: touch.force}); - return; + return touch; } } // we get here if we're not in asyncPacZoomEnabled land, or if we're the main process @@ -707,8 +725,12 @@ function emitTouchEvent(type, touch) { {log: elementManager.wrapValue(marionetteLogObj.getLogs())}); marionetteLogObj.clearLogs(); */ + let touch = createATouch(target, x, y, touchId); + let loggingInfo = "emitting Touch event of type " + type + " to element with id: " + touch.target.id + " and tag name: " + touch.target.tagName + " at coordinates (" + touch.clientX + ", " + touch.clientY + ") relative to the viewport"; + dumpLog(loggingInfo); let domWindowUtils = curFrame.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils); domWindowUtils.sendTouchEvent(type, [touch.identifier], [touch.clientX], [touch.clientY], [touch.radiusX], [touch.radiusY], [touch.rotationAngle], [touch.force], 1, 0); + return touch; } } @@ -819,9 +841,8 @@ function generateEvents(type, x, y, touchId, target) { } else { let touchId = nextTouchId++; - let touch = createATouch(target, x, y, touchId); - emitTouchEvent('touchstart', touch); - emitTouchEvent('touchend', touch); + emitTouchEvent('touchstart', target, x, y, touchId); + emitTouchEvent('touchend', target, x, y, touchId); mousetap(target.ownerDocument, x, y); } lastCoordinates = null; @@ -834,9 +855,7 @@ function generateEvents(type, x, y, touchId, target) { } else { let touchId = nextTouchId++; - let touch = createATouch(target, x, y, touchId); - emitTouchEvent('touchstart', touch); - touchIds[touchId] = touch; + touchIds[touchId] = emitTouchEvent('touchstart', target, x, y, touchId); return touchId; } break; @@ -846,8 +865,7 @@ function generateEvents(type, x, y, touchId, target) { } else { let touch = touchIds[touchId]; - touch = createATouch(touch.target, lastCoordinates[0], lastCoordinates[1], touchId); - emitTouchEvent('touchend', touch); + emitTouchEvent('touchend', touch.target, lastCoordinates[0], lastCoordinates[1], touchId); if (isTap) { mousetap(touch.target.ownerDocument, touch.clientX, touch.clientY); } @@ -862,7 +880,8 @@ function generateEvents(type, x, y, touchId, target) { emitMouseEvent(doc, 'mouseup', lastCoordinates[0], lastCoordinates[1]); } else { - emitTouchEvent('touchcancel', touchIds[touchId]); + let touch = touchIds[touchId]; + emitTouchEvent('touchcancel', touch.target, x, y, touchId); delete touchIds[touchId]; } lastCoordinates = null; @@ -873,9 +892,7 @@ function generateEvents(type, x, y, touchId, target) { emitMouseEvent(doc, 'mousemove', x, y); } else { - touch = createATouch(touchIds[touchId].target, x, y, touchId); - touchIds[touchId] = touch; - emitTouchEvent('touchmove', touch); + touchIds[touchId] = emitTouchEvent('touchmove', touchIds[touchId].target, x, y, touchId); } break; case 'contextmenu': @@ -981,9 +998,6 @@ function actions(chain, touchId, command_id, i) { return; } // look ahead to check if we're scrolling. Needed for APZ touch dispatching. - if ((i != chain.length) && (chain[i][0].indexOf('move') !== -1)) { - scrolling = true; - } el = elementManager.getKnownElement(pack[1], curFrame); c = coordinates(el, pack[2], pack[3]); touchId = generateEvents('press', c.x, c.y, null, el); @@ -992,7 +1006,6 @@ function actions(chain, touchId, command_id, i) { case 'release': generateEvents('release', lastCoordinates[0], lastCoordinates[1], touchId); actions(chain, null, command_id, i); - scrolling = false; break; case 'move': el = elementManager.getKnownElement(pack[1], curFrame); @@ -1026,7 +1039,6 @@ function actions(chain, touchId, command_id, i) { case 'cancel': generateEvents('cancel', lastCoordinates[0], lastCoordinates[1], touchId); actions(chain, touchId, command_id, i); - scrolling = false; break; case 'longPress': generateEvents('contextmenu', lastCoordinates[0], lastCoordinates[1], touchId); diff --git a/testing/marionette/marionette-server.js b/testing/marionette/marionette-server.js index 30d71d8e8893..6adc2ffd4f59 100644 --- a/testing/marionette/marionette-server.js +++ b/testing/marionette/marionette-server.js @@ -138,6 +138,7 @@ function MarionetteServerConnection(aPrefix, aTransport, aServer) this.currentFrameElement = null; this.testName = null; this.mozBrowserClose = null; + this.statusbarHeight = null; } MarionetteServerConnection.prototype = { @@ -424,7 +425,12 @@ MarionetteServerConnection.prototype = { whenBrowserStarted: function MDA_whenBrowserStarted(win, newSession) { try { if (!Services.prefs.getBoolPref("marionette.contentListener") || !newSession) { - this.curBrowser.loadFrameScript(FRAME_SCRIPT, win); + try { + this.curBrowser.loadFrameScript(FRAME_SCRIPT, win); + } catch (e) { + logger.info("failed loading frame script due to" + e.toString()); + throw e; + } } } catch (e) { @@ -2436,6 +2442,12 @@ MarionetteServerConnection.prototype = { globalMessageManager.broadcastAsyncMessage( "MarionetteMainListener:emitTouchEvent", message.json); return; + case "Marionette:setStatusbarHeight": + //NOTE: If we had content<->content communication, this wouldn't be needed + this.statusbarHeight = message.json.height; + return; + case "Marionette:getStatusbarHeight": + return [this.statusbarHeight]; } } };